Search in sources :

Example 1 with ComponentObjectWizard

use of com.twinsoft.convertigo.eclipse.wizards.new_mobile.ComponentObjectWizard in project convertigo by convertigo.

the class MobileComponentCreateAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        int folderType = -1;
        TreeObject parentTreeObject = null;
        DatabaseObject databaseObject = null;
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            parentTreeObject = explorerView.getFirstSelectedTreeObject();
            if (parentTreeObject instanceof ObjectsFolderTreeObject) {
                ObjectsFolderTreeObject folderTreeObject = (ObjectsFolderTreeObject) parentTreeObject;
                folderType = folderTreeObject.folderType;
                parentTreeObject = folderTreeObject.getParent();
                databaseObject = (DatabaseObject) parentTreeObject.getObject();
            } else {
                databaseObject = (DatabaseObject) parentTreeObject.getObject();
            }
            ComponentObjectWizard newObjectWizard = new ComponentObjectWizard(databaseObject, databaseObjectClassName, folderType);
            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();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) Cursor(org.eclipse.swt.graphics.Cursor) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) WizardDialog(org.eclipse.jface.wizard.WizardDialog) Display(org.eclipse.swt.widgets.Display) ComponentObjectWizard(com.twinsoft.convertigo.eclipse.wizards.new_mobile.ComponentObjectWizard)

Aggregations

DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)1 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)1 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)1 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)1 ComponentObjectWizard (com.twinsoft.convertigo.eclipse.wizards.new_mobile.ComponentObjectWizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Cursor (org.eclipse.swt.graphics.Cursor)1 Display (org.eclipse.swt.widgets.Display)1 Shell (org.eclipse.swt.widgets.Shell)1