當前位置: 首頁>>代碼示例>>Java>>正文


Java UIUtil.removeMnemonic方法代碼示例

本文整理匯總了Java中com.intellij.util.ui.UIUtil.removeMnemonic方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.removeMnemonic方法的具體用法?Java UIUtil.removeMnemonic怎麽用?Java UIUtil.removeMnemonic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.ui.UIUtil的用法示例。


在下文中一共展示了UIUtil.removeMnemonic方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: rollbackChanges

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public static void rollbackChanges(final Project project, final Collection<Change> changes, boolean refreshSynchronously,
                                   final Runnable afterVcsRefreshInAwt) {
  final ChangeListManagerEx manager = (ChangeListManagerEx) ChangeListManager.getInstance(project);

  if (changes.isEmpty()) {
    String operationName = UIUtil.removeMnemonic(RollbackUtil.getRollbackOperationName(project));
    Messages.showWarningDialog(project, VcsBundle.message("commit.dialog.no.changes.detected.text"),
                               VcsBundle.message("changes.action.rollback.nothing", operationName));
    return;
  }

  final ArrayList<Change> validChanges = new ArrayList<Change>();
  final Set<LocalChangeList> lists = new THashSet<LocalChangeList>();
  lists.addAll(manager.getInvolvedListsFilterChanges(changes, validChanges));

  new RollbackChangesDialog(project, ContainerUtil.newArrayList(lists), validChanges, refreshSynchronously, afterVcsRefreshInAwt).show();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:RollbackChangesDialog.java

示例2: addContextNode

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private static void addContextNode(MultiMap<TemplateContextType, TemplateContextType> hierarchy,
                                   CheckedTreeNode parent,
                                   TemplateContextType type, TemplateContext context) {
  final Collection<TemplateContextType> children = hierarchy.get(type);
  final String name = UIUtil.removeMnemonic(type.getPresentableName());
  final CheckedTreeNode node = new CheckedTreeNode(Pair.create(children.isEmpty() ? type : null, name));
  parent.add(node);

  if (children.isEmpty()) {
    node.setChecked(context.isExplicitlyEnabled(type));
  }
  else {
    for (TemplateContextType child : children) {
      addContextNode(hierarchy, node, child, context);
    }
    final CheckedTreeNode other = new CheckedTreeNode(Pair.create(type, "Other"));
    other.setChecked(context.isExplicitlyEnabled(type));
    node.add(other);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:LiveTemplateSettingsEditor.java

示例3: RollbackChangesDialog

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public RollbackChangesDialog(final Project project,
                             List<LocalChangeList> changeLists,
                             final List<Change> changes,
                             final boolean refreshSynchronously, final Runnable afterVcsRefreshInAwt) {
  super(project, true);

  myProject = project;
  myRefreshSynchronously = refreshSynchronously;
  myAfterVcsRefreshInAwt = afterVcsRefreshInAwt;
  myInvokedFromModalContext = LaterInvocator.isInModalContext();

  myInfoCalculator = new ChangeInfoCalculator();
  myCommitLegendPanel = new CommitLegendPanel(myInfoCalculator);
  myListChangeListener = new Runnable() {
    @Override
    public void run() {
      if (myBrowser != null) {
        myInfoCalculator.update(new ArrayList<Change>(myBrowser.getAllChanges()),
                                new ArrayList<Change>(myBrowser.getChangesIncludedInAllLists()));
        myCommitLegendPanel.update();

        Collection<Change> selected = myBrowser.getChangesIncludedInAllLists();
        List<Change> visibleSelected = myBrowser.getCurrentIncludedChanges();
        if (selected.size() != visibleSelected.size()) {
          setErrorText("Selection contains changes from other changelist");
        }
        else {
          setErrorText(null);
        }
      }
    }
  };
  myBrowser = new MultipleChangeListBrowser(project, changeLists, changes, getDisposable(), null, true, true, myListChangeListener, myListChangeListener);

  myOperationName = operationNameByChanges(project, changes);
  setOKButtonText(myOperationName);

  myOperationName = UIUtil.removeMnemonic(myOperationName);
  setTitle(VcsBundle.message("changes.action.rollback.custom.title", myOperationName));
  setCancelButtonText(CommonBundle.getCloseButtonText());
  myBrowser.setToggleActionTitle("&Include in " + myOperationName.toLowerCase());

  for (Change c : changes) {
    if (c.getType() == Change.Type.NEW) {
      myDeleteLocallyAddedFiles = new JCheckBox(VcsBundle.message("changes.checkbox.delete.locally.added.files"));
      myDeleteLocallyAddedFiles.setSelected(PropertiesComponent.getInstance().isTrueValue(DELETE_LOCALLY_ADDED_FILES_KEY));
      myDeleteLocallyAddedFiles.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          final boolean value = myDeleteLocallyAddedFiles.isSelected();
          PropertiesComponent.getInstance().setValue(DELETE_LOCALLY_ADDED_FILES_KEY, String.valueOf(value));
        }
      });
      break;
    }
  }

  init();
  myListChangeListener.run();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:61,代碼來源:RollbackChangesDialog.java

示例4: createShortContextPanel

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private JPanel createShortContextPanel(final boolean allowNoContexts) {
  JPanel panel = new JPanel(new BorderLayout());

  final JLabel ctxLabel = new JLabel();
  final JLabel change = new JLabel();
  change.setForeground(PlatformColors.BLUE);
  change.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  panel.add(ctxLabel, BorderLayout.CENTER);
  panel.add(change, BorderLayout.EAST);

  final Runnable updateLabel = new Runnable() {
    @Override
    public void run() {
      myExpandByCombo.setEnabled(isExpandableFromEditor());
      updateHighlighter();

      StringBuilder sb = new StringBuilder();
      String oldPrefix = "";
      for (TemplateContextType type : getApplicableContexts()) {
        final TemplateContextType base = type.getBaseContextType();
        String ownName = UIUtil.removeMnemonic(type.getPresentableName());
        String prefix = "";
        if (base != null && !(base instanceof EverywhereContextType)) {
          prefix = UIUtil.removeMnemonic(base.getPresentableName()) + ": ";
          ownName = StringUtil.decapitalize(ownName);
        }
        if (type instanceof EverywhereContextType) {
          ownName = "Other";
        }
        if (sb.length() > 0) {
          sb.append(oldPrefix.equals(prefix) ? ", " : "; ");
        }
        if (!oldPrefix.equals(prefix)) {
          sb.append(prefix);
          oldPrefix = prefix;
        }
        sb.append(ownName);
      }
      final boolean noContexts = sb.length() == 0;
      String contexts = (noContexts ? "No applicable contexts" + (allowNoContexts ? "" : " yet") : "Applicable in " + sb.toString()) + ".  ";
      ctxLabel.setText(StringUtil.first(contexts, 100, true));
      ctxLabel.setForeground(noContexts ? allowNoContexts ? JBColor.GRAY : JBColor.RED : UIUtil.getLabelForeground());
      change.setText(noContexts ? "Define" : "Change");
    }
  };

  new ClickListener() {
    @Override
    public boolean onClick(@NotNull MouseEvent e, int clickCount) {
      if (disposeContextPopup()) return false;

      final JPanel content = createPopupContextPanel(updateLabel, myContext);
      Dimension prefSize = content.getPreferredSize();
      if (myLastSize != null && (myLastSize.width > prefSize.width || myLastSize.height > prefSize.height)) {
        content.setPreferredSize(new Dimension(Math.max(prefSize.width, myLastSize.width), Math.max(prefSize.height, myLastSize.height)));
      }
      myContextPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null).setResizable(true).createPopup();
      myContextPopup.show(new RelativePoint(change, new Point(change.getWidth() , -content.getPreferredSize().height - 10)));
      myContextPopup.addListener(new JBPopupAdapter() {
        @Override
        public void onClosed(LightweightWindowEvent event) {
          myLastSize = content.getSize();
        }
      });
      return true;
    }
  }.installOn(change);

  updateLabel.run();

  return panel;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:73,代碼來源:LiveTemplateSettingsEditor.java

示例5: FilterExistentAction

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public FilterExistentAction() {
  super(RefactoringBundle.message("directory.chooser.hide.non.existent.checkBox.text"),
        UIUtil.removeMnemonic(RefactoringBundle.message("directory.chooser.hide.non.existent.checkBox.text")),
        AllIcons.General.Filter);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:DirectoryChooser.java

示例6: getActionName

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
@NotNull
protected String getActionName() {
  return UIUtil.removeMnemonic(GitBundle.getString("revert.action.name"));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:GitRevert.java


注:本文中的com.intellij.util.ui.UIUtil.removeMnemonic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。