niedziela, 11 października 2015

How to programmatically open ProblemsView in Eclipse

In order to open up a default "Problem View" view we need invoke showView method of on IViewPart instance. Here you are little snippet opening view as a separate job.
Job job = new Job("Opening problems view") {
 @Override
 protected IStatus run(IProgressMonitor monitor) {
  IWorkbench workbench = PlatformUI.getWorkbench();
  try {
   workbench.getWorkbenchWindows()[0].getActivePage().showView("org.eclipse.ui.views.ProblemView");
  } catch (PartInitException e) {
   e.printStackTrace();
  }
  return Status.OK_STATUS;
 }
};
job.schedule(500);

Brak komentarzy:

Prześlij komentarz