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


Java Presentation.setEnabled方法代碼示例

本文整理匯總了Java中com.intellij.openapi.actionSystem.Presentation.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Presentation.setEnabled方法的具體用法?Java Presentation.setEnabled怎麽用?Java Presentation.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.actionSystem.Presentation的用法示例。


在下文中一共展示了Presentation.setEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
  StudyUtils.updateAction(e);
  final Project project = e.getProject();
  if (project != null) {

    Course course = StudyTaskManager.getInstance(project).getCourse();
    Presentation presentation = e.getPresentation();
    if (course != null && !EduNames.STUDY.equals(course.getCourseMode())) {
      presentation.setEnabled(false);
      presentation.setVisible(true);
      return;
    }
    StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
    StudyState studyState = new StudyState(studyEditor);
    if (!studyState.isValid()) {
      presentation.setEnabledAndVisible(false);
      return;
    }
    TaskFile taskFile = studyState.getTaskFile();
    if (taskFile.getActivePlaceholders().isEmpty()) {
      presentation.setEnabledAndVisible(false);
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:26,代碼來源:StudyFillPlaceholdersAction.java

示例2: 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

示例3: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
    super.update(e);
    final Presentation presentation = e.getPresentation();
    if(presentation.isEnabled()) {
        final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
        final Project project = e.getProject();
        if (view != null && project != null) {
            ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
            PsiDirectory[] dirs = view.getDirectories();
            for (PsiDirectory dir : dirs) {
                if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
                        JavaDirectoryService.getInstance().getPackage(dir) != null && isValidForClass(project,dir)) {
                    return;
                }
            }
        }
        presentation.setEnabled(false);
        presentation.setVisible(false);
    }
}
 
開發者ID:wangtotang,項目名稱:DaggerHelper,代碼行數:22,代碼來源:BaseAction.java

示例4: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent e) {
  DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());

  boolean visible = false;
  boolean enabled = false;
  String text = DebuggerBundle.message("action.resume.thread.text.resume");

  if(selectedNodes != null && selectedNodes.length > 0){
    visible = true;
    enabled = true;
    for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
      final NodeDescriptorImpl threadDescriptor = selectedNode.getDescriptor();
      if (!(threadDescriptor instanceof ThreadDescriptorImpl) || !((ThreadDescriptorImpl)threadDescriptor).isSuspended()) {
        visible = false;
        break;
      }
    }
  }
  final Presentation presentation = e.getPresentation();
  presentation.setText(text);
  presentation.setVisible(visible);
  presentation.setEnabled(enabled);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ResumeThreadAction.java

示例5: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(final AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  boolean hidden = isHidden(event);
  if (hidden) {
    presentation.setEnabledAndVisible(false);
    return;
  }

  boolean enabled = isEnabled(event);
  if (myHideDisabledInPopup && ActionPlaces.isPopupPlace(event.getPlace())) {
    presentation.setVisible(enabled);
  }
  else {
    presentation.setVisible(true);
  }
  presentation.setEnabled(enabled);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:XDebuggerActionBase.java

示例6: 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

示例7: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent var1) {
    Presentation var2 = var1.getPresentation();
    DataContext var3 = var1.getDataContext();
    CopyProvider var4 = (CopyProvider) PlatformDataKeys.COPY_PROVIDER.getData(var3);
    boolean var5 = var4 != null && var4.isCopyEnabled(var3) && var4.isCopyVisible(var3);
    var2.setEnabled(var5);
    var2.setVisible(var5);
}
 
開發者ID:kookob,項目名稱:mybatis-log-plugin,代碼行數:9,代碼來源:GoogleTranslateAction.java

示例8: 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

示例9: updateAction

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public static void updateAction(@NotNull final AnActionEvent e) {
  final Presentation presentation = e.getPresentation();
  presentation.setEnabled(false);
  final Project project = e.getProject();
  if (project != null) {
    final StudyEditor studyEditor = getSelectedStudyEditor(project);
    if (studyEditor != null) {
      presentation.setEnabledAndVisible(true);
    }
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:12,代碼來源:StudyUtils.java

示例10: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
  final Presentation presentation = e.getPresentation();
  StudyUtils.updateAction(e);
  if (presentation.isEnabled()) {
    updateDescription(e);
    presentation.setEnabled(!myCheckInProgress.get());
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:10,代碼來源:StudyCheckAction.java

示例11: 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

示例12: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(@NotNull AnActionEvent event) {
  final Presentation presentation = event.getPresentation();
  presentation.setEnabledAndVisible(false);

  CCState state = getState(event);
  if (state == null) {
    return;
  }

  presentation.setVisible(true);
  if (canAddPlaceholder(state)) {
    presentation.setEnabled(true);
  }
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:16,代碼來源:CCAddAnswerPlaceholder.java

示例13: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public final void update(AnActionEvent e) {
  this.dataContext = e.getDataContext();
  final Presentation presentation = e.getPresentation();

  final boolean enabled = isAvailable(dataContext);

  presentation.setVisible(enabled);
  presentation.setEnabled(enabled);
}
 
開發者ID:uber,項目名稱:RIBs,代碼行數:11,代碼來源:GenerateAction.java

示例14: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
  if (project == null || project.isDisposed()) {
    presentation.setEnabled(false);
    return;
  }
  presentation.setEnabled(IdeDocumentHistory.getInstance(project).isForwardAvailable());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ForwardAction.java

示例15: update

import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  ToolWindowManagerEx manager=(ToolWindowManagerEx)ToolWindowManager.getInstance(project);
  String id = manager.getLastActiveToolWindowId();
  presentation.setEnabled(id != null && manager.getToolWindow(id).isAvailable());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:JumpToLastWindowAction.java


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