Search in sources :

Example 1 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class InternalXSDMultiPageEditor method editorModeChanged.

public void editorModeChanged(EditorMode newEditorMode) {
    // if (isInitializing)
    // return;
    EditPartFactory editPartFactory = newEditorMode.getEditPartFactory();
    if (editPartFactory != null) {
        graphicalViewer.setEditPartFactory(editPartFactory);
        if (graphicalViewer instanceof DesignViewGraphicalViewer) {
            DesignViewGraphicalViewer viewer = (DesignViewGraphicalViewer) graphicalViewer;
            IADTObject input = viewer.getInput();
            viewer.setInput(null);
            // viewer.getRootEditPart().refresh();
            // viewer.getRootEditPart().getContents().refresh();
            viewer.setInput(input);
            floatingToolbar.setEditPartFactory(editPartFactory);
            floatingToolbar.setModel(getModel());
            floatingToolbar.refresh(!(input instanceof IModel));
            Control control = graphicalViewer.getControl();
            if (control instanceof Composite) {
                Composite parent = ((Composite) control).getParent();
                parent.layout();
            }
        }
    }
    IContentProvider provider = newEditorMode.getOutlineProvider();
    if (provider != null) {
        ADTContentOutlinePage outline = (ADTContentOutlinePage) getContentOutlinePage();
        if (outline != null) {
            TreeViewer treeViewer = outline.getTreeViewer();
            if (treeViewer != null) {
                outline.getTreeViewer().setContentProvider(provider);
                outline.getTreeViewer().refresh();
            }
        }
    }
}
Also used : DesignViewGraphicalViewer(org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer) IModel(org.eclipse.wst.xsd.ui.internal.adt.facade.IModel) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) IContentProvider(org.eclipse.jface.viewers.IContentProvider) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) TreeViewer(org.eclipse.jface.viewers.TreeViewer) EditPartFactory(org.eclipse.gef.EditPartFactory) ADTContentOutlinePage(org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage)

Example 2 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class DesignViewNavigationLocation method restoreLocation.

public void restoreLocation() {
    XSDSchema schema = (XSDSchema) getEditorPart().getAdapter(XSDSchema.class);
    Object viewer = getEditorPart().getAdapter(GraphicalViewer.class);
    if (viewer instanceof DesignViewGraphicalViewer) {
        DesignViewGraphicalViewer graphicalViewer = (DesignViewGraphicalViewer) viewer;
        XSDConcreteComponent component = Path.computeComponent(schema, path);
        if (component != null) {
            Adapter adapter = XSDAdapterFactory.getInstance().adapt(component);
            if (adapter instanceof IADTObject) {
                graphicalViewer.setInput((IADTObject) adapter);
            }
        } else if (path.segments.isEmpty()) {
            Adapter adapter = XSDAdapterFactory.getInstance().adapt(schema);
            if (adapter instanceof IADTObject) {
                graphicalViewer.setInput((IADTObject) adapter);
            }
        }
    }
}
Also used : DesignViewGraphicalViewer(org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer) XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) EObject(org.eclipse.emf.ecore.EObject) Adapter(org.eclipse.emf.common.notify.Adapter) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 3 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class XSDComplexTypeDefinitionAdapter method clearFields.

protected void clearFields() {
    if (otherThingsToListenTo != null) {
        for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext(); ) {
            Adapter adapter = (Adapter) i.next();
            if (adapter instanceof IADTObject) {
                IADTObject adtObject = (IADTObject) adapter;
                adtObject.unregisterListener(this);
            }
        }
    }
    fields = null;
    otherThingsToListenTo = null;
}
Also used : IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) Iterator(java.util.Iterator) Adapter(org.eclipse.emf.common.notify.Adapter)

Example 4 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class XSDSimpleContentAdapter method getTopContainer.

public IADTObject getTopContainer() {
    XSDConcreteComponent c = getXSDSimpleTypeContent().getContainer();
    if (c instanceof XSDComplexTypeDefinition) {
        XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition) c;
        Adapter adapter = XSDAdapterFactory.getInstance().adapt(ct);
        if (adapter instanceof IADTObject)
            return (IADTObject) adapter;
    }
    return null;
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) Adapter(org.eclipse.emf.common.notify.Adapter) XSDComplexTypeDefinition(org.eclipse.xsd.XSDComplexTypeDefinition)

Example 5 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class ADTContentOutlineRefreshJob method performRefreshes.

private void performRefreshes(IProgressMonitor monitor) {
    IADTObject[] nodes = getNodesToRefresh();
    for (int index = 0; index < nodes.length; index++) {
        if (monitor.isCanceled()) {
            throw new OperationCanceledException();
        }
        IADTObject node = nodes[index];
        doRefresh(node);
    }
}
Also used : IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException)

Aggregations

IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)23 Adapter (org.eclipse.emf.common.notify.Adapter)9 Iterator (java.util.Iterator)7 ArrayList (java.util.ArrayList)5 DesignViewGraphicalViewer (org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer)4 IModel (org.eclipse.wst.xsd.ui.internal.adt.facade.IModel)4 IGraphElement (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement)3 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)3 List (java.util.List)2 EditPart (org.eclipse.gef.EditPart)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IWorkbench (org.eclipse.ui.IWorkbench)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 RootContentEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart)2 RootHolder (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder)2 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)2 IStructure (org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure)2 ADTContentOutlinePage (org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage)2 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)2