Search in sources :

Example 1 with TopLevelComponentEditPart

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

the class XSDBaseAction method doEdit.

protected void doEdit(Object obj, IWorkbenchPart part) {
    if (obj instanceof TopLevelComponentEditPart) {
        TopLevelComponentEditPart editPart = (TopLevelComponentEditPart) obj;
        if (addedComponent == ((XSDBaseAdapter) editPart.getModel()).getTarget()) {
            editPart.setScroll(true);
            editPart.addFeedback();
            editPart.doEditName(!(part instanceof ContentOutline));
        }
    } else if (obj instanceof BaseFieldEditPart) {
        BaseFieldEditPart editPart = (BaseFieldEditPart) obj;
        editPart.doEditName(!(part instanceof ContentOutline));
    } else if (obj instanceof IAutoDirectEdit) {
        ((IAutoDirectEdit) obj).doEditName(!(part instanceof ContentOutline));
    }
}
Also used : IAutoDirectEdit(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IAutoDirectEdit) ContentOutline(org.eclipse.ui.views.contentoutline.ContentOutline) TopLevelComponentEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TopLevelComponentEditPart) BaseFieldEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart)

Example 2 with TopLevelComponentEditPart

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

the class TopLevelNameDirectEditManager method bringDown.

/**
 * @see org.eclipse.gef.tools.DirectEditManager#bringDown()
 */
protected void bringDown() {
    if (actionHandler != null) {
        actionHandler.dispose();
        actionHandler = null;
    }
    if (actionBars != null) {
        restoreSavedActions(actionBars);
        actionBars.updateActionBars();
        actionBars = null;
    }
    Font disposeFont = scaledFont;
    scaledFont = null;
    super.bringDown();
    if (disposeFont != null)
        disposeFont.dispose();
    if (getEditPart() instanceof TopLevelComponentEditPart) {
        Runnable runnable = new Runnable() {

            public void run() {
                IWorkbench workbench = PlatformUI.getWorkbench();
                IEditorPart editor = workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
                Object adapter = editor.getAdapter(ISelectionProvider.class);
                if (adapter instanceof ISelectionProvider) {
                    ISelectionProvider sel = (ISelectionProvider) adapter;
                    sel.setSelection(new StructuredSelection(getEditPart().getModel()));
                }
            }
        };
        Display.getCurrent().asyncExec(runnable);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) TopLevelComponentEditPart(org.eclipse.wst.xsd.ui.internal.design.editparts.TopLevelComponentEditPart) IEditorPart(org.eclipse.ui.IEditorPart) Font(org.eclipse.swt.graphics.Font)

Aggregations

TopLevelComponentEditPart (org.eclipse.wst.xsd.ui.internal.design.editparts.TopLevelComponentEditPart)2 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 Font (org.eclipse.swt.graphics.Font)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbench (org.eclipse.ui.IWorkbench)1 ContentOutline (org.eclipse.ui.views.contentoutline.ContentOutline)1 BaseFieldEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart)1 IAutoDirectEdit (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IAutoDirectEdit)1