Java Code Examples for com.intellij.idea.ActionsBundle#message()

The following examples show how to use com.intellij.idea.ActionsBundle#message() . 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: FlutterProjectCreator.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private VirtualFile getLocationFromModel(@Nullable Project projectToClose, boolean saveLocation) {
  final File location = new File(FileUtil.toSystemDependentName(myModel.projectLocation().get()));
  if (!location.exists() && !location.mkdirs()) {
    String message = ActionsBundle.message("action.NewDirectoryProject.cannot.create.dir", location.getAbsolutePath());
    Messages.showErrorDialog(projectToClose, message, ActionsBundle.message("action.NewDirectoryProject.title"));
    return null;
  }
  final File baseFile = new File(location, myModel.projectName().get());
  //noinspection ResultOfMethodCallIgnored
  baseFile.mkdirs();
  final VirtualFile baseDir = ApplicationManager.getApplication().runWriteAction(
    (Computable<VirtualFile>)() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(baseFile));
  if (baseDir == null) {
    FlutterUtils.warn(LOG, "Couldn't find '" + location + "' in VFS");
    return null;
  }
  if (saveLocation) {
    RecentProjectsManager.getInstance().setLastProjectCreationLocation(location.getPath());
  }
  return baseDir;
}
 
Example 2
Source File: FlutterProjectCreator.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private VirtualFile getLocationFromModel(@Nullable Project projectToClose, boolean saveLocation) {
  final File location = new File(FileUtil.toSystemDependentName(myModel.projectLocation().get()));
  if (!location.exists() && !location.mkdirs()) {
    String message = ActionsBundle.message("action.NewDirectoryProject.cannot.create.dir", location.getAbsolutePath());
    Messages.showErrorDialog(projectToClose, message, ActionsBundle.message("action.NewDirectoryProject.title"));
    return null;
  }
  final File baseFile = new File(location, myModel.projectName().get());
  //noinspection ResultOfMethodCallIgnored
  baseFile.mkdirs();
  final VirtualFile baseDir = ApplicationManager.getApplication().runWriteAction(
    (Computable<VirtualFile>)() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(baseFile));
  if (baseDir == null) {
    FlutterUtils.warn(LOG, "Couldn't find '" + location + "' in VFS");
    return null;
  }
  if (saveLocation) {
    RecentProjectsManager.getInstance().setLastProjectCreationLocation(location.getPath());
  }
  return baseDir;
}
 
Example 3
Source File: UndoManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private Pair<String, String> getUndoOrRedoActionNameAndDescription(FileEditor editor, boolean undo) {
  String desc = isUndoOrRedoAvailable(editor, undo) ? doFormatAvailableUndoRedoAction(editor, undo) : null;
  if (desc == null) desc = "";
  String shortActionName = StringUtil.first(desc, 30, true);

  if (desc.isEmpty()) {
    desc = undo
           ? ActionsBundle.message("action.undo.description.empty")
           : ActionsBundle.message("action.redo.description.empty");
  }

  return Pair.create((undo ? ActionsBundle.message("action.undo.text", shortActionName)
                           : ActionsBundle.message("action.redo.text", shortActionName)).trim(),
                     (undo ? ActionsBundle.message("action.undo.description", desc)
                           : ActionsBundle.message("action.redo.description", desc)).trim());
}
 
Example 4
Source File: ToggleReadOnlyAttributePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public String getTooltipText() {
  VirtualFile virtualFile = getCurrentFile();
  int writable = virtualFile == null || virtualFile.isWritable() ? 1 : 0;
  int readonly = writable == 1 ? 0 : 1;
  return ActionsBundle.message("action.ToggleReadOnlyAttribute.files", readonly, writable, 1, 0);
}
 
Example 5
Source File: ScrollToTheEndToolbarAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ScrollToTheEndToolbarAction(@Nonnull final Editor editor) {
  super();
  myEditor = editor;
  final String message = ActionsBundle.message("action.EditorConsoleScrollToTheEnd.text");
  getTemplatePresentation().setDescription(message);
  getTemplatePresentation().setText(message);
  getTemplatePresentation().setIcon(AllIcons.RunConfigurations.Scroll_down);
}
 
Example 6
Source File: MoveChangesToAnotherListAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@javax.annotation.Nullable
private static LocalChangeList askTargetList(@Nonnull Project project, @Nonnull Collection<Change> changes) {
  ChangeListManagerImpl listManager = ChangeListManagerImpl.getInstanceImpl(project);
  List<LocalChangeList> preferredLists = getPreferredLists(listManager.getChangeListsCopy(), changes);
  List<LocalChangeList> listsForChooser =
          preferredLists.isEmpty() ? Collections.singletonList(listManager.getDefaultChangeList()) : preferredLists;
  ChangeListChooser chooser = new ChangeListChooser(project, listsForChooser, guessPreferredList(preferredLists),
                                                    ActionsBundle.message("action.ChangesView.Move.text"), null);
  chooser.show();

  return chooser.getSelectedList();
}
 
Example 7
Source File: ShowDiffFromAnnotation.java    From consulo with Apache License 2.0 5 votes vote down vote up
ShowDiffFromAnnotation(final FileAnnotation fileAnnotation, final AbstractVcs vcs, final VirtualFile file) {
  super(ActionsBundle.message("action.Diff.UpdatedFiles.text"),
        ActionsBundle.message("action.Diff.UpdatedFiles.description"),
        AllIcons.Actions.Diff);
  myFileAnnotation = fileAnnotation;
  myVcs = vcs;
  myFile = file;
  currentLine = -1;
  myEnabled = ProjectLevelVcsManager.getInstance(vcs.getProject()).getVcsFor(myFile) != null;
}
 
