当前位置: 首页>>代码示例>>Java>>正文


Java Presentation.setEnabled方法代码示例

本文整理汇总了Java中org.eclipse.che.ide.api.action.Presentation.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Presentation.setEnabled方法的具体用法?Java Presentation.setEnabled怎么用?Java Presentation.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.che.ide.api.action.Presentation的用法示例。


在下文中一共展示了Presentation.setEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateInPerspective

import org.eclipse.che.ide.api.action.Presentation; //导入方法依赖的package包/类
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
  Presentation presentation = event.getPresentation();
  boolean isProjectExplorerActive =
      testDetector.getActivePart() instanceof ProjectExplorerPresenter;
  presentation.setVisible(isProjectExplorerActive);
  if (!isProjectExplorerActive) {
    return;
  }
  if (!testDetector.isEditorInFocus()) {
    analyzeProjectTreeSelection(presentation);
  } else {
    presentation.setEnabled(testDetector.isEnabled());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:AbstractTestNgTestAction.java

示例2: analyzeProjectTreeSelection

import org.eclipse.che.ide.api.action.Presentation; //导入方法依赖的package包/类
private void analyzeProjectTreeSelection(Presentation presentation) {
  Resource[] resources = appContext.getResources();
  if (resources == null || resources.length > 1) {
    presentation.setEnabled(false);
    return;
  }

  Resource resource = resources[0];
  if (resource.isProject() && isJavaProject((Project) resource)) {
    testDetector.setContextType(PROJECT);
    presentation.setEnabled(true);
    return;
  }

  Project project = resource.getProject();
  if (!isJavaProject(project)) {
    presentation.setEnabled(false);
    return;
  }

  if (isJavaTestFile(resource)) {
    testDetector.setContextType(TestExecutionContext.ContextType.FILE);
  } else if (resource instanceof Container) {
    Optional<Resource> srcFolder = resource.getParentWithMarker(SourceFolderMarker.ID);
    if (!srcFolder.isPresent() || resource.getLocation().equals(srcFolder.get().getLocation())) {
      presentation.setEnabled(false);
      return;
    }
    testDetector.setContextType(TestExecutionContext.ContextType.FOLDER);
  }
  presentation.setEnabled(true);
  selectedNodePath = resource.getLocation().toString();
}
 
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:AbstractTestNgTestAction.java

示例3: updateInPerspective

import org.eclipse.che.ide.api.action.Presentation; //导入方法依赖的package包/类
@Override
public void updateInPerspective(ActionEvent event) {
  final Presentation presentation = event.getPresentation();
  final Debugger debugger = debuggerManager.getActiveDebugger();
  if (debugger == null) {
    presentation.setEnabledAndVisible(false);
    return;
  }

  // Workaround: we don't support this action for another types of debugger
  presentation.setVisible("gdb".equals(debugger.getDebuggerType()));
  presentation.setEnabled(debugger.isConnected() && !debugger.isSuspended());
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:SuspendAction.java

示例4: renderActionGroup

import org.eclipse.che.ide.api.action.Presentation; //导入方法依赖的package包/类
/**
 * Returns the list of visible action group.
 *
 * @param group action group
 * @param presentationFactory presentation factory
 * @param actionManager action manager
 * @return list of visible action group
 */
public static List<VisibleActionGroup> renderActionGroup(
    @NotNull ActionGroup group,
    PresentationFactory presentationFactory,
    ActionManager actionManager) {
  Presentation presentation = presentationFactory.getPresentation(group);
  ActionEvent event = new ActionEvent(presentation, actionManager);

  if (!presentation.isVisible()) { // don't process invisible groups
    return null;
  }

  Action[] children = group.getChildren(event);
  List<VisibleActionGroup> currentVisibleActionGroupList = new ArrayList<>();
  List<Action> currentActionList = new ArrayList<>();
  String currentGroupId = actionManager.getId(group);
  for (Action child : children) {
    if (child == null) {
      Log.error(Utils.class, "action is null: group=" + group + " group id=" + currentGroupId);
      continue;
    }

    presentation = presentationFactory.getPresentation(child);
    child.update(new ActionEvent(presentation, actionManager));

    if (!presentation.isVisible()) { // don't create invisible items in the menu
      continue;
    }

    if (child instanceof ActionGroup) {
      ActionGroup actionGroup = (ActionGroup) child;
      if (actionGroup.isPopup()) { // popup menu has its own presentation
        if (actionGroup.disableIfNoVisibleChildren()) {
          final boolean visibleChildren =
              hasVisibleChildren(actionGroup, presentationFactory, actionManager);
          if (actionGroup.hideIfNoVisibleChildren() && !visibleChildren) {
            continue;
          }
          presentation.setEnabled(actionGroup.canBePerformed() || visibleChildren);
        }
        currentActionList.add(child);
      } else {
        List<VisibleActionGroup> newVisibleActionGroupList =
            renderActionGroup((ActionGroup) child, presentationFactory, actionManager);
        currentVisibleActionGroupList.addAll(newVisibleActionGroupList);
      }
    } else if (child instanceof Separator) {
      if ((((Separator) child).getText() != null)
          || (!currentActionList.isEmpty()
              && !(currentActionList.get(currentActionList.size() - 1) instanceof Separator))) {
        currentActionList.add(child);
      }
    } else {
      currentActionList.add(child);
    }
  }
  currentVisibleActionGroupList.add(0, new VisibleActionGroup(currentGroupId, currentActionList));

  return currentVisibleActionGroupList;
}
 
开发者ID:eclipse,项目名称:che,代码行数:68,代码来源:Utils.java

示例5: updateInPerspective

import org.eclipse.che.ide.api.action.Presentation; //导入方法依赖的package包/类
@Override
public void updateInPerspective(@NotNull ActionEvent event) {
  Presentation presentation = event.getPresentation();
  presentation.setVisible(testDetector.isEditorInFocus());
  presentation.setEnabled(testDetector.isEnabled());
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:RunTestAction.java


注:本文中的org.eclipse.che.ide.api.action.Presentation.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。