本文整理汇总了Java中com.intellij.openapi.actionSystem.Presentation.setText方法的典型用法代码示例。如果您正苦于以下问题:Java Presentation.setText方法的具体用法?Java Presentation.setText怎么用?Java Presentation.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.actionSystem.Presentation
的用法示例。
在下文中一共展示了Presentation.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDescription
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
private static void updateDescription(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Project project = e.getProject();
if (project != null) {
final StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
if (studyEditor != null) {
final Task task = studyEditor.getTaskFile().getTask();
if (task instanceof TheoryTask) {
presentation.setText(task.getLesson().getCourse().isAdaptive() ? "Get Next Recommendation" : "Mark as read");
}
else {
presentation.setText(TEXT);
}
}
}
}
示例2: 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));
}
示例3: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
final List<VirtualFile> modules = getModuleNames(e);
final Presentation presentation = e.getPresentation();
final boolean visible = !modules.isEmpty();
presentation.setVisible(visible);
presentation.setEnabled(visible);
String text;
if (modules.size() > 1) {
text = "Import " + modules.size() + " Modules";
}
else if (modules.size() == 1) {
text = "Import '" + modules.get(0).getNameWithoutExtension() + "' Module";
}
else {
text = getTemplatePresentation().getText();
}
presentation.setText(text);
}
示例4: 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());
}
}
示例5: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
DataContext dataContext = event.getDataContext();
FileEditor editor = PlatformDataKeys.FILE_EDITOR.getData(dataContext);
// do not allow global undo in dialogs
if (editor == null) {
final Boolean isModalContext = PlatformDataKeys.IS_MODAL_CONTEXT.getData(dataContext);
if (isModalContext != null && isModalContext) {
presentation.setEnabled(false);
return;
}
}
UndoManager undoManager = getUndoManager(editor, dataContext);
if (undoManager == null) {
presentation.setEnabled(false);
return;
}
presentation.setEnabled(isAvailable(editor, undoManager));
Pair<String, String> pair = getActionNameAndDescription(editor, undoManager);
presentation.setText(pair.first);
presentation.setDescription(pair.second);
}
示例6: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public final void update(AnActionEvent e) {
super.update(e);
Presentation presentation = e.getPresentation();
Client c = myDeviceContext.getSelectedClient();
if (c == null || !c.isValid()) {
presentation.setEnabled(false);
return;
}
String text = getActiveText(c);
presentation.setText(text);
presentation.setEnabled(true);
}
示例7: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
protected void update(VcsContext vcsContext, Presentation presentation) {
Project project = vcsContext.getProject();
if (project == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
if (! plVcsManager.hasActiveVcss()) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
String actionName = getActionName(vcsContext) + "...";
presentation.setText(actionName);
presentation.setEnabled(! plVcsManager.isBackgroundVcsOperationRunning());
presentation.setVisible(true);
}
示例8: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
final EditorWindow editorWindow = event.getData(EditorWindow.DATA_KEY);
if (editorWindow != null && editorWindow.inSplitter()) {
presentation.setText(IdeBundle.message("action.close.all.editors.in.tab.group"));
}
else {
presentation.setText(IdeBundle.message("action.close.all.editors"));
}
Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
presentation.setEnabled(FileEditorManager.getInstance(project).getSelectedFiles().length > 0);
}
示例9: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Artifact artifact = myArtifactEditor.getArtifact();
final ParentElementsInfo parentInfo = findParentAndGrandParent(artifact);
if (parentInfo != null) {
presentation.setText("Put Into '" + parentInfo.getGrandparentArtifact().getName() + "' and link via manifest");
}
boolean enable = parentInfo != null;
boolean isProvideElements = false;
for (PackagingSourceItem item : mySourceItemsTree.getSelectedItems()) {
isProvideElements |= item.isProvideElements();
if (!item.getKindOfProducedElements().containsJarFiles()) {
enable = false;
break;
}
}
enable &= isProvideElements;
presentation.setVisible(enable);
presentation.setEnabled(enable);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PutSourceItemIntoParentAndLinkViaManifestAction.java
示例10: 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));
}
示例11: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
/**
* Disables this action if no editor is currently opened.
*
* @param event the performed action
*/
@Override
public final void update(final AnActionEvent event) {
final Presentation presentation = event.getPresentation();
final Editor editor = event.getData(CommonDataKeys.EDITOR);
presentation.setText(getName());
presentation.setEnabled(editor != null);
}
示例12: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent event) {
StudyUtils.updateAction(event);
final Project project = event.getProject();
if (project != null) {
StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
StudyState studyState = new StudyState(studyEditor);
Presentation presentation = event.getPresentation();
if (!studyState.isValid()) {
presentation.setEnabled(false);
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
Task task = StudyUtils.getCurrentTask(project);
if (task == null) {
return;
}
presentation.setText(task instanceof PyCharmTask ? TEXT : RESET_TASK);
if (!EduNames.STUDY.equals(course.getCourseMode())) {
presentation.setVisible(true);
presentation.setEnabled(false);
}
}
}
示例13: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
Project project = e.getProject();
presentation.setEnabledAndVisible(project != null && CCUtils.isCourseCreator(project));
if (project != null) {
final Course course = StudyTaskManager.getInstance(project).getCourse();
if (course instanceof RemoteCourse) {
presentation.setText("Update Course on Stepik");
}
}
}
示例14: LayoutAction
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
protected LayoutAction(@NotNull DesignerEditorPanel designer, @NotNull String description, @Nullable String label, @Nullable Icon icon) {
myDesigner = designer;
Presentation presentation = getTemplatePresentation();
presentation.setDescription(description);
if (label != null) {
presentation.setText(label);
}
if (icon != null) {
presentation.setIcon(icon);
}
}
示例15: update
import com.intellij.openapi.actionSystem.Presentation; //导入方法依赖的package包/类
@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());
}