use of com.python.pydev.ui.hierarchy.PyHierarchyView in project Pydev by fabioz.
the class PyShowHierarchy method perform.
@Override
protected String perform(IAction action, IProgressMonitor monitor) throws Exception {
try {
final PyHierarchyView view;
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
view = (PyHierarchyView) page.showView("com.python.pydev.ui.hierarchy.PyHierarchyView", null, IWorkbenchPage.VIEW_VISIBLE);
ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(EditorUtils.getShell());
try {
IRunnableWithProgress operation = new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
final HierarchyNodeModel model;
// set whatever is needed for the hierarchy
IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
if (pyRefactoring instanceof IPyRefactoring2) {
RefactoringRequest refactoringRequest = getRefactoringRequest(monitor);
IPyRefactoring2 r2 = (IPyRefactoring2) pyRefactoring;
model = r2.findClassHierarchy(refactoringRequest, false);
if (monitor.isCanceled()) {
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
if (!monitor.isCanceled()) {
view.setHierarchy(model);
}
}
};
Display.getDefault().asyncExec(r);
}
} catch (Exception e) {
Log.log(e);
}
}
};
boolean fork = true;
monitorDialog.run(fork, true, operation);
} catch (Throwable e) {
Log.log(e);
}
} catch (Exception e) {
Log.log(e);
}
return "";
}
Aggregations