czwartek, 29 października 2015

How to write minimal Rest client with

poniedziałek, 12 października 2015

[PDE] How to find out all plugins that given extension point is used

There are two ways to do so from PDE UI level. First is by opening "Open Plug-in Artifact" view (Ctrl + Shift + A) - technically org.eclipse.pde.internal.ui.search.dialogs.FilteredPluginArtifactsSelectionDialog class.

Once you type "expressions.propertyTesters" in filter box and deselect all but "Show Extension" item hidden under black triangle on the right, the matching items will contain all plugins are using "org.eclipse.core.expressions.propertyTesters" extension point.

The another way is using default Search Dialog (Ctrl + H). The last tab is "Plug-in Search".

  • Search For: Extension Point
  • Limit To: References
This time you need type fully qualified id or use wild card (*expressions.propertyTesters)

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);

czwartek, 8 października 2015

How to make active waiting in separate thread


final ScheduledExecutorService newScheduledThreadPool = Executors.newScheduledThreadPool(1);
newScheduledThreadPool.scheduleAtFixedRate(new Runnable() {

 @Override
 public void run() {
  boolean isExecutionDone = false;
  try {
                    isExecutionDone = checkIfExecutionIsDone();
  } finally {
   if (isExecutionDone) {
    newScheduledThreadPool.shutdown();
   }
  }

 }
}, 1, 1, TimeUnit.SECONDS);