use of com.twinsoft.convertigo.eclipse.wizards.new_ngx.SharedComponentWizard in project convertigo by convertigo.
the class NgxSharedComponentExtractAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
DatabaseObjectTreeObject firstSelectedDoTo = GenericUtils.cast(explorerView.getFirstSelectedTreeObject());
DatabaseObjectTreeObject parentTreeObject = firstSelectedDoTo.getParentDatabaseObjectTreeObject();
TreeObject appTo = getAppTreeObject(firstSelectedDoTo);
if (appTo == null) {
throw new Exception("Unable to retrieve target application");
}
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
List<DatabaseObject> objectList = GenericUtils.cast(Arrays.asList(explorerView.getSelectedDatabaseObjects()));
SharedComponentWizard newObjectWizard = new SharedComponentWizard(objectList);
WizardDialog wzdlg = new WizardDialog(shell, newObjectWizard);
wzdlg.setPageSize(850, 650);
wzdlg.open();
int result = wzdlg.getReturnCode();
if ((result != Window.CANCEL) && (newObjectWizard.newBean != null)) {
for (TreeObject to : treeObjects) {
if (((DatabaseObject) to.getObject()).getParent() == null) {
parentTreeObject.removeChild(firstSelectedDoTo);
}
}
explorerView.reloadTreeObject(appTo);
explorerView.objectSelected(new CompositeEvent(newObjectWizard.newBean));
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create a new shared component!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations