use of org.eclipse.titanium.graph.gui.windows.ComponentGraphEditor in project titan.EclipsePlug-ins by eclipse.
the class ComponentGraphAction method doOpenGraphForProject.
/**
* @param project the project whose graph is to be displayed
*/
private void doOpenGraphForProject(final IProject project) {
try {
// looking for a file inside the selected
// project
final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IFile input = null;
IResource[] members = project.members();
for (final IResource res : members) {
if (res.getType() == IResource.FILE) {
input = (IFile) res;
break;
}
if (res.getType() == IResource.FOLDER) {
members = ((IFolder) res).members();
}
}
final IEditorPart editor = page.findEditor(new FileEditorInput(input));
if (editor instanceof ComponentGraphEditor) {
((ComponentGraphEditor) editor).refreshGraph();
} else {
page.openEditor(new FileEditorInput(input), ComponentGraphEditor.ID, true, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
}
} catch (Exception exc) {
final ErrorHandler errorHandler = new GUIErrorHandler();
errorHandler.reportException("Error while parsing the project", exc);
}
}
Aggregations