Search in sources :

Example 31 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent in project convertigo by convertigo.

the class NgxComponentCreateAction method postCreate.

public void postCreate(TreeObject parentTreeObject, DatabaseObject createdDatabaseObject) throws Exception {
    ProjectExplorerView explorerView = getProjectExplorerView();
    explorerView.reloadTreeObject(parentTreeObject);
    explorerView.objectSelected(new CompositeEvent(createdDatabaseObject));
/* No more needed since #20 correction : see DatabaseObjectTreeObject:setParent(TreeParent parent)
		TreeObject selectedTreeObject = explorerView.getFirstSelectedTreeObject();
		if ((selectedTreeObject != null) && (selectedTreeObject.getObject().equals(createdDatabaseObject)))
			explorerView.fireTreeObjectAdded(new TreeObjectEvent(selectedTreeObject));*/
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent)

Example 32 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent 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();
    }
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) SharedComponentWizard(com.twinsoft.convertigo.eclipse.wizards.new_ngx.SharedComponentWizard) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) WizardDialog(org.eclipse.jface.wizard.WizardDialog) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display)

Example 33 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent in project convertigo by convertigo.

the class MobileSharedComponentExtractAction 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();
    }
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) SharedComponentWizard(com.twinsoft.convertigo.eclipse.wizards.new_mobile.SharedComponentWizard) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) WizardDialog(org.eclipse.jface.wizard.WizardDialog) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display)

Aggregations

CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)33 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)19 Shell (org.eclipse.swt.widgets.Shell)18 Cursor (org.eclipse.swt.graphics.Cursor)17 Display (org.eclipse.swt.widgets.Display)17 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)10 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)10 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)10 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)9 FolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject)9 WizardDialog (org.eclipse.jface.wizard.WizardDialog)7 HtmlScreenClass (com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass)5 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)5 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)5 Transaction (com.twinsoft.convertigo.beans.core.Transaction)4 NewObjectWizard (com.twinsoft.convertigo.eclipse.wizards.new_object.NewObjectWizard)4 File (java.io.File)4 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)3 Sequence (com.twinsoft.convertigo.beans.core.Sequence)3 Step (com.twinsoft.convertigo.beans.core.Step)3