Package org.eclipse.jface.action

Examples of org.eclipse.jface.action.IMenuManager


    super.fillContextMenu(contextMenu, ele);

    final IDOMElement element = (IDOMElement) ele;
    IContributionItem item = contextMenu.find(PageDesignerActionConstants.INSERT_SUBMENU_ID);
    if (item instanceof IMenuManager) {
      final IMenuManager submenu = (IMenuManager) item;
        submenu.add(EMPTY_ACTION);
        submenu.addMenuListener(new IMenuListener() {
          public void menuAboutToShow(IMenuManager manager) {
            submenu.removeAll();
            addHeadAddItems(submenu, element);
          }
        });
    }
    }
View Full Code Here


    {
        IContributionItem subMenuItem = menu.find(PageDesignerActionConstants.SELECT_SUBMENU_ID);
       
        if (subMenuItem instanceof IMenuManager)
        {
            final IMenuManager subMenu = (IMenuManager) subMenuItem;
    //        final IMenuManager selectMenu = new MenuManager(PDPlugin
    //                .getResourceString("ActionGroup.Submenu.SelectRelative"));//$NON-NLS-1$
            SelectParentAction  selectParentAction = SelectParentAction.create(ele, part);
            // Eclipse UI guideline: 6.13
            // even if there is no parent, a disabled action will be returned by
            // create and this should be added to the menu
            subMenu.add(selectParentAction);
           
            List children = new ArrayList();
            for (Iterator it = part.getChildren().iterator(); it.hasNext();)
            {
                EditPart childPart = (EditPart) it.next();
               
                // only include selectable element edit part that are modelling
                // XML elements in the source doc
                if (childPart instanceof ElementEditPart
                        && ((ElementEditPart)childPart).isSelectable()
                        && ((ElementEditPart)childPart).getModel() instanceof Element)
                {
                    children.add(SelectNodeAction
                            .create(((Element)((ElementEditPart)childPart).getModel()).getNodeName(), childPart));
                }
            }

           
            // don't add the select Children menu unless there are actually children
            if (children.size() > 0)
            {
                MenuManager selectChildMenu = new MenuManager(Messages.SingleElementActionGroup_ChildrenActionText);
                subMenu.add(selectChildMenu);

                for (final Iterator it = children.iterator(); it.hasNext();)
                {
                    selectChildMenu.add((Action)it.next());
                }
            }
            else
            {   // Eclipse UI guideline 6.13
                // create the child actions even if no children but make it
                // a disabled option if no children
                Action childrenAction = new Action(Messages.SingleElementActionGroup_ChildrenActionText){/* do nothing*/};
                childrenAction.setEnabled(false);
                subMenu.add(childrenAction);
            }
        }
    }
View Full Code Here

        IContributionItem subMenu =
            menu.find(PageDesignerActionConstants.STYLE_SUBMENU_ID);

        if (subMenu instanceof IMenuManager)
        {
            final IMenuManager subMenuManager =
                (IMenuManager) subMenu;
        addStyle(subMenuManager, part, ele);
        addStyleClassesMenu(subMenuManager, part, ele);
   
        if (DOMStyleUtil.supportStyleAttribute(ele)) {
View Full Code Here

   * @param stylesub
   * @param part
   */
  private void addStyleClassesMenu(IMenuManager subMenu,
      ElementEditPart part, final IDOMElement ele) {
    final IMenuManager classmenu = new MenuManager(PDPlugin
        .getResourceString("ActionGroup.Submenu.StyleClasses"));//$NON-NLS-1$
    StyleClassSupport.createStyleClassActions(classmenu, ele);

        subMenu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE,
                classmenu);
View Full Code Here

   * @param stylesub
   * @param part
   */
  private void addColorMenu(IMenuManager subMenu, ElementEditPart part,
      final IDOMElement ele) {
    final IMenuManager colorSub = new MenuManager(PDPlugin
        .getResourceString("ActionGroup.Submenu.Color"));//$NON-NLS-1$
    colorSub.add(action);
    colorSub.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        colorSub.removeAll();
        ColorSupport.createColorActions(colorSub, ele,
            ICSSPropertyID.ATTR_COLOR);
      }
    });
        subMenu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE,
