Search in sources :

Example 1 with RootContentEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart in project webtools.sourceediting by eclipse.

the class InternalXSDMultiPageEditor method initializeGraphicalViewer.

protected void initializeGraphicalViewer() {
    RootContentEditPart root = new RootContentEditPart();
    if (!(getEditorInput() instanceof IADTEditorInput)) {
        root.setModel(model);
    }
    graphicalViewer.setContents(root);
}
Also used : IADTEditorInput(org.eclipse.wst.xsd.ui.internal.adt.editor.IADTEditorInput) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart)

Example 2 with RootContentEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart in project webtools.sourceediting by eclipse.

the class XSDGraphViewerDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    viewer = new ScrollingGraphicalViewer();
    Composite c = (Composite) super.createDialogArea(parent);
    if (isHighContrast) {
        c.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    } else {
        c.setBackground(ColorConstants.white);
    }
    c.setLayout(new FillLayout());
    RootEditPart root = new RootEditPart();
    viewer.setRootEditPart(root);
    viewer.createControl(c);
    // The graphical viewer tool tip processing creates an extra shell which
    // interferes with the PopupDialog's deactivation logic.
    removeMouseListeners(viewer.getControl());
    if (isHighContrast) {
        viewer.getControl().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    } else {
        viewer.getControl().setBackground(ColorConstants.white);
    }
    EditPartFactory editPartFactory = new XSDEditPartFactory(new TypeVizFigureFactory());
    viewer.setEditPartFactory(editPartFactory);
    RootContentEditPart rootContentEditPart = new RootContentEditPart();
    rootContentEditPart.setModel(model);
    viewer.setContents(rootContentEditPart);
    getShell().addControlListener(moveListener);
    return c;
}
Also used : ScrollingGraphicalViewer(org.eclipse.gef.ui.parts.ScrollingGraphicalViewer) Composite(org.eclipse.swt.widgets.Composite) XSDEditPartFactory(org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory) EditPartFactory(org.eclipse.gef.EditPartFactory) FillLayout(org.eclipse.swt.layout.FillLayout) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart) TypeVizFigureFactory(org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.TypeVizFigureFactory) RootEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart) XSDEditPartFactory(org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory)

Example 3 with RootContentEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart in project webtools.sourceediting by eclipse.

the class TopLevelComponentEditPart method performDrillDownAction.

protected void performDrillDownAction() {
    Runnable runnable = new Runnable() {

        public void run() {
            EditPart editPart = ((AbstractEditPartViewer) getViewer()).getRootEditPart().getContents();
            if (editPart instanceof RootContentEditPart) {
                IEditorPart editorPart = getEditorPart();
                // ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class);
                // IAction action = registry.getAction(SetInputToGraphView.ID);
                // action.run();
                ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class);
                if (registry != null) {
                    IAction action = registry.getAction(OpenInNewEditor.ID);
                    if (action != null)
                        action.run();
                    return;
                }
            }
        }
    };
    Display.getCurrent().asyncExec(runnable);
}
Also used : IAction(org.eclipse.jface.action.IAction) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart) BaseEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart) EditPart(org.eclipse.gef.EditPart) INamedEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart) IEditorPart(org.eclipse.ui.IEditorPart) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart) ActionRegistry(org.eclipse.gef.ui.actions.ActionRegistry)

Example 4 with RootContentEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart in project webtools.sourceediting by eclipse.

the class InternalXSDMultiPageEditor method createNavigationLocation.

public INavigationLocation createNavigationLocation() {
    if (getActivePage() == DESIGN_PAGE_INDEX) {
        try {
            RootEditPart rootEditPart = graphicalViewer.getRootEditPart();
            EditPart editPart = rootEditPart.getContents();
            if (editPart instanceof RootContentEditPart) {
                RootContentEditPart rootContentEditPart = (RootContentEditPart) editPart;
                Object input = rootContentEditPart.getInput();
                if (input instanceof Adapter) {
                    XSDConcreteComponent concreteComponent = (XSDConcreteComponent) ((Adapter) input).getTarget();
                    Object object = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ProductCustomizationProvider.class);
                    if (object instanceof ProductCustomizationProvider) {
                        ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider) object;
                        if (productCustomizationProvider != null) {
                            return productCustomizationProvider.getNavigationLocation(this, concreteComponent, rootContentEditPart);
                        }
                    }
                    return new DesignViewNavigationLocation(this, concreteComponent);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    } else {
        return new MultiPageEditorTextSelectionNavigationLocation(getTextEditor(), true);
    }
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) DesignViewNavigationLocation(org.eclipse.wst.xsd.ui.internal.navigation.DesignViewNavigationLocation) RootEditPart(org.eclipse.gef.RootEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart) EObject(org.eclipse.emf.ecore.EObject) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) XSDRedefineAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDRedefineAdapter) INodeAdapter(org.eclipse.wst.sse.core.internal.provisional.INodeAdapter) Adapter(org.eclipse.emf.common.notify.Adapter) CategoryAdapter(org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter) XSDModelAdapter(org.eclipse.wst.xsd.ui.internal.text.XSDModelAdapter) XSDBaseAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter) RedefineCategoryAdapter(org.eclipse.wst.xsd.ui.internal.adapters.RedefineCategoryAdapter) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart) ProductCustomizationProvider(org.eclipse.wst.xsd.ui.internal.adt.editor.ProductCustomizationProvider) MultiPageEditorTextSelectionNavigationLocation(org.eclipse.wst.xsd.ui.internal.navigation.MultiPageEditorTextSelectionNavigationLocation) RootEditPart(org.eclipse.gef.RootEditPart)

Example 5 with RootContentEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart in project webtools.sourceediting by eclipse.

the class DesignViewGraphicalViewer method setInput.

public void setInput(IADTObject object) {
    RootContentEditPart rootContentEditPart = (RootContentEditPart) getRootEditPart().getContents();
    rootContentEditPart.setModel(object);
    rootContentEditPart.refresh();
    if (object != null) {
        inputChangeManager.setSelection(new StructuredSelection(object));
    }
    // Select the editpart when it is set as input
    EditPart editPart = getEditPart(rootContentEditPart, object);
    if (editPart != null)
        select(editPart);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart) IHolderEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IHolderEditPart) StructureEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart) EditPart(org.eclipse.gef.EditPart) RootContentEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart)

Aggregations

RootContentEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart)7 EditPart (org.eclipse.gef.EditPart)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IHolderEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IHolderEditPart)2 StructureEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart)2 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)2 Iterator (java.util.Iterator)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 EObject (org.eclipse.emf.ecore.EObject)1 EditPartFactory (org.eclipse.gef.EditPartFactory)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 RootEditPart (org.eclipse.gef.RootEditPart)1 ActionRegistry (org.eclipse.gef.ui.actions.ActionRegistry)1 ScrollingGraphicalViewer (org.eclipse.gef.ui.parts.ScrollingGraphicalViewer)1 IAction (org.eclipse.jface.action.IAction)1 ISelection (org.eclipse.jface.viewers.ISelection)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 IEditorPart (org.eclipse.ui.IEditorPart)1