Search in sources :

Example 6 with SequenceEditor

use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor in project convertigo by convertigo.

the class ConvertigoPartListener method partClosed.

/* (non-Javadoc)
	 * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
	 */
public void partClosed(IWorkbenchPart part) {
    if (part instanceof ConnectorEditor) {
        // close editor properly
        ((ConnectorEditor) part).close();
    }
    if (part instanceof SequenceEditor) {
        // close editor properly
        ((SequenceEditor) part).close();
    }
    if (part instanceof ProjectExplorerView) {
        // close view properly
        ((ProjectExplorerView) part).close();
    }
    if (part instanceof SourcePickerView) {
        // close view properly
        ((SourcePickerView) part).close();
    }
    if (part instanceof ConsoleView) {
        ConvertigoPlugin convertigoPlugin = ConvertigoPlugin.getDefault();
        boolean shuttingDown = convertigoPlugin.isShuttingDown();
        if (shuttingDown) {
            IConsole[] tabConsoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
            String openedConsoles = "";
            for (IConsole console : tabConsoles) {
                if (console instanceof MessageConsole) {
                    if ((console.equals(convertigoPlugin.engineConsole)) && (openedConsoles.indexOf("engine") == -1))
                        openedConsoles += (openedConsoles.equals("") ? "" : ",") + "engine";
                    else if ((console.equals(convertigoPlugin.stdoutConsole)) && (openedConsoles.indexOf("stdout") == -1))
                        openedConsoles += (openedConsoles.equals("") ? "" : ",") + "stdout";
                }
            }
            ConvertigoPlugin.setProperty(ConvertigoPlugin.PREFERENCE_OPENED_CONSOLES, openedConsoles);
        }
    }
    if (part instanceof EditorPart) {
        IEditorInput input = ((EditorPart) part).getEditorInput();
        if (input instanceof com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput) {
            try {
                com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput acei = GenericUtils.cast(input);
                MobileBuilder mb = acei.getApplication().getProject().getMobileBuilder();
                mb.removeMobileEventListener((com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor) part);
                mb.setAutoBuild(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (input instanceof com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput) {
            try {
                com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput acei = GenericUtils.cast(input);
                MobileBuilder mb = acei.getApplication().getProject().getMobileBuilder();
                mb.removeMobileEventListener((com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditor) part);
                mb.setAutoBuild(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (input instanceof JScriptEditorInput) {
            try {
                ((JScriptEditorInput) input).getFile().getParent().delete(true, null);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (input instanceof com.twinsoft.convertigo.eclipse.editors.mobile.ComponentFileEditorInput) {
            try {
                ((com.twinsoft.convertigo.eclipse.editors.mobile.ComponentFileEditorInput) input).getFile().delete(true, null);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (input instanceof com.twinsoft.convertigo.eclipse.editors.ngx.ComponentFileEditorInput) {
            try {
                ((com.twinsoft.convertigo.eclipse.editors.ngx.ComponentFileEditorInput) input).getFile().delete(true, null);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : SourcePickerView(com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView) JScriptEditorInput(com.twinsoft.convertigo.eclipse.editors.jscript.JScriptEditorInput) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) MessageConsole(org.eclipse.ui.console.MessageConsole) ConsoleView(org.eclipse.ui.internal.console.ConsoleView) SequenceEditor(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor) IConsole(org.eclipse.ui.console.IConsole) EditorPart(org.eclipse.ui.part.EditorPart) MobileBuilder(com.twinsoft.convertigo.engine.mobile.MobileBuilder) IEditorInput(org.eclipse.ui.IEditorInput)

Aggregations

SequenceEditor (com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor)6 Sequence (com.twinsoft.convertigo.beans.core.Sequence)4 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)4 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)4 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)4 ConnectorEditor (com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor)3 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)3 Cursor (org.eclipse.swt.graphics.Cursor)3 Display (org.eclipse.swt.widgets.Display)3 Shell (org.eclipse.swt.widgets.Shell)3 Transaction (com.twinsoft.convertigo.beans.core.Transaction)2 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)2 UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)2 IEditorInput (org.eclipse.ui.IEditorInput)2 Connector (com.twinsoft.convertigo.beans.core.Connector)1 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)1 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)1 TestCase (com.twinsoft.convertigo.beans.core.TestCase)1 JScriptEditorInput (com.twinsoft.convertigo.eclipse.editors.jscript.JScriptEditorInput)1 SequenceEditorInput (com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditorInput)1