View Full Code Here

    final TableChildElementPosition position = new TableUtil(table).getPosition((Node)null);
    final int cellRow = position.getRowIndex();
    final int cellColumn = position.getColumnIndex();

    final IMenuManager tableMenu =
      new MenuManager(PDPlugin.getResourceString("ElementEdit.Submenu.Table")); //$NON-NLS-1$
    tableMenu.add(action);
    tableMenu.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        tableMenu.removeAll();
        fillTableMenu(tablePart, cellRow, cellColumn, tableMenu);
      }
    });

    contextMenu.appendToGroup(PageDesignerActionConstants.GROUP_CONTAINER, tableMenu);
View Full Code Here

   * @param stylesub
   * @param part
   */
  private void addBackgroundMenu(IMenuManager subMenu, ElementEditPart part,
      final IDOMElement ele) {
    final IMenuManager colorSub = new MenuManager(PDPlugin
        .getResourceString("ActionGroup.Submenu.BackgroundColor"));//$NON-NLS-1$
    colorSub.add(action);
    colorSub.addMenuListener(new IMenuListener() {

      public void menuAboutToShow(IMenuManager manager) {
        colorSub.removeAll();
        ColorSupport.createColorActions(colorSub, ele,
            ICSSPropertyID.ATTR_BACKGROUND_COLOR);
      }
    });

View Full Code Here

            }
          }
        });

    owner.setWeights(new int[] { 30, 50 });
    IMenuManager menuManager = getViewSite().getActionBars()
        .getMenuManager();
    menuManager.add(new Action("Settings") {
      public void run() {
        final Binding bnd=new Binding(LogViewPart.this);
        bnd.setAutoCommit(false);
        bnd.setReadOnly(false);
        Container r=new Container();
        IContainerLayoutManager ca=new OneElementOnLineLayouter();
        OneLineTextElement<Integer>str=new OneLineTextElement<Integer>(bnd.getBinding("days"));
        ComboEnumeratedValueSelector<Integer>sev=new ComboEnumeratedValueSelector<Integer>();
        sev.setOrdered(true);
        sev.setBinding(bnd.getBinding("minSeverityToFetch"));
        r.add(str);
        r.add(sev);       
        Container buttons=new Container();       
        HorizontalLayouter horizontalLayouter = new HorizontalLayouter();
        buttons.setLayoutManager(horizontalLayouter);
        r.add(buttons);
        final InputElementDialog inputElementDialog = new InputElementDialog(bnd,r,"Settings","you may configure settings here");
        ButtonSelector bs=new ButtonSelector();
        bs.setValue(new Runnable() {
          public void run() {
            bnd.commit();
            inputElementDialog.close();
          }
        });
        bs.setText("Apply");
        buttons.add(bs);       
        ButtonSelector bs1=new ButtonSelector();
        bs1.setValue(new Runnable() {
          public void run() {
            inputElementDialog.close();
          }
        });
        //buttons.add(bs);
        buttons.add(bs1);
        bs1.setText("Cancel");
        r.setLayoutManager(ca);
        DisposeBindingListener.linkBindingLifeCycle(bnd, r);
        inputElementDialog.open();
      }
    });
    menuManager.update(true);

    IToolBarManager toolBarManager = getViewSite().getActionBars()
        .getToolBarManager();
    toolBarManager.add(new Action("Export Log") {

      {
        setImageDescriptor(Activator.imageDescriptorFromPlugin(
            Activator.PLUGIN_ID, "/icons/export_log.gif"));
      }

      public void run() {
        FileDialog dlg = new FileDialog(Display.getCurrent()
            .getActiveShell(), SWT.SAVE);
        dlg.setText("Export log to:");
        String open = dlg.open();
        if (open != null) {
          try {
           
            FileOutputStream s = new FileOutputStream(open);
            BufferedWriter bf = new BufferedWriter(
                new OutputStreamWriter(s));
            try {
              bf.append(currentLogs);
              bf.close();
            } catch (Exception e) {
              MessageDialog.openError(Display.getCurrent()
                  .getActiveShell(), "Error", e.getMessage());
            }

          } catch (FileNotFoundException e) {
            MessageDialog.openError(Display.getCurrent()
                .getActiveShell(), "Error", e.getMessage());
          }
        }
      }

    });
    toolBarManager.add(new Action("Import Log") {

      {
        setImageDescriptor(Activator.imageDescriptorFromPlugin(
            Activator.PLUGIN_ID, "/icons/import_log.gif"));
      }

      public void run() {
        FileDialog dlg = new FileDialog(Display.getCurrent()
            .getActiveShell(), SWT.OPEN);
        dlg.setText("Open log from");

        String open = dlg.open();
        if (open != null) {
          try {
            FileInputStream s = new FileInputStream(open);
            BufferedReader bf = new BufferedReader(
                new InputStreamReader(s));
            StringBuilder bld = new StringBuilder();
            ;
            ArrayList<LogItem> result = new ArrayList<LogItem>();
            try {
              while (true) {
                try {
                  String str = bf.readLine();
                  if (str == null) {
                    break;
                  }
                  try {
                    result.add(new LogItem(str));
                  } catch (Exception e) {
                    e.printStackTrace();
                  }
                  bld.append(str);
                  bld.append('\n');
                } catch (IOException e) {
                  MessageDialog.openError(Display
                      .getCurrent().getActiveShell(),
                      "Error", e.getMessage());
                }

              }
              logViewer.setInput(result
                  .toArray(new LogItem[result.size()]));
              currentLogs = bld.toString();

            } catch (Exception e) {
              MessageDialog.openError(Display.getCurrent()
                  .getActiveShell(), "Error", e.getMessage());
            }

          } catch (FileNotFoundException e) {
            MessageDialog.openError(Display.getCurrent()
                .getActiveShell(), "Error", e.getMessage());
          }
        }
      }

    });
    sync = new Action("Sync with Server") {

      {
        setImageDescriptor(Activator.imageDescriptorFromPlugin(
            Activator.PLUGIN_ID, "/icons/refresh.gif"));
      }

      public void run() {
        refreshLog(currentProject);
      }

    };
    menuManager.add(new Separator());
    Action action = new Action("Split horizontally",
        IAction.AS_RADIO_BUTTON) {
      {
        setImageDescriptor(Activator.imageDescriptorFromPlugin(
            Activator.PLUGIN_ID, "icons/horizontalOrientation.gif"));

      }

      public void run() {
        owner.setOrientation(SWT.HORIZONTAL);
        logViewer.getTreeViewer().getTree().layout(true, true);
      }
    };
    action.setChecked(owner.getOrientation() == SWT.HORIZONTAL);
    menuManager.add(action);
    menuManager
        .add(new Action("Split vertically", IAction.AS_RADIO_BUTTON) {
          {
            setImageDescriptor(Activator.imageDescriptorFromPlugin(
                Activator.PLUGIN_ID,
                "icons/verticalOrientation.gif"));
View Full Code Here

    }
    return model;
  }

  protected void addSourceMenuActions(IMenuManager menu) {
    IMenuManager subMenu= new MenuManager(SSEUIMessages.SourceMenu_label, IStructuredTextEditorActionConstants.SOURCE_CONTEXT_MENU_ID);
    subMenu.add(new Separator(IStructuredTextEditorActionConstants.SOURCE_BEGIN));
    subMenu.add(new Separator(IStructuredTextEditorActionConstants.SOURCE_ADDITIONS));
    subMenu.add(new Separator(IStructuredTextEditorActionConstants.SOURCE_END));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, subMenu);
  }
View Full Code Here

    subMenu.add(new Separator(IStructuredTextEditorActionConstants.SOURCE_END));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, subMenu);
  }

  protected void addRefactorMenuActions(IMenuManager menu) {
    IMenuManager subMenu = new MenuManager(SSEUIMessages.RefactorMenu_label, IStructuredTextEditorActionConstants.REFACTOR_CONTEXT_MENU_ID);
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, subMenu);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.action.IMenuManager

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.