Search in sources :

Example 1 with IExtendedFigureFactory

use of org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory in project webtools.sourceediting by eclipse.

the class ConnectableEditPart method getExtendedFigureFactory.

public IExtendedFigureFactory getExtendedFigureFactory() {
    EditPartFactory factory = getViewer().getEditPartFactory();
    // $NON-NLS-1$
    Assert.isTrue(factory instanceof IExtendedFigureFactory, "EditPartFactory must be an instanceof of IExtendedFigureFactory");
    return (IExtendedFigureFactory) factory;
}
Also used : IExtendedFigureFactory(org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory) EditPartFactory(org.eclipse.gef.EditPartFactory)

Example 2 with IExtendedFigureFactory

use of org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory 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

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