Drag and Drop - one more time [message #194742] |
Mon, 05 September 2005 16:00 |
Eclipse User |
|
|
|
Originally posted by: greg.gigon.tugulu.com
Hello.
I'm trying to build custom Editor plugin for Eclipse. I manage get
throught doc for GEF and fiew web sites with examples.
I tried to set up some simple editor with one element moving on an
graphical editor page.(Simple Drag and Drop without any action taken).
In doc is an information that I shouldnt Use
/AbstractTransferDragSourceListener/ from
*org.eclipse.gef.dnd.AbstractTransferDragSourceListener *package and
instead of it I should use
the interface from jFace package /TransferDragSourceListener.
/I've created simple class
ElementsDragSourceListener.java
/*
package dnd;
import org.eclipse.jface.util.TransferDragSourceListener;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.Transfer;
public class ElementsDragSourceListener implements
TransferDragSourceListener
{
public Transfer getTransfer()
{
return null;
}
public void dragStart(DragSourceEvent event)
{
}
public void dragSetData(DragSourceEvent event)
{
event.data = event.getSource().toString();
}
public void dragFinished(DragSourceEvent event)
{
}
}
/*/
/and added it to ElementEditPart in createFigure() Method:
protected IFigure createFigure()
{
IFigure f = new MenuViewElement();
getViewer().addDragSourceListener(new ElementsDragSourceListener());
return f;
}
When I run project I got my element on page and when I start to drag it
I got :
*
Unhandled event loop exception
Reason:
java.lang.NullPointerException
*and element is not Dragging around :(
Can anyone please point me to new GOOD direction???
Greg
|
|
|
|
Re: Drag and Drop - one more time [message #194789 is a reply to message #194781] |
Tue, 06 September 2005 08:56 |
Eclipse User |
|
|
|
Originally posted by: greg.gigon.tugulu.com
Hey guys, maybe You know good working example with dragable elements. I
just need to move it on a screen, that's it :)
Greg
> Guys, I'm in serious need.
> Please help me a little :)
>
> Greg
|
|
|
Re: Drag and Drop - one more time [message #194803 is a reply to message #194742] |
Tue, 06 September 2005 13:25 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
You should look at the NPE stack trace. Bring up the Error View in Eclipse
to see it.
"Greg" <greg.gigon@tugulu.com> wrote in message
news:dfhq26$3oh$1@news.eclipse.org...
> Hello.
> I'm trying to build custom Editor plugin for Eclipse. I manage get
> throught doc for GEF and fiew web sites with examples.
> I tried to set up some simple editor with one element moving on an
> graphical editor page.(Simple Drag and Drop without any action taken).
> In doc is an information that I shouldnt Use
> /AbstractTransferDragSourceListener/ from
> *org.eclipse.gef.dnd.AbstractTransferDragSourceListener *package and
> instead of it I should use
> the interface from jFace package /TransferDragSourceListener.
> /I've created simple class
>
> ElementsDragSourceListener.java
> /*
> package dnd;
>
> import org.eclipse.jface.util.TransferDragSourceListener;
> import org.eclipse.swt.dnd.DragSourceEvent;
> import org.eclipse.swt.dnd.Transfer;
>
> public class ElementsDragSourceListener implements
> TransferDragSourceListener
> {
>
> public Transfer getTransfer()
> {
> return null;
> }
>
> public void dragStart(DragSourceEvent event)
> {
> }
>
> public void dragSetData(DragSourceEvent event)
> {
> event.data = event.getSource().toString();
> }
>
> public void dragFinished(DragSourceEvent event)
> {
> }
>
> }
> /*/
>
> /and added it to ElementEditPart in createFigure() Method:
> protected IFigure createFigure()
> {
> IFigure f = new MenuViewElement();
> getViewer().addDragSourceListener(new
ElementsDragSourceListener());
> return f;
> }
>
> When I run project I got my element on page and when I start to drag it
> I got :
> *
> Unhandled event loop exception
> Reason:
> java.lang.NullPointerException
>
> *and element is not Dragging around :(
>
> Can anyone please point me to new GOOD direction???
>
> Greg
|
|
|
Re: Drag and Drop - one more time [message #194839 is a reply to message #194789] |
Tue, 06 September 2005 14:11 |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
Greg,
You can download the logic editor example from the GEF home page (download
section). It should give you a good starting point. The logic edtior
does all the basic things you might need.
Harsh
|
|
|
Re: Drag and Drop - one more time [message #194896 is a reply to message #194839] |
Tue, 06 September 2005 15:38 |
Eclipse User |
|
|
|
Originally posted by: greg.gigon.tugulu.com
I have this example but it's quite complex for someone who started with
GEF.
Documentation for this project is not the best in the world. GEF seems
like helping a lot, but not for newbies :-/
I'll give this example one more try anyway :)
Cheers, Mate
Greg
> Greg,
>
> You can download the logic editor example from the GEF home page
> (download section). It should give you a good starting point. The
> logic edtior does all the basic things you might need.
>
> Harsh
>
>
>
|
|
|
|
Re: Drag and Drop - one more time [message #194935 is a reply to message #194839] |
Tue, 06 September 2005 18:05 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Please download the latest maintenance build and look at the improved
documentation.
Are you sure you need native DND, or just plain dragging?
"Harsh" <harsh@ti.com> wrote in message
news:829e59e5f60e1facafee7851592e60ae$1@www.eclipse.org...
> Greg,
>
> You can download the logic editor example from the GEF home page (download
> section). It should give you a good starting point. The logic edtior
> does all the basic things you might need.
>
> Harsh
>
>
>
-
Attachment: help.gif
(Size: 53.88KB, Downloaded 160 times)
|
|
|
Re: Drag and Drop - one more time [message #194983 is a reply to message #194935] |
Wed, 07 September 2005 09:09 |
Eclipse User |
|
|
|
Originally posted by: greg.gigon.tugulu.com
Well, I need to add this functionality to and editor:
- tree Items needs to be dragable to palette in order to customize it.
- I need to drag elements on screen editor to rearange it.
- I need to snap elements to grid on diagram.
I don't know what should I use. If GEF provides support for all that I'm
trying to achive I'll be more then happy to use it.
Cheers, Greg
Randy Hudson wrote:
> Please download the latest maintenance build and look at the improved
> documentation.
>
> Are you sure you need native DND, or just plain dragging?
>
|
|
|
Re: Drag and Drop - one more time [message #195212 is a reply to message #194983] |
Thu, 08 September 2005 17:08 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
Yes, GEF logic example already does 2 and 3. I think you can make 1 work
without too much trouble.
"Greg" <greg.gigon@tugulu.com> wrote in message
news:dfmane$p91$1@news.eclipse.org...
> Well, I need to add this functionality to and editor:
> - tree Items needs to be dragable to palette in order to customize it.
> - I need to drag elements on screen editor to rearange it.
> - I need to snap elements to grid on diagram.
>
> I don't know what should I use. If GEF provides support for all that I'm
> trying to achive I'll be more then happy to use it.
>
> Cheers, Greg
>
>
>
> Randy Hudson wrote:
> > Please download the latest maintenance build and look at the improved
> > documentation.
> >
> > Are you sure you need native DND, or just plain dragging?
> >
|
|
|
Powered by
FUDForum. Page generated in 0.07062 seconds