2

I'm new to eclipse plug-in development, and have a little question here.

I want to open a new view by clicking on an object in an editor. Specifically, the object is a link to an image file, that should be opened in an image viewer. For now, I'm using

ImageViewer viewer = (ImageViewer) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewer_ID);
viewer.setSelection(pathToFile);

is this how you would normally do it (both opening the view, and getting the image to it), or is there a better way?

skaffman
  • 398,947
  • 96
  • 818
  • 769
margold
  • 587
  • 2
  • 5
  • 16

1 Answers1

4

As answered in another question, your code is the way to go, but there's a slightly more stable way to do it within a Handler.

Once you opened the view, you can use any of its API.

Community
  • 1
  • 1
Christian Semrau
  • 8,913
  • 2
  • 32
  • 39