com.intellij.execution.ExecutionBundle Java Examples

The following examples show how to use com.intellij.execution.ExecutionBundle. 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: ScopeChooserConfigurable.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> result = new ArrayList<AnAction>();
  result.add(new MyAddAction(fromPopup));
  result.add(new MyDeleteAction(forAll(new Condition<Object>() {
    @Override
    public boolean value(final Object o) {
      if (o instanceof MyNode) {
        final Object editableObject = ((MyNode)o).getConfigurable().getEditableObject();
        return editableObject instanceof NamedScope;
      }
      return false;
    }
  })));
  result.add(new MyCopyAction());
  result.add(new MySaveAsAction());
  result.add(new MyMoveAction(ExecutionBundle.message("move.up.action.name"), IconUtil.getMoveUpIcon(), -1));
  result.add(new MyMoveAction(ExecutionBundle.message("move.down.action.name"), IconUtil.getMoveDownIcon(), 1));
  return result;
}
 
Example #2
Source File: ScriptRunnerUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static ScriptOutput executeScriptInConsoleWithFullOutput(String exePathString,
                                                                @Nullable VirtualFile scriptFile,
                                                                @Nullable String workingDirectory,
                                                                long timeout,
                                                                Condition<Key> scriptOutputType,
                                                                @NonNls String... parameters)
  throws ExecutionException {
  final OSProcessHandler processHandler = execute(exePathString, workingDirectory, scriptFile, parameters);

  ScriptOutput output = new ScriptOutput(scriptOutputType);
  processHandler.addProcessListener(output);
  processHandler.startNotify();

  if (!processHandler.waitFor(timeout)) {
    LOG.warn("Process did not complete in " + timeout / 1000 + "s");
    throw new ExecutionException(ExecutionBundle.message("script.execution.timeout", String.valueOf(timeout / 1000)));
  }
  LOG.debug("script output: " + output.myFilteredOutput);
  return output;
}
 
Example #3
Source File: LvcsHelper.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void addLabel(final TestFrameworkRunningModel model) {
  String label;
  int color;

  if (model.getRoot().isDefect()) {
    color = RED.getRGB();
    label = ExecutionBundle.message("junit.runing.info.tests.failed.label");
  }
  else {
    color = GREEN.getRGB();
    label = ExecutionBundle.message("junit.runing.info.tests.passed.label");
  }
  final TestConsoleProperties consoleProperties = model.getProperties();
  String name = label + " " + consoleProperties.getConfiguration().getName();

  Project project = consoleProperties.getProject();
  if (project.isDisposed()) return;

  LocalHistory.getInstance().putSystemLabel(project, name, color);
}
 
Example #4
Source File: ExportTestResultsForm.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
public String validate() {
  if (getExportFormat() == ExportTestResultsConfiguration.ExportFormat.UserTemplate) {
    if (StringUtil.isEmpty(myCustomTemplateField.getText())) {
      return ExecutionBundle.message("export.test.results.custom.template.path.empty");
    }
    File file = new File(myCustomTemplateField.getText());
    if (!file.isFile()) {
      return ExecutionBundle.message("export.test.results.custom.template.not.found", file.getAbsolutePath());
    }
  }

  if (StringUtil.isEmpty(myFileNameField.getText())) {
    return ExecutionBundle.message("export.test.results.output.filename.empty");
  }
  if (StringUtil.isEmpty(myFolderField.getText())) {
    return ExecutionBundle.message("export.test.results.output.path.empty");
  }

  return null;
}
 
Example #5
Source File: ScriptRunnerUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static String getProcessOutput(@Nonnull final ProcessHandler processHandler,
                                      @Nonnull final Condition<Key> outputTypeFilter,
                                      final long timeout)
  throws ExecutionException {
  LOG.assertTrue(!processHandler.isStartNotified());
  final StringBuilder outputBuilder = new StringBuilder();
  processHandler.addProcessListener(new ProcessAdapter() {
    @Override
    public void onTextAvailable(ProcessEvent event, Key outputType) {
      if (outputTypeFilter.value(outputType)) {
        final String text = event.getText();
        outputBuilder.append(text);
        if (LOG.isDebugEnabled()) {
          LOG.debug(text);
        }
      }
    }
  });
  processHandler.startNotify();
  if (!processHandler.waitFor(timeout)) {
    throw new ExecutionException(ExecutionBundle.message("script.execution.timeout", String.valueOf(timeout / 1000)));
  }
  return outputBuilder.toString();
}
 
