Java Code Examples for com.intellij.execution.configurations.RunConfiguration#getName()

The following examples show how to use com.intellij.execution.configurations.RunConfiguration#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseExecuteBeforeRunDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
private DefaultMutableTreeNode buildNodes() {
  DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Descriptor());
  RunManager runManager = RunManager.getInstance(myProject);
  final ConfigurationType[] configTypes = runManager.getConfigurationFactories();

  for (final ConfigurationType type : configTypes) {
    final Icon icon = TargetAWT.to(type.getIcon());
    DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new ConfigurationTypeDescriptor(type, icon, isConfigurationAssigned(type)));
    root.add(typeNode);
    final Set<String> addedNames = new THashSet<>();
    RunConfiguration[] configurations = runManager.getConfigurations(type);
    for (final RunConfiguration configuration : configurations) {
      final String configurationName = configuration.getName();
      if (addedNames.contains(configurationName)) {
        // add only the first configuration if more than one has the same name
        continue;
      }
      addedNames.add(configurationName);
      typeNode.add(new DefaultMutableTreeNode(new ConfigurationDescriptor(configuration, isConfigurationAssigned(configuration))));
    }
  }

  return root;
}
 
Example 2
Source File: ExportRunConfigurationTableModel.java    From intellij with Apache License 2.0 5 votes vote down vote up
ExportRunConfigurationTableModel(List<RunConfiguration> configurations) {
  enabled = new Boolean[configurations.size()];
  names = new String[configurations.size()];
  paths = new String[configurations.size()];

  UniqueNameGenerator nameGenerator = new UniqueNameGenerator();
  for (int i = 0; i < configurations.size(); i++) {
    RunConfiguration config = configurations.get(i);
    enabled[i] = false;
    names[i] = config.getName();
    paths[i] =
        nameGenerator.generateUniqueName(FileUtil.sanitizeFileName(config.getName()), "", ".xml");
  }
}
 
Example 3
Source File: AbstractAutoTestManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void saveConfigurationState(State state, RunProfile profile) {
  RunConfiguration runConfiguration = ObjectUtils.tryCast(profile, RunConfiguration.class);
  if (runConfiguration != null) {
    RunConfigurationDescriptor descriptor = new RunConfigurationDescriptor();
    descriptor.myType = runConfiguration.getType().getId();
    descriptor.myName = runConfiguration.getName();
    state.myEnabledRunConfigurations.add(descriptor);
  }
}
 
Example 4
Source File: RunManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Sets unique name if existing one is not 'unique' for corresponding configuration type
 *
 * @return <code>true</code> if name was changed
 */
public boolean setUniqueNameIfNeed(@Nonnull RunConfiguration configuration) {
  String oldName = configuration.getName();
  configuration.setName(suggestUniqueName(StringUtil.notNullize(oldName, UNNAMED), configuration.getType()));
  return !Comparing.equal(oldName, configuration.getName());
}