Search in sources :

Example 1 with ViewBrowserInput

use of org.talend.mdm.repository.ui.editors.ViewBrowserInput in project tmdm-studio-se by Talend.

the class BrowseViewAction method doRun.

@Override
protected void doRun() {
    Object obj = getSelectedObject().get(0);
    if (obj instanceof IRepositoryViewObject) {
        IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
        WSViewItem item = (WSViewItem) viewObject.getProperty().getItem();
        WSViewE wsView = item.getWsView();
        MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
        SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
        dlg.create();
        dlg.setSelectServer(lastServerDef);
        if (dlg.open() == IDialogConstants.OK_ID) {
            ViewBrowserInput input = new ViewBrowserInput(viewObject);
            input.setServerDef(dlg.getSelectedServerDef());
            if (page == null) {
                page = commonViewer.getCommonNavigator().getSite().getWorkbenchWindow().getActivePage();
            }
            try {
                IEditorPart oldEditor = page.findEditor(input);
                if (oldEditor != null) {
                    page.closeEditor(oldEditor, false);
                }
                page.openEditor(input, XObjectBrowser2.EDITOR_ID);
            } catch (PartInitException e) {
                log.error(e.getMessage(), e);
            }
        }
    }
}
Also used : WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) ViewBrowserInput(org.talend.mdm.repository.ui.editors.ViewBrowserInput) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Aggregations

IEditorPart (org.eclipse.ui.IEditorPart)1 PartInitException (org.eclipse.ui.PartInitException)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 WSViewItem (org.talend.mdm.repository.model.mdmproperties.WSViewItem)1 WSViewE (org.talend.mdm.repository.model.mdmserverobject.WSViewE)1 ViewBrowserInput (org.talend.mdm.repository.ui.editors.ViewBrowserInput)1 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)1