Example #6
Source File: CommonProgramParametersPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected void initComponents() {
  myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), ExecutionBundle.message("run.configuration.program.parameters"));

  FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  //noinspection DialogTitleCapitalization
  fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
  myWorkingDirectoryComboBox = new MacroComboBoxWithBrowseButton(fileChooserDescriptor, getProject());

  myWorkingDirectoryComponent = LabeledComponent.create(myWorkingDirectoryComboBox, ExecutionBundle.message("run.configuration.working.directory.label"));
  myEnvVariablesComponent = new EnvironmentVariablesComponent();

  myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST);
  myProgramParametersComponent.setLabelLocation(BorderLayout.WEST);
  myWorkingDirectoryComponent.setLabelLocation(BorderLayout.WEST);

  addComponents();

  setPreferredSize(new Dimension(10, 10));

  copyDialogCaption(myProgramParametersComponent);
}
 
Example #7
Source File: EnvironmentVariablesTextFieldWithBrowseButton.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected MyEnvironmentVariablesDialog() {
  super(EnvironmentVariablesTextFieldWithBrowseButton.this, true);
  myEnvVariablesTable = new EnvVariablesTable();
  myEnvVariablesTable.setValues(convertToVariables(myData.getEnvs(), false));

  myUseDefaultCb.setSelected(isPassParentEnvs());
  myWholePanel.add(myEnvVariablesTable.getComponent(), BorderLayout.CENTER);
  JPanel useDefaultPanel = new JPanel(new BorderLayout());
  useDefaultPanel.add(myUseDefaultCb, BorderLayout.CENTER);
  HyperlinkLabel showLink = new HyperlinkLabel(ExecutionBundle.message("env.vars.show.system"));
  useDefaultPanel.add(showLink, BorderLayout.EAST);
  showLink.addHyperlinkListener(new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        showParentEnvironmentDialog(MyEnvironmentVariablesDialog.this.getWindow());
      }
    }
  });

  myWholePanel.add(useDefaultPanel, BorderLayout.SOUTH);
  setTitle(ExecutionBundle.message("environment.variables.dialog.title"));
  init();
}
 
Example #8
Source File: FlutterBazelRunConfigurationType.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private boolean isNewlyGeneratedName(String name) {
  // Try to determine if this we are creating a non-template configuration from a template.
  // This is a hack based on what the code does in RunConfigurable.createUniqueName().
  // If it fails to match, the new run config still works, just without any defaults set.
  final String baseName = ExecutionBundle.message("run.configuration.unnamed.name.prefix");
  return name.equals(baseName) || name.startsWith(baseName + " (");
}
 
