Search in sources :

Example 1 with ApplicationComponentEditor

use of com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor in project convertigo by convertigo.

the class MobileApplicationComponentTreeObject method activeEditor.

public ApplicationComponentEditor activeEditor(boolean autoLaunch) {
    ApplicationComponentEditor editorPart = null;
    ApplicationComponent application = (ApplicationComponent) getObject();
    synchronized (application) {
        String tpl = application.getTplProjectName();
        try {
            if (StringUtils.isBlank(tpl) || Engine.theApp.databaseObjectsManager.getOriginalProjectByName(tpl, false) == null) {
                throw new InvalidParameterException("The value '" + tpl + "' of the property 'Template project' from '" + application.getQName() + "' is incorrect.");
            }
            IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
            if (activePage != null) {
                IEditorReference[] editorRefs = activePage.getEditorReferences();
                for (int i = 0; i < editorRefs.length; i++) {
                    IEditorReference editorRef = (IEditorReference) editorRefs[i];
                    try {
                        IEditorInput editorInput = editorRef.getEditorInput();
                        if ((editorInput != null) && (editorInput instanceof ApplicationComponentEditorInput)) {
                            if (((ApplicationComponentEditorInput) editorInput).is(application)) {
                                editorPart = (ApplicationComponentEditor) editorRef.getEditor(false);
                            }
                        }
                    } catch (PartInitException e) {
                    }
                }
                if (editorPart != null) {
                    activePage.activate(editorPart);
                } else {
                    IEditorPart editor = activePage.openEditor(new ApplicationComponentEditorInput(application, autoLaunch), "com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor");
                    if (editor instanceof ApplicationComponentEditor) {
                        editorPart = (ApplicationComponentEditor) editor;
                    } else {
                        ConvertigoPlugin.logWarning("The Application Component Editor won't open, please see the error log.");
                    }
                }
            }
        } catch (Exception e) {
            ConvertigoPlugin.logException(e, "Error while loading the page editor '" + application.getName() + "'");
        }
    }
    return editorPart;
}
Also used : ApplicationComponent(com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) ApplicationComponentEditor(com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor) IEditorPart(org.eclipse.ui.IEditorPart) InvalidParameterException(java.security.InvalidParameterException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) EngineException(com.twinsoft.convertigo.engine.EngineException) InvalidParameterException(java.security.InvalidParameterException) IEditorReference(org.eclipse.ui.IEditorReference) ApplicationComponentEditorInput(com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) IEditorInput(org.eclipse.ui.IEditorInput)

Example 2 with ApplicationComponentEditor

use of com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor in project convertigo by convertigo.

the class MobilePageComponentTreeObject method launchEditor.

@Override
public void launchEditor(String editorType) {
    ApplicationComponentEditor editor = ((MobileApplicationComponentTreeObject) getParentDatabaseObjectTreeObject()).activeEditor();
    editor.selectPage(getObject().getSegment());
}
Also used : ApplicationComponentEditor(com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor)

Example 3 with ApplicationComponentEditor

use of com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor in project convertigo by convertigo.

the class MobileComponentTreeObject method launchEditor.

@Override
public void launchEditor(String editorType) {
    DatabaseObjectTreeObject parent = getParentDatabaseObjectTreeObject();
    while (!(parent == null || parent instanceof MobileApplicationComponentTreeObject)) {
        parent = parent.getParentDatabaseObjectTreeObject();
    }
    if (parent != null) {
        ApplicationComponentEditor editor = ((MobileApplicationComponentTreeObject) parent).activeEditor();
        editor.highlightComponent(getObject(), true);
    }
}
Also used : ApplicationComponentEditor(com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor)

Aggregations

ApplicationComponentEditor (com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor)3 ApplicationComponent (com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent)1 ApplicationComponentEditorInput (com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput)1 EngineException (com.twinsoft.convertigo.engine.EngineException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 InvalidParameterException (java.security.InvalidParameterException)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IEditorReference (org.eclipse.ui.IEditorReference)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 PartInitException (org.eclipse.ui.PartInitException)1