use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class ClipboardPasteAction 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();
TreeObject selectedTreeObject = explorerView.getFirstSelectedTreeObject();
String source = null;
if (!clipboardManager.isCut) {
Clipboard clipboard = new Clipboard(display);
TextTransfer textTransfer = TextTransfer.getInstance();
source = (String) clipboard.getContents(textTransfer);
clipboard.dispose();
}
if (explorerView.isEditing()) {
explorerView.setEditingText(source);
} else
paste(source, shell, explorerView, selectedTreeObject);
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to paste!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class CreateDesignDocumentFilterAction 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) {
DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) explorerView.getFirstSelectedTreeObject();
DesignDocumentFilterTreeObject ddfto = ddto.addNewFilter();
if (ddto.hasChanged()) {
TreeParent treeParent = ddto.getParent();
if (treeParent instanceof FolderTreeObject)
treeParent = treeParent.getParent();
explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), ddfto.getPath()));
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create a new filter!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class CreateDesignDocumentValidateAction 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) {
DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) explorerView.getFirstSelectedTreeObject();
DesignDocumentValidateTreeObject ddvto = ddto.addNewValidate();
if (ddto.hasChanged()) {
TreeParent treeParent = ddto.getParent();
if (treeParent instanceof FolderTreeObject)
treeParent = treeParent.getParent();
explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), ddvto.getPath()));
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create a new Validate!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class DatabaseObjectCreateAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
TreeObject parentTreeObject = null;
DatabaseObject databaseObject = null;
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
parentTreeObject = explorerView.getFirstSelectedTreeObject();
if (parentTreeObject instanceof ObjectsFolderTreeObject) {
parentTreeObject = ((ObjectsFolderTreeObject) parentTreeObject).getParent();
databaseObject = (DatabaseObject) parentTreeObject.getObject();
} else {
databaseObject = (DatabaseObject) parentTreeObject.getObject();
}
NewObjectWizard newObjectWizard = new NewObjectWizard(databaseObject, databaseObjectClassName);
WizardDialog wzdlg = new WizardDialog(shell, newObjectWizard);
wzdlg.setPageSize(850, 650);
wzdlg.open();
int result = wzdlg.getReturnCode();
if ((result != Window.CANCEL) && (newObjectWizard.newBean != null)) {
postCreate(parentTreeObject, newObjectWizard.newBean);
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create a new database object '" + databaseObjectClassName + "'!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class DatabaseObjectIncreasePriorityAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
treeNodesToUpdate = new ArrayList<TreeParent>();
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
String[] selectedPaths = new String[treeObjects.length];
if (treeObjects != null) {
// Increase priority
TreeObject treeObject = null;
for (int i = 0; i < treeObjects.length; i++) {
treeObject = treeObjects[i];
selectedPaths[i] = treeObject.getPath();
increasePriority(treeObject);
}
// Updating the tree and the properties panel
Enumeration<TreeParent> enumeration = Collections.enumeration(treeNodesToUpdate);
TreeParent parentTreeObject = null;
while (enumeration.hasMoreElements()) {
parentTreeObject = enumeration.nextElement();
explorerView.reloadTreeObject(parentTreeObject);
}
// Restore selection
TreeObjectEvent treeObjectEvent;
for (int i = 0; i < selectedPaths.length; i++) {
String previousPath = selectedPaths[i];
treeObject = explorerView.findTreeObjectByPath(parentTreeObject, previousPath);
if (treeObject != null) {
treeObjects[i] = treeObject;
treeObjectEvent = new TreeObjectEvent(treeObject);
explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
}
}
explorerView.setSelectedTreeObjects(treeObjects);
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to increase priority!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations