Search in sources :

Example 1 with IJavaWebNode

use of org.eclipse.wst.jsdt.web.ui.views.contentoutline.IJavaWebNode in project webtools.sourceediting by eclipse.

the class JsMenuListener method menuAboutToShow.

// private IWorkbenchSite getWorkbenchSite() {
// return InternalHandlerUtil.getActiveSite(fTreeViewer);
// }
public void menuAboutToShow(IMenuManager manager) {
    ISelection selection = fTreeViewer.getSelection();
    if (selection instanceof TreeSelection) {
        TreeSelection tselect = (TreeSelection) selection;
        Object[] elements = tselect.toArray();
        int javaCount = 0;
        for (int i = 0; i < elements.length; i++) {
            if (elements[i] instanceof IJavaWebNode) {
                javaCount++;
            }
        }
        // menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
        if (javaCount == elements.length && javaCount != 0) {
            // see plugin.xml for object contributions that populate these
            // menus
            /*
				 * Menu for:
				 * 
				 * Open Type Hierarchy Open Call Hierarchy Show In--> Script
				 * Explorer Navigator
				 */
            manager.add(new Separator(IContextMenuConstants.GROUP_SHOW));
            manager.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW));
            /*
				 * Menu for: Cut Copy Paste Delete
				 */
            manager.add(new Separator(JsMenuListener.EDIT_GROUP_ID));
            manager.add(new GroupMarker(JsMenuListener.EDIT_GROUP_ID));
            /*
				 * Menu for:
				 * 
				 * Source--> Generate Element Comment
				 * 
				 * 
				 * Refactor--> Rename Move Change Function Signature Inline
				 * Introduce Indirection Infer Generic Type Arguments
				 */
            manager.add(new Separator(IContextMenuConstants.GROUP_SOURCE));
            manager.add(new GroupMarker(IContextMenuConstants.GROUP_SOURCE));
            /*
				 * Menu for:
				 * 
				 * Refrences--> Workspace Project Hierarchy Working Set
				 * 
				 * Declerations--> Workspace Project Hierarchy Working Set
				 * 
				 */
            manager.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
            manager.add(new GroupMarker(IContextMenuConstants.GROUP_SEARCH));
        /* all Java Elements */
        // 
        // 
        // 
        // JavaScriptPlugin.createStandardGroups(manager);
        // String[] actionSets = JSDTActionSetUtil.getAllActionSets();
        // 
        // IAction[] actions = JSDTActionSetUtil.getActionsFromSet(actionSets);
        // for(int i = 0;i<actions.length;i++) {
        // manager.add(actions[i]);
        // }
        // fActionGroups.setContext(new ActionContext(selection));
        // fActionGroups.fillContextMenu(manager);
        // 
        } else if (javaCount == 0) {
            fillContextMenu(manager, selection);
        }
    }
}
Also used : TreeSelection(org.eclipse.jface.viewers.TreeSelection) ISelection(org.eclipse.jface.viewers.ISelection) GroupMarker(org.eclipse.jface.action.GroupMarker) IJavaWebNode(org.eclipse.wst.jsdt.web.ui.views.contentoutline.IJavaWebNode) Separator(org.eclipse.jface.action.Separator)

Aggregations

GroupMarker (org.eclipse.jface.action.GroupMarker)1 Separator (org.eclipse.jface.action.Separator)1 ISelection (org.eclipse.jface.viewers.ISelection)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 IJavaWebNode (org.eclipse.wst.jsdt.web.ui.views.contentoutline.IJavaWebNode)1