use of com.twinsoft.convertigo.eclipse.editors.text.TraceFileEditorInput in project convertigo by convertigo.
the class TraceTreeObject method openTextEditor.
public void openTextEditor(IProject project) {
ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) this.parent.parent;
IFile file = project.getFile("Traces/" + connectorTreeObject.getName() + "/" + this.getName());
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
try {
activePage.openEditor(new TraceFileEditorInput(connectorTreeObject.getObject(), file), "org.eclipse.ui.DefaultTextEditor");
} catch (PartInitException e) {
ConvertigoPlugin.logException(e, "Error while loading the text editor.");
}
}
}
use of com.twinsoft.convertigo.eclipse.editors.text.TraceFileEditorInput 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