Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » thumbnail view not as Content outline view
thumbnail view not as Content outline view [message #224612] Tue, 17 October 2006 09:44 Go to next message
Sabri Skhiri dit Gabouje is currently offline Sabri Skhiri dit Gabouje
Messages: 10
Registered: July 2009
Junior Member
I am looking for a way to create a thumbnail view of my GEF editor but not
as a ContentOulineView. Because I have already an outline view composed
of a tree of my diagram elements. So, I would like to have a thumbnail
view in a separate view. It is possible ? I know how to create a view, but
I don’t know how to connect my view to my editor ?
For creating the view I need the root edit part of my GEF editor, but how
to give this root edit part to my view ?

Code of my view:
public void createPartControl(Composite parent)
{
// create canvas and lws
overview = new Canvas(parent, SWT.NONE);
LightweightSystem lws = new LightweightSystem(overview);

// create thumbnail
thumbnail =
new ScrollableThumbnail((Viewport) rootEditPart.getFigure());
thumbnail.setBorder(new MarginBorder(3));
thumbnail.setSource(
rootEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS));
lws.setContents(thumbnail);
}

Thanks !

Sabri.
Re: thumbnail view not as Content outline view [message #224671 is a reply to message #224612] Wed, 18 October 2006 00:33 Go to previous messageGo to next message
Sebu Thomas is currently offline Sebu Thomas
Messages: 12
Registered: July 2009
Junior Member
Sabri wrote:
> I am looking for a way to create a thumbnail view of my GEF editor but
> not as a ContentOulineView. Because I have already an outline view
> composed of a tree of my diagram elements. So, I would like to have a
> thumbnail view in a separate view. It is possible ? I know how to create
> a view, but I don�t know how to connect my view to my editor ?
> For creating the view I need the root edit part of my GEF editor, but
> how to give this root edit part to my view ?
>
> Code of my view:
> public void createPartControl(Composite parent)
> {
> // create canvas and lws
> overview = new Canvas(parent, SWT.NONE);
> LightweightSystem lws = new LightweightSystem(overview);
>
> // create thumbnail
> thumbnail =
> new ScrollableThumbnail((Viewport) rootEditPart.getFigure());
> thumbnail.setBorder(new MarginBorder(3));
> thumbnail.setSource(
> rootEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS));
> lws.setContents(thumbnail);
> }
>
> Thanks !
>
> Sabri.
>
>
Simple way: Make the ContentOutlinePage layout on a SashForm. One part
of the sash will be your tree view and the other part the thumbnail
view. Giving part of code below.

public void createControl (Composite parent) {
sash = new SashForm (parent, SWT.VERTICAL);
getViewer().createControl(sash);

getViewer().setEditDomain(getEditDomain());
getViewer().setEditPartFactory(new <factory for tree>);
getViewer().setContents(<model>);
getSelectionSynchronizer().addViewer(getViewer());
Canvas canvas = new Canvas(sash, SWT.BORDER);
LightweightSystem lws = new LightweightSystem(canvas);
thumbnail = new ScrollableThumbnail(
(Viewport) ((ScalableRootEditPart) getGraphicalViewer()
.getRootEditPart()).getFigure());
thumbnail.setSource(((ScalableRootEditPart) getGraphicalViewer()
.getRootEditPart())
.getLayer(LayerConstants.PRINTABLE_LAYERS));
lws.setContents(thumbnail);

disposeListener = new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (thumbnail != null) {
thumbnail.deactivate();
thumbnail = null;
}
}
};
getGraphicalViewer().getControl().addDisposeListener(
disposeListener);
}

If you want full code, I can send it to your email id.

Sebu
Re: thumbnail view not as Content outline view [message #224794 is a reply to message #224612] Wed, 18 October 2006 17:01 Go to previous messageGo to next message
Eclipse User
Originally posted by: none.unknown.com

"Sabri" <Sabri.Skhiri@alcatel.be> wrote in message
news:8fefe8a8c39c9183343c8a2bf518146f$1@www.eclipse.org...
>I am looking for a way to create a thumbnail view of my GEF editor but not
>as a ContentOulineView. Because I have already an outline view composed of
>a tree of my diagram elements. So, I would like to have a thumbnail view in
>a separate view. It is possible ?

Of course.

> I know how to create a view, but I don
Re: thumbnail view not as Content outline view [message #901521 is a reply to message #224671] Mon, 13 August 2012 04:43 Go to previous message
vrush Mising name
Messages: 51
Registered: July 2009
Location: Pune
Member
Hi Sebu,

Is it possible to share the complete code to my email id?
I understand it's a very old post and pulling the exact code may take time but it wouls be really helpful of you if in case you end up finding it.


Thanks a lot,
Vrushali.
Previous Topic:How implement editor where some parts only scroll in one direction?
Next Topic:Default Select, Zoom and Note Palette Icon File/Jar Location?
Goto Forum:
  


Current Time: Wed Aug 20 08:50:22 EDT 2014

Powered by FUDForum. Page generated in 0.04482 seconds