Example #9
Source File: DiffHyperlink.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void printOn(final Printer printer) {
  if (!hasMoreThanOneLine(myActual.trim()) && !hasMoreThanOneLine(myExpected.trim()) && myPrintOneLine) {
    printer.print(NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
    printer.print(ExecutionBundle.message("diff.content.expected.for.file.title"), ConsoleViewContentType.SYSTEM_OUTPUT);
    printer.print(myExpected + NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
    printer.print(ExecutionBundle.message("junit.actual.text.label"), ConsoleViewContentType.SYSTEM_OUTPUT);
    printer.print(myActual + NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
  }
  printer.print(" ", ConsoleViewContentType.ERROR_OUTPUT);
  printer.printHyperlink(ExecutionBundle.message("junit.click.to.see.diff.link"), myDiffHyperlink);
  printer.print(NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
}
 
Example #10
Source File: TestDiffRequestProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
private Pair<String, DiffContent> createContentWithTitle(String titleKey, String contentString, String contentFilePath) {
  String title;
  DiffContent content;
  VirtualFile vFile;
  if (contentFilePath != null && (vFile = LocalFileSystem.getInstance().findFileByPath(contentFilePath)) != null) {
    title = ExecutionBundle.message(titleKey) + " (" + vFile.getPresentableUrl() + ")";
    content = DiffContentFactory.getInstance().create(getProject(), vFile);
  }
  else {
    title = ExecutionBundle.message(titleKey);
    content = DiffContentFactory.getInstance().create(contentString);
  }
  return Pair.create(title, content);
}
 
Example #11
Source File: TestStatusLine.java    From consulo with Apache License 2.0 5 votes vote down vote up
public TestStatusLine() {
  super(new BorderLayout());
  myProgressPanel = new JPanel(new GridBagLayout());
  add(myProgressPanel, BorderLayout.WEST);
  myProgressBar.setMaximum(100);
  myProgressPanel.add(myProgressBar, new GridBagConstraints(0, 0, 0, 0, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
                                                            new Insets(2, 8, 0, 8), 0, 0));
  setStatusColor(ColorProgressBar.GREEN);
  add(myState, BorderLayout.CENTER);
  myState.append(ExecutionBundle.message("junit.runing.info.starting.label"));
}
 
Example #12
Source File: CommonJavaParametersPanel.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
@Override
protected void addComponents() {
    myVMParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), ExecutionBundle.message("run.configuration.java.vm.parameters.label"));
    copyDialogCaption(myVMParametersComponent);

    myVMParametersComponent.setLabelLocation(BorderLayout.WEST);

    add(myVMParametersComponent);
    super.addComponents();
}
 
Example #13
Source File: TestsUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public TestResultPresentation getPresentation(int failedCount, int passedCount, int notStartedCount, int ignoredCount) {
  if (myRoot == null) {
    myBalloonText = myTitle = myStarted ? "Tests were interrupted" : ExecutionBundle.message("test.not.started.progress.text");
    myText = "";
    myType = MessageType.WARNING;
  }
  else {
    if (failedCount > 0) {
      myTitle = ExecutionBundle.message("junit.runing.info.tests.failed.label");
      myText = passedCount + " passed, " + failedCount + " failed" + (notStartedCount > 0 ? ", " + notStartedCount + " not started" : "");
      myType = MessageType.ERROR;
    }
    else if (notStartedCount > 0) {
      myTitle = ignoredCount > 0 ? "Tests Ignored" : ExecutionBundle.message("junit.running.info.failed.to.start.error.message");
      myText = passedCount + " passed, " + notStartedCount + (ignoredCount > 0 ? " ignored" : " not started");
      myType = ignoredCount == 0 ? MessageType.WARNING : MessageType.ERROR;
    }
    else {
      myTitle = ExecutionBundle.message("junit.runing.info.tests.passed.label");
      myText = passedCount + " passed";
      myType = MessageType.INFO;
    }
    if (myComment != null) {
      myText += " " + myComment;
    }
    myBalloonText = myTitle + ": " + myText;
  }
  return this;
}
 
Example #14
Source File: EmbeddedLinuxJVMRunnerValidator.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Validates if the Java Settings are Entered Correctly
 *
 * @param configuration
 * @throws RuntimeConfigurationException
 */
public static void checkJavaSettings(EmbeddedLinuxJVMRunConfiguration configuration) throws RuntimeConfigurationException {
    JavaRunConfigurationModule javaRunConfigurationModule = new JavaRunConfigurationModule(configuration.getProject(), false);
    PsiClass psiClass = javaRunConfigurationModule.findClass(configuration.getRunnerParameters().getMainclass());
    if (psiClass == null) {
        throw new RuntimeConfigurationWarning(ExecutionBundle.message("main.method.not.found.in.class.error.message", configuration.getRunnerParameters().getMainclass()));
    }
}
 
Example #15
Source File: FlutterBazelRunConfigurationType.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private boolean isNewlyGeneratedName(String name) {
  // Try to determine if this we are creating a non-template configuration from a template.
  // This is a hack based on what the code does in RunConfigurable.createUniqueName().
  // If it fails to match, the new run config still works, just without any defaults set.
  final String baseName = ExecutionBundle.message("run.configuration.unnamed.name.prefix");
  return name.equals(baseName) || name.startsWith(baseName + " (");
}
 
Example #16
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private Sdk createAlternativeJdk(@NotNull String jreHome) throws CantRunException {
    final Sdk configuredJdk = ProjectJdkTable.getInstance().findJdk(jreHome);
    if (configuredJdk != null) {
        return configuredJdk;
    }

    if (!JdkUtil.checkForJre(jreHome) && !JdkUtil.checkForJdk(jreHome)) {
        throw new CantRunException(ExecutionBundle.message("jre.path.is.not.valid.jre.home.error.message", jreHome));
    }

    final String versionString = SdkVersionUtil.detectJdkVersion(jreHome);
    final Sdk jdk = new SimpleJavaSdkType().createJdk(versionString != null ? versionString : "", jreHome);
    if (jdk == null) throw CantRunException.noJdkConfigured();
    return jdk;
}
 
Example #17
Source File: RunConfigurationModule.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void checkForWarning() throws RuntimeConfigurationException {
  final Module module = getModule();
  if (module == null) {
    if (myModulePointer != null) {
      String moduleName = myModulePointer.getName();
      if (ModuleManager.getInstance(myProject).getUnloadedModuleDescription(moduleName) != null) {
        throw new RuntimeConfigurationError(ExecutionBundle.message("module.is.unloaded.from.project.error.text", moduleName));
      }
      throw new RuntimeConfigurationError(ExecutionBundle.message("module.doesn.t.exist.in.project.error.text", moduleName));
    }
    throw new RuntimeConfigurationError(ExecutionBundle.message("module.not.specified.error.text"));
  }
}
 
Example #18
Source File: CloseAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public CloseAction(Executor executor, RunContentDescriptor contentDescriptor, Project project) {
  myExecutor = executor;
  myContentDescriptor = contentDescriptor;
  myProject = project;
  copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_CLOSE));
  final Presentation templatePresentation = getTemplatePresentation();
  templatePresentation.setIcon(AllIcons.Actions.Cancel);
  templatePresentation.setText(ExecutionBundle.message("close.tab.action.name"));
  templatePresentation.setDescription(null);
}
 
