Search in sources :

Example 1 with RefactorActionGroup

use of org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup in project webtools.sourceediting by eclipse.

the class XSDRefactorGroupActionDelegate method fillMenu.

/**
 * Fills the menu with applicable refactor sub-menues
 * @param menu The menu to fill
 */
protected void fillMenu(Menu menu) {
    if (fSelection == null) {
        return;
    }
    if (workbenchPart != null) {
        IWorkbenchPartSite site = workbenchPart.getSite();
        if (site == null)
            return;
        IEditorPart editor = site.getPage().getActiveEditor();
        if (editor != null) {
            XSDSchema schema = (XSDSchema) editor.getAdapter(XSDSchema.class);
            ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class);
            if (schema != null) {
                ISelection selection = mapper != null ? mapper.mapSelection(fSelection) : fSelection;
                RefactorActionGroup refactorMenuGroup = new XSDRefactorActionGroup(selection, schema);
                RefactorGroupSubMenu subMenu = new RefactorGroupSubMenu(refactorMenuGroup);
                subMenu.fill(menu, -1);
            }
        }
    }
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) RefactorActionGroup(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup) XSDRefactorActionGroup(org.eclipse.wst.xsd.ui.internal.refactor.actions.XSDRefactorActionGroup) ISelectionMapper(org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper) ISelection(org.eclipse.jface.viewers.ISelection) IEditorPart(org.eclipse.ui.IEditorPart) RefactorGroupSubMenu(org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupSubMenu) XSDRefactorActionGroup(org.eclipse.wst.xsd.ui.internal.refactor.actions.XSDRefactorActionGroup) XSDSchema(org.eclipse.xsd.XSDSchema)

Aggregations

ISelection (org.eclipse.jface.viewers.ISelection)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPartSite (org.eclipse.ui.IWorkbenchPartSite)1 ISelectionMapper (org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper)1 XSDRefactorActionGroup (org.eclipse.wst.xsd.ui.internal.refactor.actions.XSDRefactorActionGroup)1 RefactorActionGroup (org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup)1 RefactorGroupSubMenu (org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupSubMenu)1 XSDSchema (org.eclipse.xsd.XSDSchema)1