Java Code Examples for com.intellij.openapi.actionSystem.Presentation#setIcon()
The following examples show how to use
com.intellij.openapi.actionSystem.Presentation#setIcon() .
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: LoginAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void update(@Nonnull AnActionEvent e) { if (!EarlyAccessProgramManager.is(ServiceAuthEarlyAccessProgramDescriptor.class)) { e.getPresentation().setEnabledAndVisible(false); return; } ServiceAuthConfiguration configuration = ServiceAuthConfiguration.getInstance(); Presentation presentation = e.getPresentation(); String email = configuration.getEmail(); if (email == null) { presentation.setText("Logged as anonymous"); presentation.setIcon(AllIcons.Actions.LoginAvator); } else { presentation.setText("Logged as '" + email + "'"); Image userIcon = configuration.getUserIcon(); presentation.setIcon(ObjectUtil.notNull(userIcon, AllIcons.Actions.LoginAvator)); } }
Example 2
Source File: ExportRunConfigurationDialog.java From intellij with Apache License 2.0 | 6 votes |
@Override public synchronized void actionPerformed(AnActionEvent anActionEvent) { boolean newState = !allSelected; for (int i = 0; i < tableModel.enabled.length; i++) { table.setValueAt(newState, i, 0); } allSelected = newState; Presentation presentation = anActionEvent.getPresentation(); if (allSelected) { presentation.setText("Deselect All"); presentation.setIcon(AllIcons.Actions.Unselectall); } else { presentation.setText("Select All"); presentation.setIcon(AllIcons.Actions.Selectall); } tableModel.fireTableDataChanged(); table.revalidate(); table.repaint(); }
Example 3
Source File: NewFileGroupAction.java From idea-gitignore with MIT License | 6 votes |
/** Builds a new instance of {@link NewFileGroupAction}. */ @SuppressWarnings("checkstyle:whitespacearound") public NewFileGroupAction() { setPopup(true); Presentation presentation = getTemplatePresentation(); presentation.setText(IgnoreBundle.message("action.newFile.group")); presentation.setIcon(Icons.IGNORE); for (final IgnoreLanguage language : IgnoreBundle.LANGUAGES) { final IgnoreFileType fileType = language.getFileType(); add(new NewFileAction(fileType) {{ Presentation p = getTemplatePresentation(); p.setText(IgnoreBundle.message("action.newFile", language.getFilename(), language.getID())); p.setDescription(IgnoreBundle.message("action.newFile.description", language.getID())); p.setIcon(fileType.getIcon()); }}); } }
Example 4
Source File: UpdateRoutesListAction.java From railways with MIT License | 5 votes |
private static void updatePresentation(@NotNull Project project, Presentation presentation) { RoutesManager rm = RoutesView.getInstance(project).getCurrentRoutesManager(); if (rm == null) return; if (rm.isUpdating()) { presentation.setIcon(RailwaysIcons.SUSPEND); presentation.setText("Cancel Route List Update"); presentation.setDescription("Stops updating the list of routes"); } else { presentation.setIcon(RailwaysIcons.UPDATE); presentation.setText("Update Route List"); presentation.setDescription("Update the list of routes"); } }
Example 5
Source File: NewFileAction.java From consulo with Apache License 2.0 | 5 votes |
protected void update(FileSystemTree fileSystemTree, AnActionEvent e) { Presentation presentation = e.getPresentation(); final FileType fileType = e.getData(FileChooserKeys.NEW_FILE_TYPE); if (fileType != null) { presentation.setVisible(true); VirtualFile selectedFile = fileSystemTree.getNewFileParent(); presentation.setEnabled(selectedFile != null && selectedFile.isDirectory()); presentation.setIcon(ImageEffects.layered(fileType.getIcon(), AllIcons.Actions.New)); } else { presentation.setVisible(false); } }
Example 6
Source File: FakeRerunAction.java From consulo with Apache License 2.0 | 5 votes |
@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); }
Example 7
Source File: RevertSelectedChangesAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void update(AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setIcon(AllIcons.Actions.Rollback); presentation.setText(VcsBundle.message("action.revert.selected.changes.text")); super.update(e); presentation.setEnabled(allSelectedChangeListsAreRevertable(e)); }
Example 8
Source File: CreateAction.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void updateIcon(final Presentation presentation, final ConfigurationContext context) { final RunnerAndConfigurationSettings configuration = context.findExisting(); if (configuration != null) { presentation.setIcon(configuration.getType().getIcon()); } else { super.updateIcon(presentation, context); } }
Example 9
Source File: CreateAction.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void updateIcon(final Presentation presentation, final ConfigurationContext context) { final RunnerAndConfigurationSettings configuration = context.findExisting(); if (configuration != null) { presentation.setIcon(configuration.getType().getIcon()); } else { super.updateIcon(presentation, context); } }
Example 10
Source File: IgnoreFileGroupAction.java From idea-gitignore with MIT License | 5 votes |
/** * Creates subactions bound to the specified Gitignore {@link VirtualFile}s using {@link IgnoreFileAction}. * * @param e action event * @return actions list */ @NotNull @Override public AnAction[] getChildren(@Nullable AnActionEvent e) { AnAction[] actions; int count = countFiles(); if (count == 0 || baseDir == null) { actions = new AnAction[0]; } else { actions = new AnAction[count]; final Project project = getEventProject(e); int i = 0; for (Map.Entry<IgnoreFileType, List<VirtualFile>> entry : files.entrySet()) { for (VirtualFile file : entry.getValue()) { IgnoreFileAction action = createAction(file); actions[i++] = action; VirtualFile directory = project == null ? null : Utils.getModuleRootForFile(file, project); String name = directory == null ? file.getName() : Utils.getRelativePath(directory, file); if (StringUtil.isNotEmpty(name)) { name = StringUtil.shortenPathWithEllipsis(name, FILENAME_MAX_LENGTH); } if (count == 1) { name = IgnoreBundle.message(presentationTextSingleKey, name); } Presentation presentation = action.getTemplatePresentation(); presentation.setIcon(entry.getKey().getIcon()); presentation.setText(name); } } } return actions; }
Example 11
Source File: NewBlazePackageAction.java From intellij with Apache License 2.0 | 5 votes |
@Override protected void updateForBlazeProject(Project project, AnActionEvent event) { Presentation presentation = event.getPresentation(); String buildSystem = Blaze.buildSystemName(project); presentation.setEnabledAndVisible(isEnabled(event)); presentation.setText(String.format("%s Package", buildSystem)); presentation.setDescription(String.format("Create a new %s package", buildSystem)); presentation.setIcon(PlatformIcons.PACKAGE_ICON); }
Example 12
Source File: GotoProjectDirectory.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void update(final FileSystemTree fileSystemTree, final AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setIcon(Application.get().getIcon()); final VirtualFile projectPath = getProjectDir(e); presentation.setEnabled(projectPath != null && fileSystemTree.isUnderRoots(projectPath)); }
Example 13
Source File: TreeActionWrapper.java From consulo with Apache License 2.0 | 5 votes |
@Override public void update(AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); ActionPresentation actionPresentation = myAction.getPresentation(); if (presentation.getClientProperty(MenuItemPresentationFactory.HIDE_ICON) == null) { presentation.setIcon(actionPresentation.getIcon()); } presentation.setText(actionPresentation.getText()); }
Example 14
Source File: CloseTabAction.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void update(AnActionEvent e) { Presentation presentation = e.getPresentation(); presentation.setEnabledAndVisible( myContent.isCloseable());//myManager.canCloseContents() && presentation.setText(myManager.getCloseActionName()); presentation.setIcon(AllIcons.Actions.Cancel); }
Example 15
Source File: ChooseTargetAction.java From Buck-IntelliJ-Plugin with Apache License 2.0 | 4 votes |
public ChooseTargetAction() { Presentation presentation = this.getTemplatePresentation(); presentation.setText(ACTION_TITLE); presentation.setDescription(ACTION_DESCRIPTION); presentation.setIcon(AllIcons.Actions.Preview); }
Example 16
Source File: ReplaceActionHelper.java From intellij with Apache License 2.0 | 4 votes |
private static void applyPresentation( Presentation presentation, Presentation templatePresentation) { presentation.restoreTextWithMnemonic(templatePresentation); presentation.setDescription(templatePresentation.getDescription()); presentation.setIcon(templatePresentation.getIcon()); }
Example 17
Source File: SymfonyProfilerWidgetActions.java From idea-php-symfony2-plugin with MIT License | 4 votes |
public UrlAction withIcon(Icon icon) { Presentation presentation = getTemplatePresentation(); presentation.setIcon(icon); return this; }
Example 18
Source File: CreateAction.java From consulo with Apache License 2.0 | 4 votes |
protected void updateIcon(final Presentation presentation, final ConfigurationContext context) { final List<ConfigurationFromContext> fromContext = context.getConfigurationsFromContext(); if (fromContext != null && fromContext.size() == 1) { //hide fuzzy icon when multiple run configurations are possible presentation.setIcon(fromContext.iterator().next().getConfiguration().getFactory().getIcon()); } }
Example 19
Source File: FlutterPopFrameAction.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
public FlutterPopFrameAction() { final Presentation presentation = getTemplatePresentation(); presentation.setText(FlutterBundle.message("flutter.pop.frame.action.text")); presentation.setDescription(FlutterBundle.message("flutter.pop.frame.action.description")); presentation.setIcon(AllIcons.Actions.PopFrame); }
Example 20
Source File: FlutterPopFrameAction.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
public FlutterPopFrameAction() { final Presentation presentation = getTemplatePresentation(); presentation.setText(FlutterBundle.message("flutter.pop.frame.action.text")); presentation.setDescription(FlutterBundle.message("flutter.pop.frame.action.description")); presentation.setIcon(AllIcons.Actions.PopFrame); }