Example #19
Source File: StatusDashboardGroupingRule.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public ActionPresentation getPresentation() {
  return new ActionPresentationData(ExecutionBundle.message("run.dashboard.group.by.status.action.name"),
                                    ExecutionBundle.message("run.dashboard.group.by.status.action.name"),
                                    AllIcons.Actions.GroupByPrefix); // TODO [konstantin.aleev] provide new icon
}
 
Example #20
Source File: FolderDashboardGroupingRule.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public ActionPresentation getPresentation() {
  return new ActionPresentationData(ExecutionBundle.message("run.dashboard.group.by.folder.action.name"),
                                    ExecutionBundle.message("run.dashboard.group.by.folder.action.name"),
                                    AllIcons.Actions.GroupByPackage);
}
 
Example #21
Source File: ConfigurationTypeDashboardGroupingRule.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public ActionPresentation getPresentation() {
  return new ActionPresentationData(ExecutionBundle.message("run.dashboard.group.by.type.action.name"),
                                    ExecutionBundle.message("run.dashboard.group.by.type.action.name"),
                                    AllIcons.Actions.GroupByFile);
}
 
Example #22
Source File: RunDashboardContent.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void onSelectionChanged() {
  Set<AbstractTreeNode> nodes = myBuilder.getSelectedElements(AbstractTreeNode.class);
  if (nodes.size() != 1) {
    showMessagePanel(ExecutionBundle.message("run.dashboard.empty.selection.message"));
    myLastSelection = null;
    return;
  }

  AbstractTreeNode<?> node = nodes.iterator().next();
  if (Comparing.equal(node, myLastSelection)) {
    return;
  }

  myLastSelection = node;
  if (node instanceof DashboardNode) {
    Content content = ((DashboardNode)node).getContent();
    if (content != null) {
      if (content != myContentManager.getSelectedContent()) {
        myContentManager.removeContentManagerListener(myContentManagerListener);
        myContentManager.setSelectedContent(content);
        myContentManager.addContentManagerListener(myContentManagerListener);
      }
      showContentPanel();
      return;
    }
    if (node instanceof DashboardRunConfigurationNode) {
      showMessagePanel(ExecutionBundle.message("run.dashboard.not.started.configuration.message"));
      return;
    }
  }

  showMessagePanel(ExecutionBundle.message("run.dashboard.empty.selection.message"));
}
 
