本文整理汇总了Java中com.intellij.openapi.actionSystem.Presentation.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java Presentation.setIcon方法的具体用法?Java Presentation.setIcon怎么用?Java Presentation.setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.actionSystem.Presentation
的用法示例。
在下文中一共展示了Presentation.setIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event)
{
super.update(event);
if (event.getProject() == null) {
event.getPresentation().setEnabled(false);
return;
}
RemoteHost remoteHost = this.container().preferences(event.getProject()).getRemoteHost();
Presentation presentation = event.getPresentation();
presentation.setText(this.displayName(remoteHost));
presentation.setIcon(remoteHost.icon());
presentation.setEnabledAndVisible(this.shouldActionBeEnabled(event));
}
示例2: SwitchVersionAction
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
* Creates the action with its text, description and icon.
*
* @param tree LivingDoc repository tree.
* @param toWorkingVersion true for current/working version. False otherwise.
*/
public SwitchVersionAction(final SimpleTree tree, final boolean toWorkingVersion) {
super();
this.repositoryTree = tree;
this.toCurrentVersion = toWorkingVersion;
String text;
Icon icon;
if (toCurrentVersion) {
text = I18nSupport.getValue("toolwindows.action.working.tooltip");
icon = AllIcons.Actions.NewFolder;
} else {
text = I18nSupport.getValue("toolwindows.action.implemented.tooltip");
icon = AllIcons.Actions.Module;
}
Presentation presentation = getTemplatePresentation();
presentation.setText(text);
presentation.setDescription(text);
presentation.setIcon(icon);
}
示例3: actionPerformed
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@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();
}
示例4: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(final AnActionEvent e) {
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
final Presentation presentation = e.getPresentation();
if (project == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
presentation.setText(SvnBundle.message("configure.branches.item"));
presentation.setDescription(SvnBundle.message("configure.branches.item"));
presentation.setIcon(SvnIcons.ConfigureBranches);
presentation.setVisible(true);
final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
presentation.setEnabled((cls != null) && (cls.length > 0) &&
(SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) &&
(((SvnChangeList) cls[0]).getRoot() != null));
}
示例5: getPresentation
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@NotNull
public final Presentation getPresentation(@NotNull AnAction action){
Presentation presentation = myAction2Presentation.get(action);
if (presentation == null || !action.isDefaultIcon()){
Presentation templatePresentation = action.getTemplatePresentation();
if (presentation == null) {
presentation = templatePresentation.clone();
myAction2Presentation.put(action, presentation);
}
if (!action.isDefaultIcon()) {
presentation.setIcon(templatePresentation.getIcon());
presentation.setDisabledIcon(templatePresentation.getDisabledIcon());
}
processPresentation(presentation);
}
return presentation;
}
示例6: updatePresentation
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
private void updatePresentation(Presentation presentation) {
Configuration configuration = myRenderContext.getConfiguration();
boolean visible = configuration != null;
if (visible) {
// TEMPORARY WORKAROUND:
// We don't properly sync the project locale to layouts yet, so in the mean time
// show the actual locale being used rather than the intended locale, so as not
// to be totally confusing:
//Locale locale = configuration.isLocaleSpecificLayout()
// ? configuration.getLocale() : configuration.getConfigurationManager().getLocale();
Locale locale = configuration.getLocale();
if (locale == Locale.ANY) {
presentation.setIcon(AndroidIcons.Globe);
} else {
presentation.setIcon(locale.getFlagImage());
}
String brief = getLocaleLabel(locale, true);
presentation.setText(brief);
} else {
presentation.setIcon(AndroidIcons.Globe);
}
if (visible != presentation.isVisible()) {
presentation.setVisible(visible);
}
}
示例7: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
OpenInBrowserRequest result = BaseOpenInBrowserAction.doUpdate(e);
if (result == null) {
return;
}
String description = getTemplatePresentation().getDescription();
if (HtmlUtil.isHtmlFile(result.getFile())) {
description += " (hold Shift to open URL of local file)";
}
presentation.setText(getTemplatePresentation().getText());
presentation.setDescription(description);
WebBrowser browser = findUsingBrowser();
if (browser != null) {
presentation.setIcon(browser.getIcon());
}
if (ActionPlaces.isPopupPlace(e.getPlace())) {
presentation.setVisible(presentation.isEnabled());
}
}
示例8: PreviewAction
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public PreviewAction(@NotNull RenderContext renderContext, @NotNull String title, int action,
@Nullable RenderPreviewMode mode, boolean enabled) {
super(title, null, null);
myRenderContext = renderContext;
myAction = action;
myMode = mode;
if (mode != null && mode == RenderPreviewMode.getCurrent()) {
// Select
Presentation templatePresentation = getTemplatePresentation();
templatePresentation.setIcon(AllIcons.Actions.Checked);
templatePresentation.setEnabled(false);
}
if (!enabled) {
getTemplatePresentation().setEnabled(false);
}
}
示例9: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(final AnActionEvent e) {
final Presentation presentation = e.getPresentation();
CaptionSelection selection = CaptionSelection.DATA_KEY.getData(e.getDataContext());
if (selection == null) {
presentation.setEnabled(false);
}
else {
presentation.setEnabled(selection.getContainer() != null && selection.getFocusedIndex() >= 0);
if (!selection.isRow()) {
presentation.setText(myColumnText);
if (myColumnIcon != null) {
presentation.setIcon(myColumnIcon);
}
}
else {
presentation.setText(myRowText);
if (myRowIcon != null) {
presentation.setIcon(myRowIcon);
}
}
}
}
示例10: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public static void update(@NotNull Presentation presentation,
@NotNull Presentation templatePresentation,
@Nullable ProcessHandler processHandler) {
boolean enable = false;
Icon icon = templatePresentation.getIcon();
String description = templatePresentation.getDescription();
if (processHandler != null && !processHandler.isProcessTerminated()) {
enable = true;
if (processHandler.isProcessTerminating() && processHandler instanceof KillableProcess) {
KillableProcess killableProcess = (KillableProcess) processHandler;
if (killableProcess.canKillProcess()) {
// 'force quite' action presentation
icon = AllIcons.Debugger.KillProcess;
description = "Kill process";
}
}
}
presentation.setEnabled(enable);
presentation.setIcon(icon);
presentation.setDescription(description);
}
示例11: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent event) {
final Project project = event.getData(PlatformDataKeys.PROJECT);
final Presentation presentation = event.getPresentation();
if (project == null) {
presentation.setVisible(false);
return;
}
presentation.setIcon(HybrisIcons.HYBRIS_ICON);
presentation.setVisible(CommonIdeaService.getInstance().isHybrisProject(project));
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:12,代码来源:ProjectRefreshAction.java
示例12: showPresention
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void showPresention(Presentation presentation,boolean show){
if(show){
presentation.setIcon(AllIcons.General.InspectionsOK);
}else{
presentation.setIcon(null);
}
}
示例13: SwitchToVariationAction
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public SwitchToVariationAction(String title, @NotNull Project project, VirtualFile file, boolean select) {
super(title, null, null);
myFile = file;
myProject = project;
if (select) {
Presentation templatePresentation = getTemplatePresentation();
templatePresentation.setIcon(AllIcons.Actions.Checked);
templatePresentation.setEnabled(false);
}
}
示例14: updateForBlazeProject
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
protected void updateForBlazeProject(Project project, AnActionEvent event) {
Presentation presentation = event.getPresentation();
if (isEnabled(event)) {
String text = String.format("New %s Package", Blaze.buildSystemName(project));
presentation.setEnabledAndVisible(true);
presentation.setText(text);
presentation.setDescription(text);
presentation.setIcon(PlatformIcons.PACKAGE_ICON);
} else {
presentation.setEnabledAndVisible(false);
}
}
示例15: CloseTabToolbarAction
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public CloseTabToolbarAction() {
copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_CLOSE_ACTIVE_TAB));
Presentation presentation = getTemplatePresentation();
presentation.setIcon(AllIcons.Actions.Cancel);
presentation.setText(CommonBundle.getCloseButtonText());
presentation.setDescription(null);
}