Search in sources :

Example 1 with IXSDToolbarAction

use of org.eclipse.wst.xsd.ui.internal.actions.IXSDToolbarAction in project webtools.sourceediting by eclipse.

the class XSDMultiPageEditorContributor method setActiveEditor.

public void setActiveEditor(IEditorPart part) {
    IEditorPart activeNestedEditor = null;
    if (part instanceof MultiPageEditorPart) {
        activeNestedEditor = part;
    }
    setActivePage(activeNestedEditor);
    if (part instanceof InternalXSDMultiPageEditor) {
        xsdEditor = (InternalXSDMultiPageEditor) part;
        textEditor = xsdEditor.getTextEditor();
        if (textEditor != null) {
            // updateActions();
            getActionBars().updateActionBars();
        }
    }
    List list = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getToolbarActions();
    for (Iterator i = list.iterator(); i.hasNext(); ) {
        ((IXSDToolbarAction) i.next()).setEditorPart(activeNestedEditor);
    }
    super.setActiveEditor(part);
}
Also used : MultiPageEditorPart(org.eclipse.ui.part.MultiPageEditorPart) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) IEditorPart(org.eclipse.ui.IEditorPart) IXSDToolbarAction(org.eclipse.wst.xsd.ui.internal.actions.IXSDToolbarAction)

Example 2 with IXSDToolbarAction

use of org.eclipse.wst.xsd.ui.internal.actions.IXSDToolbarAction in project webtools.sourceediting by eclipse.

the class XSDEditorConfiguration method updateList.

private void updateList(String ID) {
    IConfigurationElement[] xsdEditorExtensionList = Platform.getExtensionRegistry().getConfigurationElementsFor(ID);
    boolean definedExtensionsExist = (xsdEditorExtensionList != null && xsdEditorExtensionList.length > 0);
    if (definedExtensionsExist) {
        for (int i = 0; i < xsdEditorExtensionList.length; i++) {
            XSDEditorExtensionProperties properties = new XSDEditorExtensionProperties();
            definedExtensionsList.add(properties);
            IConfigurationElement element = xsdEditorExtensionList[i];
            String adapterFactoryClass = element.getAttribute(ADAPTERFACTORY);
            if (adapterFactoryClass != null) {
                Object object = loadClass(element, adapterFactoryClass);
                XSDAdapterFactory adapterFactory = null;
                if (object instanceof XSDAdapterFactory) {
                    adapterFactory = (XSDAdapterFactory) object;
                    properties.setAdapterFactory(adapterFactory);
                }
            }
            String figureFactoryClass = element.getAttribute(FIGUREFACTORY);
            if (figureFactoryClass != null) {
                Object object = loadClass(element, figureFactoryClass);
                IExtendedFigureFactory figureFactory = null;
                if (object instanceof IExtendedFigureFactory) {
                    figureFactory = (IExtendedFigureFactory) object;
                    properties.setFigureFactoryList(figureFactory);
                }
            }
            IConfigurationElement[] toolbarActions = element.getChildren(TOOLBARACTION);
            List actionList = new ArrayList();
            if (toolbarActions != null) {
                for (int j = 0; j < toolbarActions.length; j++) {
                    IConfigurationElement actionElement = toolbarActions[j];
                    String actionClass = actionElement.getAttribute(CLASSNAME);
                    IXSDToolbarAction action = null;
                    if (actionClass != null) {
                        Object object = loadClass(actionElement, actionClass);
                        if (object instanceof IXSDToolbarAction) {
                            action = (IXSDToolbarAction) object;
                            actionList.add(action);
                        }
                    }
                }
            }
            properties.setActionList(actionList);
            String editPartFactoryClass = element.getAttribute(EDITPARTFACTORY);
            if (editPartFactoryClass != null) {
                Object object = loadClass(element, editPartFactoryClass);
                EditPartFactory editPartFactory = null;
                if (object instanceof EditPartFactory) {
                    editPartFactory = (EditPartFactory) object;
                    properties.setEditPartFactoryList(editPartFactory);
                }
            }
        }
    }
}
Also used : XSDAdapterFactory(org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory) IExtendedFigureFactory(org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory) ArrayList(java.util.ArrayList) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) EditPartFactory(org.eclipse.gef.EditPartFactory) List(java.util.List) ArrayList(java.util.ArrayList) IXSDToolbarAction(org.eclipse.wst.xsd.ui.internal.actions.IXSDToolbarAction)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 IXSDToolbarAction (org.eclipse.wst.xsd.ui.internal.actions.IXSDToolbarAction)2 Iterator (java.util.Iterator)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 EditPartFactory (org.eclipse.gef.EditPartFactory)1 IEditorPart (org.eclipse.ui.IEditorPart)1 MultiPageEditorPart (org.eclipse.ui.part.MultiPageEditorPart)1 XSDAdapterFactory (org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory)1 IExtendedFigureFactory (org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory)1