use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditorInput in project convertigo by convertigo.
the class ProjectTreeObject method getSequenceEditor.
public SequenceEditor getSequenceEditor(Sequence sequence) {
SequenceEditor sequenceEditor = null;
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
if (sequence != 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 SequenceEditorInput)) {
if (((SequenceEditorInput) editorInput).is(sequence)) {
sequenceEditor = (SequenceEditor) editorRef.getEditor(true);
break;
}
}
} catch (PartInitException e) {
ConvertigoPlugin.logException(e, "Error while retrieving the sequence editor '" + editorRef.getName() + "'");
}
}
}
}
return sequenceEditor;
}
use of com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditorInput in project convertigo by convertigo.
the class ProjectTreeObject method closeAllEditors.
public void closeAllEditors() {
Project project = getObject();
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage activePage = workbenchWindow != null ? workbenchWindow.getActivePage() : null;
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) {
// close connector editor
if (editorInput instanceof ConnectorEditorInput) {
if (((ConnectorEditorInput) editorInput).is(project)) {
closeEditor(activePage, editorRef);
}
} else // close sequence editors
if (editorInput instanceof SequenceEditorInput) {
if (((SequenceEditorInput) editorInput).is(project)) {
closeEditor(activePage, editorRef);
}
} else // close js editors
if (editorInput instanceof JScriptEditorInput) {
DatabaseObject dbo = ((JScriptEditorInput) editorInput).getJScriptContainer().getDatabaseObject();
if (dbo != null && project.equals(dbo.getProject())) {
closeEditor(activePage, editorRef);
}
} else // close trace editors
if (editorInput instanceof TraceFileEditorInput) {
if (((TraceFileEditorInput) editorInput).getConnector().getProject().equals(project)) {
closeEditor(activePage, editorRef);
}
} else // close other file editors
if (editorInput instanceof FileEditorInput) {
IPath fullpath = ((FileEditorInput) editorInput).getFile().getFullPath();
if (fullpath.toString().replaceFirst("/(.*?)/.*", "$1").equals(project.getName())) {
closeEditor(activePage, editorRef);
}
} else if (editorInput instanceof com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput) {
com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput acei = GenericUtils.cast(editorInput);
if (acei.getApplication().getProject().equals(project)) {
closeEditor(activePage, editorRef);
}
} else if (editorInput instanceof com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput) {
com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput acei = GenericUtils.cast(editorInput);
if (acei.getApplication().getProject().equals(project)) {
closeEditor(activePage, editorRef);
}
}
}
} catch (PartInitException e) {
ConvertigoPlugin.logException(e, "Error while retrieving the editor '" + editorRef.getName() + "'");
}
}
}
}
Aggregations