Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Creating a "Mini" View
Creating a "Mini" View [message #1004310] Wed, 23 January 2013 00:39 Go to next message
Tim E. is currently offline Tim E.Friend
Messages: 56
Registered: November 2012

it's me again, and I'm having another problem Sad

At the moment I'm trying to create a new view for my GEF-based editor,
showing a miniature version of the diagram displayed.

I found a miniature view in the logic example,
although I don't yet how to transfer it to its own view.

But my problem at the moment starts a lot earlier.

I defined a new view in the plugins.xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
            contributorClass="[path to class].GenericActionBarContributor"
            class="[path to class].controller.views.minipreview.MiniView"

And for testing purposes I implemented the following View according to this tutorial like this:
public class MiniView extends ViewPart {
  private Label label;
  public MiniView() {
  public void createPartControl(Composite parent) {
    label = new Label(parent, 0);
    label.setText("Hello World");
  public void setFocus() {

Unfortunately, I cannot open this view.
I cannot find my view under "Window -> Show View -> other..."

And I have no idea, why this does not work.

I would appreciate any help and advices on

1) How to make this view visible

2) Perhaps an idea how to implement the "Mini" View or more detailed:
How to pass my existing GraphicalViewer or RootEditPart to this view...

I'd appreciate any help...

Thanks a lot,
Re: Creating a "Mini" View [message #1004723 is a reply to message #1004310] Wed, 23 January 2013 18:38 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3178
Registered: July 2009
Senior Member

When you find that changes to the plugin.xml files aren't picked up, check your Eclipse Application launcher. More than likely it's not been set to clear the configuration space from its Configuration tab.

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Creating a "Mini" View [message #1004743 is a reply to message #1004723] Wed, 23 January 2013 19:42 Go to previous messageGo to next message
Tim E. is currently offline Tim E.Friend
Messages: 56
Registered: November 2012
Thanks for the hint...

I accomplished to see the view by now!

Now I'm trying to solve my second problem: to access the GraphicalViewer from my view, since I don't want to put it directly as a class in my Editor.


[Updated on: Wed, 23 January 2013 19:42]

Report message to a moderator

Re: Creating a "Mini" View [message #1005032 is a reply to message #1004743] Thu, 24 January 2013 10:59 Go to previous message
Tim E. is currently offline Tim E.Friend
Messages: 56
Registered: November 2012
I accomplished to solve my second problem as well.

In my View class I make use of a IPartListener2.

The code looks like this:

  // The listener
  private class ChangeListener implements IPartListener2 {
    public void partActivated(IWorkbenchPartReference ref) {
      if (ref.getPart(false) instanceof <EditorClass>) {
        <EditorClass>editor = (<EditorClass>) ref.getPart(false);
        viewer = (GraphicalViewer) editor.getAdapter(GraphicalViewer.class);
    ..a lot more methods..

  // refreshContents method of Overview View
  private void refreshContents() {
    if (viewer != null) {
      // miniature view
      thumbnail = new ScrollableThumbnail((Viewport) ((ScalableRootEditPart) viewer.getRootEditPart()).getFigure());
      thumbnail.setSource(((ScalableRootEditPart) viewer.getRootEditPart()).getLayer(LayerConstants.PRINTABLE_LAYERS));
      disposeListener = new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          if (thumbnail != null) {
            thumbnail = null;

// registration of listener in constructor
  IWorkbenchWindow wbw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  page = wbw.getActivePage();
  changeListener = new ChangeListener();

I'm not sure if this is the best solution, but at least it works.
If you have suggestions or remarks, feel free to tell me Smile

If you need more code or explanation of my solution, let me also know.

Previous Topic:Displaying Connections
Next Topic:How initially scroll when editor opens?
Goto Forum:

Current Time: Sat Jun 23 16:18:15 GMT 2018

Powered by FUDForum. Page generated in 0.02047 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top