Search in sources :

Example 1 with XSDEditor

use of com.amalto.workbench.editors.xsdeditor.XSDEditor in project tmdm-studio-se by Talend.

the class ComplexTypeWrapper method changeTypeName.

public boolean changeTypeName() {
    if (curXSDComplexType.getName().equals(newTypeName))
        return false;
    curXSDComplexType.setName(newTypeName);
    curXSDComplexType.updateElement();
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart activeEditor = activePage.getActiveEditor();
    if (activeEditor instanceof XSDEditor) {
        XSDEditor editor = (XSDEditor) activeEditor;
        DataModelMainPage page = editor.getdMainPage();
        IStructuredContentProvider provider = (IStructuredContentProvider) page.getSchemaContentProvider();
        Util.updateReferenceToXSDTypeDefinition(page.getSite(), curXSDComplexType, provider);
    }
    return true;
}
Also used : XSDEditor(com.amalto.workbench.editors.xsdeditor.XSDEditor) DataModelMainPage(com.amalto.workbench.editors.DataModelMainPage) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 2 with XSDEditor

use of com.amalto.workbench.editors.xsdeditor.XSDEditor in project tmdm-studio-se by Talend.

the class SimpleTypeWrapper method changeTypeName.

public boolean changeTypeName() {
    if (getNewTypeName().trim().equals(getOldTypeName()))
        return false;
    xsdSimpleType.setName(getNewTypeName().trim());
    xsdSimpleType.updateElement();
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart activeEditor = activePage.getActiveEditor();
    if (activeEditor instanceof XSDEditor) {
        XSDEditor editor = (XSDEditor) activeEditor;
        DataModelMainPage page = editor.getdMainPage();
        IStructuredContentProvider provider = (IStructuredContentProvider) page.getSchemaContentProvider();
        Util.updateReferenceToXSDTypeDefinition(page.getSite(), xsdSimpleType, provider);
    }
    return true;
}
Also used : XSDEditor(com.amalto.workbench.editors.xsdeditor.XSDEditor) DataModelMainPage(com.amalto.workbench.editors.DataModelMainPage) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 3 with XSDEditor

use of com.amalto.workbench.editors.xsdeditor.XSDEditor in project tmdm-studio-se by Talend.

the class DataModelMainPage method gotoMarker.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.ide.IGotoMarker#gotoMarker(org.eclipse.core.resources.IMarker)
     */
public void gotoMarker(IMarker marker) {
    MultiPageEditorSite site = (MultiPageEditorSite) getEditorSite();
    MultiPageEditorPart part = site.getMultiPageEditor();
    int activePage = part.getActivePage();
    try {
        String type = marker.getType();
        if (type.equals(MARKER_XSD_ERR) || activePage == 1) {
            ((XSDEditor) part).gotoMarker(marker);
            return;
        } else if (type.equals(MARKER_DATA_MODEL)) {
            boolean openInSource = marker.getAttribute(OPEN_IN_SOURCE, false);
            if (openInSource) {
                marker.setAttribute(OPEN_IN_SOURCE, false);
                ((XSDEditor) part).gotoMarker(marker);
                return;
            }
            Object domElement = marker.getAttribute(DOM_ELEMENT);
            Integer msgGroup = (Integer) marker.getAttribute(MSG_GROUP);
            if (domElement != null && msgGroup != null) {
                switch(msgGroup) {
                    case MSG_GROUP_TYPE:
                        activeMarkerItem(typesViewer, (Element) domElement);
                        break;
                    case MSG_GROUP_ELEMENT:
                    case MSG_GROUP_ENTITY:
                        activeMarkerItem(viewer, (Element) domElement);
                        break;
                    default:
                        break;
                }
            }
        }
    } catch (CoreException e) {
        log.error(e.getMessage(), e);
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) XSDEditor(com.amalto.workbench.editors.xsdeditor.XSDEditor) Element(org.w3c.dom.Element) MultiPageEditorPart(org.eclipse.ui.part.MultiPageEditorPart) TreeObject(com.amalto.workbench.models.TreeObject) MultiPageEditorSite(org.eclipse.ui.part.MultiPageEditorSite)

Example 4 with XSDEditor

use of com.amalto.workbench.editors.xsdeditor.XSDEditor in project tmdm-studio-se by Talend.

the class ElementWrapperCommitHandler method getPage.

private DataModelMainPage getPage() {
    IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (activeEditor instanceof XSDEditor) {
        XSDEditor xsdEditor = (XSDEditor) activeEditor;
        DataModelMainPage page = xsdEditor.getdMainPage();
        return page;
    }
    return null;
}
Also used : XSDEditor(com.amalto.workbench.editors.xsdeditor.XSDEditor) DataModelMainPage(com.amalto.workbench.editors.DataModelMainPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 5 with XSDEditor

use of com.amalto.workbench.editors.xsdeditor.XSDEditor in project tmdm-studio-se by Talend.

the class Util method getXSDSchemaOfDirtyEditor.

public static XSDSchema getXSDSchemaOfDirtyEditor(String dataModelName) {
    XSDSchema xsd = null;
    IEditorPart[] editors = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getDirtyEditors();
    if (null != editors) {
        for (IEditorPart editorpart : editors) {
            if (editorpart instanceof XSDEditor) {
                XSDEditor xeditor = (XSDEditor) editorpart;
                DataModelMainPage mainPage = xeditor.getdMainPage();
                if (mainPage.getDataModel().getName().equals(dataModelName)) {
                    xsd = mainPage.getXSDSchema();
                    break;
                }
            }
        }
    }
    return xsd;
}
Also used : XSDEditor(com.amalto.workbench.editors.xsdeditor.XSDEditor) DataModelMainPage(com.amalto.workbench.editors.DataModelMainPage) IEditorPart(org.eclipse.ui.IEditorPart) XSDSchema(org.eclipse.xsd.XSDSchema)

Aggregations

XSDEditor (com.amalto.workbench.editors.xsdeditor.XSDEditor)5 DataModelMainPage (com.amalto.workbench.editors.DataModelMainPage)4 IEditorPart (org.eclipse.ui.IEditorPart)4 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 TreeObject (com.amalto.workbench.models.TreeObject)1 CoreException (org.eclipse.core.runtime.CoreException)1 MultiPageEditorPart (org.eclipse.ui.part.MultiPageEditorPart)1 MultiPageEditorSite (org.eclipse.ui.part.MultiPageEditorSite)1 XSDSchema (org.eclipse.xsd.XSDSchema)1 Element (org.w3c.dom.Element)1