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


Java Presentation类代码示例

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


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

示例1: PaneMenuActionItemWidget

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
public PaneMenuActionItemWidget(@NotNull Action action) {
  initWidget(UI_BINDER.createAndBindUi(this));
  this.action = action;
  Presentation presentation = action.getTemplatePresentation();
  title.setText(presentation.getText());

  addDomHandler(
      new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          if (delegate != null) {
            delegate.onItemClicked(PaneMenuActionItemWidget.this);
          }
        }
      },
      ClickEvent.getType());
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:PaneMenuActionItemWidget.java

示例2: renderAction

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
private Node renderAction(String title, final Action action) {
  final Presentation presentation = presentationFactory.getPresentation(action);
  Element divElement = Elements.createDivElement(style.listElement());
  divElement.addEventListener(
      "click",
      new EventListener() {
        @Override
        public void handleEvent(Event evt) {
          ActionEvent event = new ActionEvent(presentation, actionManager);
          action.actionPerformed(event);
        }
      },
      true);
  divElement.getStyle().setCursor("pointer");
  divElement.getStyle().setColor(Style.getOutputLinkColor());
  Element label = Elements.createDivElement(style.actionLabel());
  label.setInnerText(title);
  divElement.appendChild(label);

  String hotKey =
      KeyMapUtil.getShortcutText(keyBindingAgent.getKeyBinding(actionManager.getId(action)));
  if (hotKey == null) {
    hotKey = " ";
  } else {
    hotKey = "<nobr>&nbsp;" + hotKey + "&nbsp;</nobr>";
  }
  SpanElement hotKeyElement = Elements.createSpanElement(style.hotKey());
  hotKeyElement.setInnerHTML(hotKey);
  divElement.appendChild(hotKeyElement);
  return divElement;
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:EmptyEditorsPanel.java

示例3: updateActions

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
protected ActionGroup updateActions() {
  final ActionGroup mainActionGroup = (ActionGroup) actionManager.getAction(getGroupMenu());
  if (mainActionGroup == null) {
    return new DefaultActionGroup(actionManager);
  }

  final Action[] children = mainActionGroup.getChildren(null);
  for (final Action action : children) {
    final Presentation presentation = presentationFactory.getPresentation(action);
    // pass into action properties
    presentation.putClientProperty(CURRENT_FILE_PROP, editorTab.getFile());
    presentation.putClientProperty(CURRENT_TAB_PROP, editorTab);
    presentation.putClientProperty(CURRENT_PANE_PROP, editorPartStack);
  }
  return super.updateActions();
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:EditorTabContextMenu.java

示例4: onItemClicked

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Override
public void onItemClicked(@NotNull EditorPaneMenuItem<Action> item) {
  editorPaneMenu.hide();

  final Action action = item.getData();
  final Presentation presentation = presentationFactory.getPresentation(action);
  presentation.putClientProperty(CURRENT_PANE_PROP, EditorPartStackPresenter.this);

  final PartPresenter activePart = getActivePart();
  final TabItem tab = getTabByPart(activePart);

  if (tab != null) {
    final VirtualFile virtualFile = ((EditorTab) tab).getFile();
    // pass into action file property and editor tab
    presentation.putClientProperty(CURRENT_TAB_PROP, tab);
    presentation.putClientProperty(CURRENT_FILE_PROP, virtualFile);
  }
  action.actionPerformed(new ActionEvent(presentation, actionManager, null));
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:EditorPartStackPresenter.java

示例5: MenuBarItem

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
public MenuBarItem(
    ActionGroup group,
    ActionManager actionManager,
    Provider<PerspectiveManager> managerProvider,
    PresentationFactory presentationFactory,
    Element element,
    ActionSelectedHandler handler,
    KeyBindingAgent keyBindingAgent,
    MenuResources.Css css) {
  this.group = group;
  this.actionManager = actionManager;
  this.managerProvider = managerProvider;
  this.presentationFactory = presentationFactory;
  this.element = element;
  this.actionSelectedHandler = handler;
  this.keyBindingAgent = keyBindingAgent;
  this.css = css;
  Presentation presentation = presentationFactory.getPresentation(group);
  title = presentation.getText();
  element.setInnerText(presentation.getText());
  setEnabled(Utils.hasVisibleChildren(group, presentationFactory, actionManager));
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:MenuBarItem.java

示例6: onPropertyChange

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Override
public void onPropertyChange(PropertyChangeEvent e) {
  String propertyName = e.getPropertyName();

  if (Presentation.PROP_TEXT.equals(propertyName)) {
    if (tooltip != null && e.getNewValue() instanceof String) {
      tooltip.setTitle((String) e.getNewValue());
    }
  } else if (Presentation.PROP_ENABLED.equals(propertyName)) {
    setEnabled((Boolean) e.getNewValue());
  } else if (Presentation.PROP_ICON.equals(propertyName)) {
    renderImage();
  } else if (Presentation.PROP_VISIBLE.equals(propertyName)) {
    setVisible((Boolean) e.getNewValue());
  } else if (SELECTED_PROPERTY_NAME.equals(propertyName)) {
    setSelected((Boolean) e.getNewValue());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:ActionPopupButton.java

示例7: onPropertyChange

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Override
public void onPropertyChange(PropertyChangeEvent e) {
  String propertyName = e.getPropertyName();
  if (Presentation.PROP_TEXT.equals(propertyName)) {
    if (tooltip != null && e.getNewValue() instanceof String) {
      tooltip.setTitle((String) e.getNewValue());
    }
  } else if (Presentation.PROP_ENABLED.equals(propertyName)) {
    setEnabled((Boolean) e.getNewValue());
  } else if (Presentation.PROP_ICON.equals(propertyName)) {
    renderImage();
  } else if (Presentation.PROP_VISIBLE.equals(propertyName)) {
    setVisible((Boolean) e.getNewValue());
  } else if (SELECTED_PROPERTY_NAME.equals(propertyName)) {
    setSelected((Boolean) e.getNewValue());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:ActionButton.java

示例8: updateInPerspective

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Override
public void updateInPerspective(ActionEvent event) {
  EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
  Presentation presentation = event.getPresentation();
  if (activeEditor != workspaceAgent.getActivePart()) {
    presentation.setEnabledAndVisible(false);
    return;
  }
  if (Objects.nonNull(activeEditor) && activeEditor instanceof TextEditor) {
    TextEditorConfiguration configuration = ((TextEditor) activeEditor).getConfiguration();
    if (configuration instanceof LanguageServerEditorConfiguration) {
      ServerCapabilities capabilities =
          ((LanguageServerEditorConfiguration) configuration).getServerCapabilities();
      presentation.setEnabledAndVisible(
          capabilities.getRenameProvider() != null && capabilities.getRenameProvider());
      return;
    }
  }
  presentation.setEnabledAndVisible(false);
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:LSRenameAction.java

示例9: updateActions

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Override
protected ActionGroup updateActions() {
  ActionGroup actionGroup = super.updateActions();
  for (Action action : actionGroup.getChildren(null)) {
    Presentation presentation = action.getTemplatePresentation();
    presentation.putClientProperty(BREAKPOINT, breakpoint);
  }

  return actionGroup;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:BreakpointContextMenu.java

示例10: shouldBeVisibleOnUpdate

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Test
public void shouldBeVisibleOnUpdate() {
  String confName = "test_conf";
  when(debugConfiguration.getName()).thenReturn(confName);

  DebugConfiguration configuration = mock(DebugConfiguration.class);
  Optional<DebugConfiguration> configurationOptional = mock(Optional.class);
  when(configurationOptional.isPresent()).thenReturn(Boolean.TRUE);
  when(configurationOptional.get()).thenReturn(configuration);
  when(debugConfigurationsManager.getCurrentDebugConfiguration())
      .thenReturn(configurationOptional);

  ActionEvent event = mock(ActionEvent.class);
  Presentation presentation = mock(Presentation.class);
  when(event.getPresentation()).thenReturn(presentation);

  action.updateInPerspective(event);

  verify(presentation).setEnabledAndVisible(true);
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:DebugConfigurationActionTest.java

示例11: performAction

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Override
public void performAction(String actionId, Map<String, String> parameters) {
  final Action action;
  if (actionId != null && (action = getAction(actionId)) != null) {
    final Presentation presentation = presentationFactory.getPresentation(action);
    final ActionEvent actionEvent = new ActionEvent(presentation, this, parameters);

    action.update(actionEvent);

    if (presentation.isEnabled() && presentation.isVisible()) {
      action.actionPerformed(actionEvent);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:ActionManagerImpl.java

示例12: render

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Override
public void render(Element itemElement, Action itemData) {
  TableCellElement icon = Elements.createTDElement(css.proposalIcon());
  TableCellElement label = Elements.createTDElement(css.proposalLabel());
  TableCellElement group = Elements.createTDElement(css.proposalGroup());

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

  if (presentation.getImageElement() != null) {
    ElementWidget image = new ElementWidget(presentation.getImageElement());
    image.getElement().setAttribute("class", toolbarResources.toolbar().iconButtonIcon());
    image.getElement().getStyle().setMargin(0, Style.Unit.PX);
    icon.appendChild((Node) image.getElement());

  } else if (presentation.getHTMLResource() != null) {
    icon.setInnerHTML(presentation.getHTMLResource());
  }

  String hotKey =
      KeyMapUtil.getShortcutText(
          keyBindingAgent.getKeyBinding(actionManager.getId(itemData)));
  if (hotKey == null) {
    hotKey = "&nbsp;";
  } else {
    hotKey = "<nobr>&nbsp;[" + hotKey + "]&nbsp;</nobr>";
  }
  label.setInnerHTML(presentation.getText() + hotKey);
  if (!presentation.isEnabled() || !presentation.isVisible()) {
    itemElement.getStyle().setProperty("opacity", "0.6");
  }
  String groupName = actions.get(itemData);
  if (groupName != null) {
    group.setInnerHTML(groupName);
  }
  itemElement.appendChild(icon);
  itemElement.appendChild(label);
  itemElement.appendChild(group);
}
 
开发者ID:eclipse,项目名称:che,代码行数:40,代码来源:FindActionViewImpl.java

示例13: addToPanel

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
/** Create a new widget and add it to panel menu. */
private void addToPanel(FlowPanel panel, Action action, PresentationFactory presentationFactory) {
  Presentation presentation = presentationFactory.getPresentation(action);

  if (action instanceof Separator) {
    panel.add(new SeparatorItem(resources.menuCss().panelSeparator()));

    // todo find way to render non custom actions
  } else if (action instanceof CustomComponentAction) {
    CustomComponentAction customComponentAction = (CustomComponentAction) action;
    Widget component = customComponentAction.createCustomComponent(presentation);
    component.addStyleName(resources.menuCss().customComponent());
    panel.add(component);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:MainMenuViewImpl.java

示例14: expandActionGroup

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
private void expandActionGroup(
    List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) {
  final Action[] children = mainActionGroup.getChildren(null);
  for (final Action action : children) {
    final Presentation presentation = presentationFactory.getPresentation(action);
    final ActionEvent e = new ActionEvent(presentation, actionManager);
    action.update(e);
    if (presentation.isVisible()) { // add only visible items
      newVisibleActions.add(action);
    }
    if (action2barItem.containsKey(action)) {
      action2barItem.get(action).update();
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:MainMenuViewImpl.java

示例15: actionShouldBePerformed

import org.eclipse.che.ide.api.action.Presentation; //导入依赖的package包/类
@Test
public void actionShouldBePerformed() throws Exception {
  when(preferencesManager.getValue(eq(LINK_WITH_EDITOR))).thenReturn(null);

  action.actionPerformed(new ActionEvent(new Presentation(), null, null));

  verify(preferencesManager).setValue("linkWithEditor", Boolean.toString(true));
  verify(eventBus).fireEvent((Event<?>) anyObject());
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:LinkWithEditorActionTest.java


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