Search in sources :

Example 1 with ApplicationComponentEditor

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

the class NgxPageComponentTreeObject method launchEditor.

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

Example 2 with ApplicationComponentEditor

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

the class NgxApplicationComponentTreeObject 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.ngx.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.ngx.components.ApplicationComponent) ApplicationComponentEditor(com.twinsoft.convertigo.eclipse.editors.ngx.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.ngx.ApplicationComponentEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) IEditorInput(org.eclipse.ui.IEditorInput)

Example 3 with ApplicationComponentEditor

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

the class NgxComponentTreeObject method launchEditor.

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

Aggregations

ApplicationComponentEditor (com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditor)3 ApplicationComponent (com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent)1 ApplicationComponentEditorInput (com.twinsoft.convertigo.eclipse.editors.ngx.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