Search in sources :

Example 1 with XObjectBrowser

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

the class ImportItemsWizard method closeOpenEditors.

private void closeOpenEditors() {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    int length = page.getEditors().length;
    String tabEndpointAddress = Messages.ImportItemsWizard_3;
    String unserName = null;
    int j = 0;
    for (int i = 0; i < length; i++) {
        IEditorPart part = page.getEditors()[i - j];
        if (part instanceof XObjectBrowser) {
            TreeObject obj = (TreeObject) ((XObjectBrowserInput) part.getEditorInput()).getModel();
            if (obj != null) {
                tabEndpointAddress = obj.getEndpointAddress();
                unserName = obj.getUsername();
            }
        } else if (part instanceof XObjectEditor) {
            TreeObject obj = (TreeObject) ((XObjectEditorInput) part.getEditorInput()).getModel();
            if (obj != null) {
                tabEndpointAddress = obj.getEndpointAddress();
                unserName = obj.getUsername();
            }
        }
        if (serverRoot != null) {
            if (serverRoot.getEndpointAddress().equals(tabEndpointAddress) && serverRoot.getUsername().equals(unserName)) {
                if (part.isDirty() && isSaveModifiedEditor(part.getTitle())) {
                    part.doSave(new NullProgressMonitor());
                }
                page.closeEditor(part, false);
                j++;
            }
        }
    }
}
Also used : XObjectBrowser(com.amalto.workbench.editors.XObjectBrowser) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) TreeObject(com.amalto.workbench.models.TreeObject) XObjectEditorInput(com.amalto.workbench.providers.XObjectEditorInput) IEditorPart(org.eclipse.ui.IEditorPart) XObjectEditor(com.amalto.workbench.editors.XObjectEditor)

Aggregations

XObjectBrowser (com.amalto.workbench.editors.XObjectBrowser)1 XObjectEditor (com.amalto.workbench.editors.XObjectEditor)1 TreeObject (com.amalto.workbench.models.TreeObject)1 XObjectEditorInput (com.amalto.workbench.providers.XObjectEditorInput)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1