Example #23
Source File: EditRunConfigurationsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void update(final AnActionEvent e) {
  Presentation presentation = e.getPresentation();
  presentation.setEnabled(true);
  if (ActionPlaces.RUN_CONFIGURATIONS_COMBOBOX.equals(e.getPlace())) {
    presentation.setText(ExecutionBundle.message("edit.configuration.action"));
    presentation.setDescription(presentation.getText());
  }
}
 
Example #24
Source File: CreateAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private String generateName(final String actionText) {
  switch(myType) {
    case CREATE: return ExecutionBundle.message("create.run.configuration.for.item.action.name", actionText);
    case SELECT: return ExecutionBundle.message("select.run.configuration.for.item.action.name", actionText);
    default:  return ExecutionBundle.message("save.run.configuration.for.item.action.name", actionText);
  }
}
 
Example #25
Source File: CreateAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void perform(final ConfigurationContext context) {
  final RunnerAndConfigurationSettings configuration = context.getConfiguration();
  if (RunDialog.editConfiguration(context.getProject(), configuration, ExecutionBundle.message("create.run.configuration.for.item.dialog.title", configuration.getName()))) {
    final RunManagerImpl runManager = (RunManagerImpl)context.getRunManager();
    runManager.addConfiguration(configuration,
                                runManager.isConfigurationShared(configuration),
                                runManager.getBeforeRunTasks(configuration.getConfiguration()), false);
    runManager.setSelectedConfiguration(configuration);
  }
}
 
Example #26
Source File: EnvironmentVariablesTextFieldWithBrowseButton.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void showParentEnvironmentDialog(@Nonnull Component parent) {
  EnvVariablesTable table = new EnvVariablesTable();
  table.setValues(convertToVariables(new TreeMap<>(new GeneralCommandLine().getParentEnvironment()), true));
  table.getActionsPanel().setVisible(false);
  DialogBuilder builder = new DialogBuilder(parent);
  builder.setTitle(ExecutionBundle.message("environment.variables.system.dialog.title"));
  builder.centerPanel(table.getComponent());
  builder.addCloseButton();
  builder.show();
}
 
Example #27
Source File: ConsoleViewRunningState.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void sendUserInput(final String input) throws IOException {
  if (myUserInputWriter == null) {
    throw new IOException(ExecutionBundle.message("no.user.process.input.error.message"));
  }
  myUserInputWriter.write(input);
  myUserInputWriter.flush();
}
 
Example #28
Source File: RunDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void doOKAction(){
  try{
    myConfigurable.apply();
  }
  catch(ConfigurationException e){
    Messages.showMessageDialog(myProject, e.getMessage(), ExecutionBundle.message("invalid.data.dialog.title"), Messages.getErrorIcon());
    return;
  }
  super.doOKAction();
}
 
Example #29
Source File: RunDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(final ActionEvent event) {
  try{
    myConfigurable.apply();
  }
  catch(ConfigurationException e){
    Messages.showMessageDialog(myProject, e.getMessage(), ExecutionBundle.message("invalid.data.dialog.title"), Messages.getErrorIcon());
  }
}
 
Example #30
Source File: FakeRerunAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void update(@Nonnull AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  ExecutionEnvironment environment = getEnvironment(event);
  if (environment != null) {
    presentation.setText(ExecutionBundle.message("rerun.configuration.action.name", environment.getRunProfile().getName()));
    presentation.setIcon(ExecutionManagerImpl.isProcessRunning(getDescriptor(event)) ? AllIcons.Actions.Restart : environment.getExecutor().getIcon());
    presentation.setEnabled(isEnabled(event));
    return;
  }

  presentation.setEnabled(false);
}