本文整理汇总了Java中com.intellij.openapi.actionSystem.impl.PresentationFactory类的典型用法代码示例。如果您正苦于以下问题:Java PresentationFactory类的具体用法?Java PresentationFactory怎么用?Java PresentationFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PresentationFactory类属于com.intellij.openapi.actionSystem.impl包,在下文中一共展示了PresentationFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendActionsFromGroup
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void appendActionsFromGroup(final ActionGroup group) {
final AnAction[] actions = group.getChildren(null);
PresentationFactory factory = new PresentationFactory();
for (final AnAction action : actions) {
if (action instanceof ActionGroup) {
final ActionGroup childGroup = (ActionGroup)action;
appendActionsFromGroup(childGroup);
}
else {
Presentation presentation = factory.getPresentation(action);
action.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(myMainPanel),
ActionPlaces.WELCOME_SCREEN, presentation, ActionManager.getInstance(), 0));
if (presentation.isVisible()) {
appendButtonForAction(action);
}
}
}
}
示例2: fillActions
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void fillActions(JPanel root, final ActionGroup group, boolean quickStart) {
final AnAction[] actions = group.getChildren(null);
PresentationFactory factory = new PresentationFactory();
for (final AnAction action : actions) {
if (action instanceof ActionGroup) {
final ActionGroup childGroup = (ActionGroup)action;
fillActions(root, childGroup, quickStart);
}
else {
Presentation presentation = factory.getPresentation(action);
action.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(root),
ActionPlaces.WELCOME_SCREEN, presentation, ActionManager.getInstance(), 0));
if (presentation.isVisible()) {
if (quickStart) {
myQuickStartButtons.add(new DarculaQuickStartButton(action));
} else {
myHelpButtons.add(new DarculaHelpButton(action));
}
}
}
}
}
示例3: buildComponents
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private List<JComponent> buildComponents(ActionGroup group, String parentId) {
AnAction[] actions = group.getChildren(null);
List<JComponent> components = new ArrayList<JComponent>();
PresentationFactory factory = new PresentationFactory();
for (AnAction action : actions) {
Presentation presentation = action.getTemplatePresentation().clone();
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);
components.add(new Button(new ActivateCard(id), presentation));
}
else {
components.addAll(buildComponents(childGroup, parentId));
}
}
else if (action instanceof AbstractActionWithPanel){
final JPanel panel = ((AbstractActionWithPanel)action).createPanel();
components.add(panel);
}
else {
action.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(this),
ActionPlaces.WELCOME_SCREEN, presentation, ActionManager.getInstance(), 0));
if (presentation.isVisible()) {
components.add(new Button(action, presentation));
}
}
}
return components;
}
示例4: createButton
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
@NotNull
private static ActionButton createButton(@NotNull final AnAction action) {
PresentationFactory presentationFactory = new PresentationFactory();
Icon icon = AllIcons.Actions.AllLeft;
Dimension size = new Dimension(icon.getIconWidth(), icon.getIconHeight());
return new ActionButton(action, presentationFactory.getPresentation(action), MOVE_PANEL_PLACE, size);
}
示例5: tryToOpenFileSearch
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void tryToOpenFileSearch(final InputEvent e, final String fileName) {
AnAction gotoFile = ActionManager.getInstance().getAction("GotoFile");
if (gotoFile != null && !StringUtil.isEmpty(fileName)) {
myPopup.cancel();
final AnAction action = gotoFile;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
DataManager.getInstance().getDataContextFromFocus().doWhenDone(new Consumer<DataContext>() {
@Override
public void consume(@NotNull final DataContext context) {
final DataContext dataContext = new DataContext() {
@Nullable
@Override
public Object getData(@NonNls String dataId) {
if (PlatformDataKeys.PREDEFINED_TEXT.is(dataId)) {
return fileName;
}
return context.getData(dataId);
}
};
final AnActionEvent event =
new AnActionEvent(e, dataContext, ActionPlaces.EDITOR_POPUP, new PresentationFactory().getPresentation(action),
ActionManager.getInstance(), 0);
action.actionPerformed(event);
}
});
}
});
}
}
示例6: registerShortcuts
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void registerShortcuts(@NotNull ActionGroup opActionGroup, @NotNull DataContext dataContext) {
List<AnAction> opActions = new ArrayList<AnAction>();
Utils.expandActionGroup(opActionGroup, opActions, new PresentationFactory(), dataContext, "", ActionManager.getInstance());
for (AnAction action : opActions) {
action.registerCustomShortcutSet(action.getShortcutSet(), myView);
}
// special shortcut for deleting a file
AnAction deleteAction = ActionManager.getInstance().getAction("ChangesView.DeleteUnversioned.From.Dialog");
deleteAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), myView);
}
示例7: QuickDocInfoPane
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
QuickDocInfoPane(@NotNull PsiElement documentationAnchor,
@NotNull PsiElement elementUnderMouse,
@NotNull JComponent baseDocControl) {
myBaseDocControl = baseDocControl;
PresentationFactory presentationFactory = new PresentationFactory();
for (AbstractDocumentationTooltipAction action : ourTooltipActions) {
Icon icon = action.getTemplatePresentation().getIcon();
Dimension minSize = new Dimension(icon.getIconWidth(), icon.getIconHeight());
myButtons.add(new ActionButton(action, presentationFactory.getPresentation(action), IdeTooltipManager.IDE_TOOLTIP_PLACE, minSize));
action.setDocInfo(documentationAnchor, elementUnderMouse);
}
Collections.reverse(myButtons);
setPreferredSize(baseDocControl.getPreferredSize());
setMaximumSize(baseDocControl.getMaximumSize());
setMinimumSize(baseDocControl.getMinimumSize());
setBackground(baseDocControl.getBackground());
add(baseDocControl, Integer.valueOf(0));
int minWidth = 0;
int minHeight = 0;
int buttonWidth = 0;
for (JComponent button : myButtons) {
button.setBorder(null);
button.setBackground(baseDocControl.getBackground());
add(button, Integer.valueOf(1));
button.setVisible(false);
Dimension preferredSize = button.getPreferredSize();
minWidth += preferredSize.width;
minHeight = Math.max(minHeight, preferredSize.height);
buttonWidth = Math.max(buttonWidth, preferredSize.width);
}
myButtonWidth = buttonWidth;
int margin = 2;
myMinWidth = minWidth + margin * 2 + (myButtons.size() - 1) * BUTTON_HGAP;
myMinHeight = minHeight + margin * 2;
}
示例8: createUIComponents
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void createUIComponents() {
myCloudProjectIdLabel = new CloudProjectIdLabel(MATRIX);
AnAction action = new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
if (myCloudConfigurationProvider == null) {
return;
}
String selectedProjectId =
myCloudConfigurationProvider.openCloudProjectConfigurationDialog(myProject, myCloudProjectIdLabel.getText());
if (selectedProjectId != null) {
myCloudProjectIdLabel.updateCloudProjectId(selectedProjectId);
updateOkButton();
}
}
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
presentation.setIcon(AllIcons.General.Settings);
}
};
myCloudProjectIdUpdateButton =
new ActionButton(action, new PresentationFactory().getPresentation(action), "MyPlace", new Dimension(25, 25));
myCloudConfigurationCombo = new CloudConfigurationComboBox(MATRIX);
Disposer.register(myDisposable, myCloudConfigurationCombo);
}
示例9: createUIComponents
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void createUIComponents() {
myAvdCombo = new AvdComboBox(myProject, true, false) {
@Override
public Module getModule() {
return getModuleSelector().getModule();
}
};
myAvdCombo.getComboBox().setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof IdDisplay) {
setText(((IdDisplay)value).getDisplay());
}
else {
setText(String.format("<html><font color='red'>Unknown AVD %1$s</font></html>", value == null ? "" : value.toString()));
}
}
});
myAvdComboComponent = new ComboboxWithBrowseButton(myAvdCombo.getComboBox());
myCloudMatrixProjectIdLabel = new CloudProjectIdLabel(MATRIX);
myCloudMatrixConfigurationCombo = new CloudConfigurationComboBox(MATRIX);
AnAction cloudMatrixProjectAction = new SelectCloudProjectAction(myCloudMatrixProjectIdLabel, myCloudMatrixConfigurationCombo);
myCloudMatrixProjectIdUpdateButton = new ActionButton(
cloudMatrixProjectAction, new PresentationFactory().getPresentation(cloudMatrixProjectAction), "MyPlace", new Dimension(25, 25));
Disposer.register(this, myCloudMatrixConfigurationCombo);
myCloudDeviceProjectIdLabel = new CloudProjectIdLabel(SINGLE_DEVICE);
myCloudDeviceConfigurationCombo = new CloudConfigurationComboBox(SINGLE_DEVICE);
AnAction cloudDeviceProjectAction = new SelectCloudProjectAction(myCloudDeviceProjectIdLabel, myCloudDeviceConfigurationCombo);
myCloudDeviceProjectIdUpdateButton = new ActionButton(
cloudDeviceProjectAction, new PresentationFactory().getPresentation(cloudDeviceProjectAction), "MyPlace", new Dimension(25, 25));
Disposer.register(this, myCloudDeviceConfigurationCombo);
}
示例10: createUIComponents
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void createUIComponents() {
myCloudProjectIdLabel = new CloudProjectIdLabel(SINGLE_DEVICE);
AnAction action = new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
if (myCloudConfigurationProvider == null) {
return;
}
String selectedProjectId =
myCloudConfigurationProvider.openCloudProjectConfigurationDialog(myProject, myCloudProjectIdLabel.getText());
if (selectedProjectId != null) {
myCloudProjectIdLabel.updateCloudProjectId(selectedProjectId);
updateOkButton();
}
}
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
presentation.setIcon(AllIcons.General.Settings);
}
};
myCloudProjectIdUpdateButton =
new ActionButton(action, new PresentationFactory().getPresentation(action), "MyPlace", new Dimension(25, 25));
myCloudConfigurationCombo = new CloudConfigurationComboBox(SINGLE_DEVICE);
Disposer.register(myDisposable, myCloudConfigurationCombo);
}
示例11: buildButtons
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private List<Button> buildButtons(ActionGroup group, String parentId) {
AnAction[] actions = group.getChildren(null);
List<Button> buttons = new ArrayList<Button>();
PresentationFactory factory = new PresentationFactory();
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;
}
示例12: registerShortcuts
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void registerShortcuts(@NotNull ActionGroup opActionGroup, @NotNull DataContext dataContext) {
List<AnAction> opActions = new ArrayList<AnAction>();
Utils.expandActionGroup(opActionGroup, opActions, new PresentationFactory(), dataContext, "", ActionManager.getInstance());
for (AnAction action : opActions) {
action.registerCustomShortcutSet(action.getShortcutSet(), myView);
}
// special shortcut for deleting a file
AnAction deleteAction = ActionManager.getInstance().getAction("ChangesView.DeleteUnversioned.From.Dialog");
deleteAction.registerCustomShortcutSet(CommonShortcuts.DELETE, myView);
}
示例13: createButton
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
@Nonnull
private static ActionButton createButton(@Nonnull final AnAction action) {
PresentationFactory presentationFactory = new PresentationFactory();
Icon icon = AllIcons.Actions.AllLeft;
Dimension size = new Dimension(icon.getIconWidth(), icon.getIconHeight());
return new ActionButton(action, presentationFactory.getPresentation(action), MOVE_PANEL_PLACE, size);
}
示例14: tryToOpenFileSearch
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
private void tryToOpenFileSearch(final InputEvent e, final String fileName) {
AnAction gotoFile = ActionManager.getInstance().getAction("GotoFile");
if (gotoFile != null && !StringUtil.isEmpty(fileName)) {
myPopup.cancel();
final AnAction action = gotoFile;
SwingUtilities.invokeLater(() -> DataManager.getInstance().getDataContextFromFocus().doWhenDone(new Consumer<DataContext>() {
@Override
public void consume(@Nonnull final DataContext context) {
final DataContext dataContext = new DataContext() {
@Nullable
@Override
@SuppressWarnings("unchecked")
public <T> T getData(@Nonnull Key<T> dataId) {
if (PlatformDataKeys.PREDEFINED_TEXT == dataId) {
return (T)fileName;
}
return context.getData(dataId);
}
};
final AnActionEvent event =
new AnActionEvent(e, dataContext, ActionPlaces.EDITOR_POPUP, new PresentationFactory().getPresentation(action),
ActionManager.getInstance(), 0);
action.actionPerformed(event);
}
}));
}
}
示例15: registerUnversionedActionsShortcuts
import com.intellij.openapi.actionSystem.impl.PresentationFactory; //导入依赖的package包/类
@Nonnull
public static List<AnAction> registerUnversionedActionsShortcuts(@Nonnull DataContext dataContext, @Nonnull JComponent component) {
ActionManager manager = ActionManager.getInstance();
List<AnAction> actions = ContainerUtil.newArrayList();
Utils.expandActionGroup(LaterInvocator.isInModalContext(), getUnversionedActionGroup(), actions, new PresentationFactory(), dataContext, "", manager);
for (AnAction action : actions) {
action.registerCustomShortcutSet(action.getShortcutSet(), component);
}
return actions;
}