Example 8
Source File: MarkObjectAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void update(AnActionEvent event) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  boolean enabled = false;
  Presentation presentation = event.getPresentation();
  boolean hidden = true;
  if (project != null) {
    for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
      MarkObjectActionHandler handler = support.getMarkObjectHandler();
      hidden &= handler.isHidden(project, event);
      if (handler.isEnabled(project, event)) {
        enabled = true;
        String text;
        if (handler.isMarked(project, event)) {
          text = ActionsBundle.message("action.Debugger.MarkObject.unmark.text");
        }
        else {
          text = ActionsBundle.message("action.Debugger.MarkObject.text");
        }
        presentation.setText(text);
        break;
      }
    }
  }
  presentation.setVisible(!hidden && (!ActionPlaces.isPopupPlace(event.getPlace()) || enabled));
  presentation.setEnabled(enabled);
}
 
Example 9
Source File: TextFieldAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected String getStatusBarText() {
  return ActionsBundle.message("action.FileChooser.TogglePathShowing.text");
}
 
Example 10
Source File: UnmarkRootAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public UnmarkRootAction() {
  super(ActionsBundle.message("action.UnmarkRoot.text"), null, AllIcons.Actions.Delete, null);
}
 
Example 11
Source File: ContentEntryTreeEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
private MyNewFolderAction() {
  super(ActionsBundle.message("action.FileChooser.NewFolder.text"), ActionsBundle.message("action.FileChooser.NewFolder.description"), AllIcons.Actions.NewFolder);
}
 
Example 12
Source File: RemoveChangeListAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
private static String getDescription(@javax.annotation.Nullable ChangeList[] changeLists) {
  return ActionsBundle.message("action.ChangesView.RemoveChangeList.description",
                               containsActiveChangelist(changeLists) ? "another changelist" : "active one");
}
 
Example 13
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void attachToSession(@Nonnull XDebugSessionImpl session) {
  for (XDebugView view : myViews.values()) {
    attachViewToSession(session, view);
  }

  XDebugTabLayouter layouter = session.getDebugProcess().createTabLayouter();
  Content consoleContent = layouter.registerConsoleContent(myUi, myConsole);
  attachNotificationTo(consoleContent);

  layouter.registerAdditionalContent(myUi);
  RunContentBuilder.addAdditionalConsoleEditorActions(myConsole, consoleContent);

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    return;
  }

  DefaultActionGroup leftToolbar = new DefaultActionGroup();
  final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
  if (myEnvironment != null) {
    leftToolbar.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN));
    List<AnAction> additionalRestartActions = session.getRestartActions();
    if (!additionalRestartActions.isEmpty()) {
      leftToolbar.addAll(additionalRestartActions);
      leftToolbar.addSeparator();
    }
    leftToolbar.addAll(session.getExtraActions());
  }
  leftToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP));

  for (AnAction action : session.getExtraStopActions()) {
    leftToolbar.add(action, new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));
  }

  //group.addSeparator();
  //addAction(group, DebuggerActions.EXPORT_THREADS);
  leftToolbar.addSeparator();

  leftToolbar.add(myUi.getOptions().getLayoutActions());
  final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
  DefaultActionGroup settings = new DefaultActionGroup(ActionsBundle.message("group.XDebugger.settings.text"), true);
  settings.getTemplatePresentation().setIcon(myUi.getOptions().getSettingsActions().getTemplatePresentation().getIcon());
  settings.addAll(commonSettings);
  leftToolbar.add(settings);

  leftToolbar.addSeparator();

  leftToolbar.add(PinToolwindowTabAction.getPinAction());

  DefaultActionGroup topToolbar = new DefaultActionGroup();
  topToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP));

  session.getDebugProcess().registerAdditionalActions(leftToolbar, topToolbar, settings);
  myUi.getOptions().setLeftToolbar(leftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
  myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR);

  if (myEnvironment != null) {
    initLogConsoles(myEnvironment.getRunProfile(), myRunContentDescriptor, myConsole);
  }
}
 
Example 14
Source File: ImportOptimizer.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @return action description, it will be displayed for user, default 'Remove unused imports and reorder/reorganize imports.'
 */
@Nonnull
default String getActionDescription() {
  return ActionsBundle.message("not.action.OptimizeImports.description");
}
 
Example 15
Source File: ImportOptimizer.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @return action text, it will be displayed for user, default 'Optimize Imports...'
 */
@Nonnull
default String getActionName() {
  return ActionsBundle.message("not.action.OptimizeImports.text");
}
 
Example 16
Source File: MaximizeToolWindowAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public MaximizeToolWindowAction() {
  super(ActionsBundle.message("action.ResizeToolWindowMaximize.text"));
}
 
Example 17
Source File: ShowProcessWindowAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ShowProcessWindowAction() {
  super(ActionsBundle.message("action.ShowProcessWindow.text"), ActionsBundle.message("action.ShowProcessWindow.description"), null);
}
 
Example 18
Source File: AbstractRerunFailedTestsAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public MyRunProfile(RunConfigurationBase configuration) {
  super(configuration.getProject(), configuration.getFactory(), ActionsBundle.message("action.RerunFailedTests.text"));
  myConfiguration = configuration;
}
 
Example 19
Source File: ScrollToEndAction.java    From buck with Apache License 2.0 4 votes vote down vote up
public ScrollToEndAction() {
  final String message = ActionsBundle.message("action.EditorConsoleScrollToTheEnd.text");
  getTemplatePresentation().setDescription(message);
  getTemplatePresentation().setText(message);
  getTemplatePresentation().setIcon(AllIcons.RunConfigurations.Scroll_down);
}