示例#1
0
 private static Presentation wrapIcon(Presentation presentation) {
   Icon original = presentation.getIcon();
   CenteredIcon centered =
       new CenteredIcon(original != null ? original : DEFAULT_ICON, 40, 40, false);
   presentation.setIcon(centered);
   return presentation;
 }
 private static void setConfigurationIcon(
     final Presentation presentation,
     final RunnerAndConfigurationSettings settings,
     final Project project) {
   try {
     presentation.setIcon(RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings));
   } catch (IndexNotReadyException ignored) {
   }
 }
 @Override
 public void update(final AnActionEvent e) {
   super.update(e);
   final Presentation presentation = e.getPresentation();
   presentation.setIcon(SvnIcons.ShowIntegratedFrom);
   presentation.setText(SvnBundle.message("committed.changes.action.enable.merge.highlighting"));
   presentation.setDescription(
       SvnBundle.message("committed.changes.action.enable.merge.highlighting.description.text"));
 }
  @Override
  public void update(final AnActionEvent event) {
    final Presentation presentation = event.getPresentation();
    String name = myEnvironment.getRunProfile().getName();
    ProcessHandler processHandler = myDescriptor.getProcessHandler();
    final boolean isRunning = processHandler != null && !processHandler.isProcessTerminated();

    presentation.setText(ExecutionBundle.message("rerun.configuration.action.name", name));
    presentation.setIcon(isRunning ? AllIcons.Actions.Restart : myExecutor.getIcon());
    presentation.setEnabled(isEnabled());
  }
    protected AbstractAddGroup(String text, Icon icon) {
      super(text, true);

      final Presentation presentation = getTemplatePresentation();
      presentation.setIcon(icon);

      final Keymap active = KeymapManager.getInstance().getActiveKeymap();
      if (active != null) {
        final Shortcut[] shortcuts = active.getShortcuts("NewElement");
        setShortcutSet(new CustomShortcutSet(shortcuts));
      }
    }
    public SelectTargetAction(
        final Project project, final ExecutionTarget target, boolean selected) {
      myProject = project;
      myTarget = target;

      String name = target.getDisplayName();
      Presentation presentation = getTemplatePresentation();
      presentation.setText(name, false);
      presentation.setDescription("Select " + name);

      presentation.setIcon(selected ? CHECKED_ICON : EMPTY_ICON);
      presentation.setSelectedIcon(selected ? CHECKED_SELECTED_ICON : EMPTY_ICON);
    }
    @Override
    public void dragOutStarted(MouseEvent mouseEvent, TabInfo info) {
      final TabInfo previousSelection = info.getPreviousSelection();
      final Image img = myTabs.getComponentImage(info);
      info.setHidden(true);
      if (previousSelection != null) {
        myTabs.select(previousSelection, true);
      }

      myFile = (VirtualFile) info.getObject();
      Presentation presentation = new Presentation(info.getText());
      presentation.setIcon(info.getIcon());
      mySession =
          getDockManager()
              .createDragSession(
                  mouseEvent, new DockableEditor(img, myFile, presentation, myWindow));
    }
 private static void updatePresentation(
     @Nullable ExecutionTarget target,
     @Nullable RunnerAndConfigurationSettings settings,
     @Nullable Project project,
     @NotNull Presentation presentation) {
   if (project != null && target != null && settings != null) {
     String name = settings.getName();
     if (target != DefaultExecutionTarget.INSTANCE) {
       name += " | " + target.getDisplayName();
     } else {
       if (!settings.canRunOn(target)) {
         name += " | Nothing to run on";
       }
     }
     presentation.setText(name, false);
     setConfigurationIcon(presentation, settings, project);
   } else {
     presentation.setText(""); // IDEA-21657
     presentation.setIcon(null);
   }
 }
示例#9
0
  private void createCardForGroup(ActionGroup group, String cardId, final String parentId) {
    JPanel card = new JPanel(new BorderLayout());
    if (!USE_ICONS) {
      card.setOpaque(false);
    }

    JPanel withBottomFiller = new JPanel(new BorderLayout());
    if (!USE_ICONS) {
      withBottomFiller.setOpaque(true);
      withBottomFiller.setBackground(Color.white);
    }
    withBottomFiller.add(card, BorderLayout.NORTH);
    myContent.add(withBottomFiller, cardId);

    List<Button> buttons = buildButtons(group, cardId);
    if (parentId != null) {
      AnAction back =
          new AnAction(null, null, null) {
            @Override
            public void actionPerformed(AnActionEvent e) {
              myLayout.swipe(myContent, parentId, JBCardLayout.SwipeDirection.BACKWARD);
            }
          };

      Presentation p = new Presentation("Back");
      p.setIcon(AllIcons.Actions.Back);
      buttons.add(0, new Button(back, p));
    }

    JPanel buttonsPanel = new JPanel(new GridLayout(buttons.size(), 1, 5, 5));
    if (!USE_ICONS) {
      buttonsPanel.setOpaque(false);
    }
    buttonsPanel.setBorder(new EmptyBorder(15, 15, 15, 15));
    for (Button button : buttons) {
      buttonsPanel.add(button);
    }
    card.add(buttonsPanel, BorderLayout.CENTER);
  }
示例#10
0
  private List<Button> buildButtons(ActionGroup group, String parentId) {
    AnAction[] actions = group.getChildren(null);

    List<Button> buttons = new ArrayList<Button>();

    for (AnAction action : actions) {
      Presentation presentation = action.getTemplatePresentation();
      if (!USE_ICONS) {
        presentation.setIcon(null);
      }
      if (action instanceof ActionGroup) {
        ActionGroup childGroup = (ActionGroup) action;
        if (childGroup.isPopup()) {
          final String id = String.valueOf(++nCards);
          createCardForGroup(childGroup, id, parentId);

          buttons.add(new Button(new ActivateCard(id), presentation));
        } else {
          buttons.addAll(buildButtons(childGroup, parentId));
        }
      } else {
        action.update(
            new AnActionEvent(
                null,
                DataManager.getInstance().getDataContext(this),
                ActionPlaces.WELCOME_SCREEN,
                presentation,
                ActionManager.getInstance(),
                0));
        if (presentation.isVisible()) {
          buttons.add(new Button(action, presentation));
        }
      }
    }
    return buttons;
  }
 public SaveTemporaryAction() {
   Presentation presentation = getTemplatePresentation();
   presentation.setIcon(AllIcons.Actions.Menu_saveall);
 }