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


Java Presentation.setText方法代碼示例

本文整理匯總了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);
      }
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:17,代碼來源:StudyCheckAction.java

示例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));
}
 
開發者ID:ben-gibson,項目名稱:GitLink,代碼行數:19,代碼來源:Action.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:ImportModuleFromImlFileAction.java

示例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());
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:OpenFileInDefaultBrowserAction.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:UndoRedoAction.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:AbstractClientToggleAction.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:CommonCheckinProjectAction.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:CloseAllEditorsAction.java

示例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));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:ConfigureBranchesAction.java

示例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);
}
 
開發者ID:FWDekker,項目名稱:intellij-randomness,代碼行數:14,代碼來源:DataInsertAction.java

示例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);
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:29,代碼來源:StudyRefreshTaskFileAction.java

示例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");
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:13,代碼來源:CCPushCourse.java

示例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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:LayoutAction.java

示例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());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:TreeActionWrapper.java


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