use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class ImportWizard method performFinish.
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
public boolean performFinish() {
ProjectExplorerView explorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
ProjectUrlParser parser = fileChooserPage.getParser();
String filePath = fileChooserPage.getFilePath();
if (parser.isValid()) {
ConvertigoPlugin.infoMessageBox("Loading " + parser.getProjectName() + " in a background job.");
Job.create("Import project " + parser.getProjectName(), (mon) -> {
try {
Project project = Engine.theApp.referencedProjectManager.importProject(parser, true);
if (project != null) {
TreeObject tree = explorerView.getProjectRootObject(project.getName());
if (tree != null) {
explorerView.reloadProject(tree);
}
explorerView.refreshProjects();
}
} catch (Exception e) {
Engine.logStudio.debug("Loading from remote URL failed", e);
}
}).schedule();
}
try {
if (explorerView != null) {
if (filePath != null) {
explorerView.importProject(filePath, getTargetProjectName());
}
}
} catch (Exception e) {
ConvertigoPlugin.logException(e, "Unable to import project !");
}
return true;
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class DeleteDesignDocumentFunctionAction 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) {
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
if (treeObjects != null) {
HashSet<TreeParent> treeParentToReload = new HashSet<TreeParent>();
HashSet<TreeParent> treeParentToRefresh = new HashSet<TreeParent>();
int len = treeObjects.length;
for (int i = 0; i < len; i++) {
try {
DesignDocumentFunctionTreeObject ddfto = (DesignDocumentFunctionTreeObject) treeObjects[i];
if (ddfto != null) {
MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
String message = java.text.MessageFormat.format("Do you really want to delete the object \"{0}\" and all its sub-objects?", new Object[] { ddfto.getName() });
messageBox.setMessage(message);
if (messageBox.open() == SWT.YES) {
TreeParent owner = ddfto.getTreeObjectOwner();
IDesignTreeObject dto = ddfto.getParentDesignTreeObject();
if (dto != null) {
dto.remove(ddfto);
}
if (owner != null) {
if (owner instanceof DatabaseObjectTreeObject) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) owner;
if (databaseObjectTreeObject.hasChanged()) {
TreeParent treeParent = databaseObjectTreeObject.getParent();
if (treeParent instanceof FolderTreeObject)
treeParent = treeParent.getParent();
treeParentToReload.add(treeParent);
}
} else
treeParentToRefresh.add(owner);
}
}
}
} catch (ClassCastException e) {
}
}
for (TreeParent treeParent : treeParentToReload) {
explorerView.reloadTreeObject(treeParent);
}
for (TreeParent owner : treeParentToRefresh) {
explorerView.refreshTreeObject(owner, true);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to delete function!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class DeleteDesignDocumentViewAction 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) {
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
if (treeObjects != null) {
HashSet<TreeParent> treeParentToReload = new HashSet<TreeParent>();
HashSet<TreeParent> treeParentToRefresh = new HashSet<TreeParent>();
int len = treeObjects.length;
for (int i = 0; i < len; i++) {
try {
DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject) treeObjects[i];
if (ddvto != null) {
MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
String message = java.text.MessageFormat.format("Do you really want to delete the object \"{0}\" and all its sub-objects?", new Object[] { ddvto.getName() });
messageBox.setMessage(message);
if (messageBox.open() == SWT.YES) {
DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) ddvto.getParent().getParent();
if (ddto != null) {
TreeParent owner = ddto;
ddto.removeView(ddvto);
if (owner instanceof DatabaseObjectTreeObject) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) owner;
if (databaseObjectTreeObject.hasChanged()) {
TreeParent treeParent = databaseObjectTreeObject.getParent();
if (treeParent instanceof FolderTreeObject)
treeParent = treeParent.getParent();
treeParentToReload.add(treeParent);
}
} else
treeParentToRefresh.add(owner);
}
}
}
} catch (ClassCastException e) {
}
}
for (TreeParent treeParent : treeParentToReload) {
explorerView.reloadTreeObject(treeParent);
}
for (TreeParent owner : treeParentToRefresh) {
explorerView.refreshTreeObject(owner, true);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to delete view!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class DeletePropertyTableColumnAction 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) {
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
if (treeObjects != null) {
HashSet<TreeParent> treeParentToReload = new HashSet<TreeParent>();
HashSet<TreeParent> treeParentToRefresh = new HashSet<TreeParent>();
int len = treeObjects.length;
for (int i = 0; i < len; i++) {
try {
PropertyTableColumnTreeObject propertyTableColumnTreeObject = (PropertyTableColumnTreeObject) treeObjects[i];
if (propertyTableColumnTreeObject != null) {
MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
String message = java.text.MessageFormat.format("Do you really want to delete the object \"{0}\" and all its sub-objects?", new Object[] { propertyTableColumnTreeObject.getName() });
messageBox.setMessage(message);
if (messageBox.open() == SWT.YES) {
PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) propertyTableColumnTreeObject.getParent();
TreeParent owner = propertyTableRowTreeObject.getParent().getParent();
propertyTableRowTreeObject.removeColumn(propertyTableColumnTreeObject);
if (owner instanceof DatabaseObjectTreeObject) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) owner;
if (databaseObjectTreeObject.hasChanged()) {
TreeParent treeParent = databaseObjectTreeObject.getParent();
if (treeParent instanceof FolderTreeObject)
treeParent = treeParent.getParent();
treeParentToReload.add(treeParent);
}
} else
treeParentToRefresh.add(owner);
}
}
} catch (ClassCastException e) {
}
}
for (TreeParent treeParent : treeParentToReload) {
explorerView.reloadTreeObject(treeParent);
}
for (TreeParent owner : treeParentToRefresh) {
explorerView.refreshTreeObject(owner, true);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to delete column!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject in project convertigo by convertigo.
the class DeletePropertyTableRowAction 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) {
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
if (treeObjects != null) {
HashSet<TreeParent> treeParentToReload = new HashSet<TreeParent>();
HashSet<TreeParent> treeParentToRefresh = new HashSet<TreeParent>();
int len = treeObjects.length;
for (int i = 0; i < len; i++) {
try {
PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) treeObjects[i];
if (propertyTableRowTreeObject != null) {
MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
String message = java.text.MessageFormat.format("Do you really want to delete the object \"{0}\" and all its sub-objects?", new Object[] { propertyTableRowTreeObject.getName() });
messageBox.setMessage(message);
if (messageBox.open() == SWT.YES) {
PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) propertyTableRowTreeObject.getParent();
TreeParent owner = propertyTableTreeObject.getParent();
propertyTableTreeObject.removeRow(propertyTableRowTreeObject);
if (owner instanceof DatabaseObjectTreeObject) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) owner;
if (databaseObjectTreeObject.hasChanged()) {
TreeParent treeParent = databaseObjectTreeObject.getParent();
if (treeParent instanceof FolderTreeObject)
treeParent = treeParent.getParent();
treeParentToReload.add(treeParent);
}
} else
treeParentToRefresh.add(owner);
}
}
} catch (ClassCastException e) {
}
}
for (TreeParent treeParent : treeParentToReload) {
explorerView.reloadTreeObject(treeParent);
}
for (TreeParent owner : treeParentToRefresh) {
explorerView.refreshTreeObject(owner, true);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to delete row!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations