use of com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput 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;
}
use of com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput in project convertigo by convertigo.
the class NgxApplicationComponentTreeObject method closeAllEditors.
@Override
public void closeAllEditors(boolean save) {
// will close any child component editor
super.closeAllEditors(save);
ApplicationComponent application = (ApplicationComponent) getObject();
synchronized (application) {
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)) {
activePage.closeEditor(editorRef.getEditor(false), false);
}
}
} catch (Exception e) {
}
}
}
}
}
Aggregations