use of com.amalto.workbench.providers.XObjectEditorInput in project tmdm-studio-se by Talend.
the class AddBrowseItemsWizard method refreshEditorContent.
private boolean refreshEditorContent(TreeObject obj) {
IEditorInput xobjectEditorinput = new XObjectEditorInput(obj, obj.getDisplayName());
final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart currentEditor = activePage.findEditor(xobjectEditorinput);
if (currentEditor != null) {
List<IEditorPart> editors = Arrays.asList(activePage.getDirtyEditors());
activePage.closeEditor(currentEditor, false);
if (editors.contains(currentEditor)) {
return true;
}
}
return false;
}
use of com.amalto.workbench.providers.XObjectEditorInput in project tmdm-studio-se by Talend.
the class EditXObjectAction method run.
@Override
public void run() {
try {
super.run();
if (xobject == null || !xobject.isXObject()) {
return;
}
// Access to server and get port
TMDMService service = Util.getMDMService(new URL(xobject.getEndpointAddress()), xobject.getUsername(), xobject.getPassword());
switch(xobject.getType()) {
case TreeObject.DATA_MODEL:
WSDataModel wsDataModel = service.getDataModel(new WSGetDataModel((WSDataModelPK) xobject.getWsKey()));
xobject.setWsObject(wsDataModel);
// XSDEditorUtil.openDataModel(xobject, false);
return;
case TreeObject.VIEW:
WSView wsView = service.getView(new WSGetView((WSViewPK) xobject.getWsKey()));
xobject.setWsObject(wsView);
break;
case TreeObject.DATA_CLUSTER:
WSDataCluster wsDataCluster = service.getDataCluster(new WSGetDataCluster((WSDataClusterPK) xobject.getWsKey()));
xobject.setWsObject(wsDataCluster);
break;
case TreeObject.STORED_PROCEDURE:
WSStoredProcedure wsStoredProcedure = service.getStoredProcedure(new WSGetStoredProcedure((WSStoredProcedurePK) xobject.getWsKey()));
xobject.setWsObject(wsStoredProcedure);
break;
case TreeObject.ROUTING_RULE:
WSRoutingRule wsRoutingRule = service.getRoutingRule(new WSGetRoutingRule((WSRoutingRulePK) xobject.getWsKey()));
xobject.setWsObject(wsRoutingRule);
break;
case TreeObject.TRANSFORMER:
WSTransformerV2 wsTranformer = service.getTransformerV2(new WSGetTransformerV2((WSTransformerV2PK) xobject.getWsKey()));
xobject.setWsObject(wsTranformer);
break;
case TreeObject.MENU:
WSMenu wsMenu = service.getMenu(new WSGetMenu((WSMenuPK) xobject.getWsKey()));
xobject.setWsObject(wsMenu);
break;
case TreeObject.SERVICE_CONFIGURATION:
break;
case TreeObject.JOB_REGISTRY:
// System.out.println("JOB_REGISTRY "+ xobject.getDisplayName());
break;
case TreeObject.JOB:
// System.out.println("JOB "+ xobject.getDisplayName()+" "+xobject.getWsKey());
xobject.setWsObject(xobject.getDisplayName());
break;
case TreeObject.ROLE:
if (exAdapter != null) {
exAdapter.run(service, xobject);
}
break;
case TreeObject.RESOURCES:
case TreeObject.CUSTOM_TYPE:
case TreeObject.DATA_MODEL_RESOURCE:
case TreeObject.DATA_MODEL_TYPES_RESOURCE:
case TreeObject.CUSTOM_TYPES_RESOURCE:
case TreeObject.PICTURES_RESOURCE:
break;
default:
MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.EditXObjectAction_ErrorMsg1, IConstants.TALEND, xobject.getType()));
return;
}
if (page == null) {
this.page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
}
this.page.openEditor(new XObjectEditorInput(xobject, xobject.getDisplayName()), // $NON-NLS-1$
"com.amalto.workbench.editors.XObjectEditor");
} catch (Exception e) {
log.error(e.getMessage(), e);
if (!Util.handleConnectionException(getShell(), e, Messages.EditXObjectAction_ErrorMsg2)) {
MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.EditXObjectAction_ErrorMsg2, e.getLocalizedMessage()));
}
}
}
use of com.amalto.workbench.providers.XObjectEditorInput 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++;
}
}
}
}
use of com.amalto.workbench.providers.XObjectEditorInput in project tmdm-studio-se by Talend.
the class AddBrowseItemsWizard method newBrowseItemView.
protected void newBrowseItemView(String browseItem) {
for (XSDElementDeclaration decl : declList) {
String fullName = BROWSE_ITEMS + decl.getName();
if (fullName.equals(browseItem)) {
TreeParent serverRoot = page.getXObject().getServerRoot();
TreeParent serverFolder = serverRoot.findServerFolder(TreeObject.VIEW);
TreeObject obj = serverFolder.findObject(TreeObject.VIEW, browseItem);
if (obj != null) {
IEditorInput xobjectEditorinput = new XObjectEditorInput(obj, obj.getDisplayName());
final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart currentEditor = activePage.findEditor(xobjectEditorinput);
if (currentEditor != null) {
// editor is opened
if (MessageDialog.openConfirm(this.getShell(), Messages.Warning, Messages.AddBrowseItemsWizard_DuplicatedView)) {
refreshEditorContent(obj);
} else {
break;
}
}
}
obj = createNewTreeObject(decl, browseItem);
TreeParent folder = obj.findServerFolder(obj.getType());
folder.addChild(obj);
}
}
}
Aggregations