Package org.eclipse.wb.internal.core.utils.ui

Examples of org.eclipse.wb.internal.core.utils.ui.MenuManagerEx


  ////////////////////////////////////////////////////////////////////////////
  private void contributeContextMenu(IMenuManager manager, final ComponentInfo component) {
    Map<String, MenuManagerEx> eventManagers = Maps.newTreeMap();
    for (final EventDescription description : getEventDescriptions(component)) {
      // prepare MenuManager for event
      MenuManagerEx eventManager;
      {
        String event = description.getEvent();
        eventManager = eventManagers.get(event);
        if (eventManager == null) {
          eventManager = new MenuManagerEx(event);
          eventManager.setImage(EventsPropertyUtils.LISTENER_INTERFACE_IMAGE);
          eventManagers.put(event, eventManager);
          manager.appendToGroup(IContextMenuConstants.GROUP_EVENTS2, eventManager);
        }
      }
      // add specific name
      Action action = new Action() {
        @Override
        public void runWithEvent(Event event) {
          if ((event.stateMask & SWT.CTRL) != 0) {
            removeListener(component, description);
          } else {
            openListener(component, description);
          }
        }
      };
      {
        String text = description.getName();
        MethodInvocation invocation = getInvocation(component, description);
        if (invocation != null) {
          int line = 1 + component.getEditor().getLineNumber(invocation.getStartPosition());
          text += "\tline " + line;
        }
        action.setText(text);
      }
      action.setImageDescriptor(EventsPropertyUtils.LISTENER_METHOD_IMAGE_DESCRIPTOR);
      eventManager.add(action);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.utils.ui.MenuManagerEx

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.