[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] Re: Do I need ResourceTransfer class? If so, where is it in Eclipse vrs 3.2.0?
|
Thank in advance for your help!
"Hector K." <developerj2@xxxxxxxx> wrote in message
news:easpbt$d08$1@xxxxxxxxxxxxxxxxxxxx
> Hello,
>
> I am a new user of Eclipse vrs 3.2.0 and I am trying to implement a Drag &
> Drop functionality between two trees, where each tree is in a different
> view. The elements of my tree are custom objects (of class Node, which is
> an implementation of IAdaptable). I have read all about TreeViewer,
> ContentProvider, and domain objects and how they work together. What I am
> trying to do is quite similar to what has been posted to a thread in the
> past, http://dev.eclipse.org/newslists/news.eclipse.tools/msg31775.html
>
> I am not sure if I should implement ByteArrayTransfer for the transfer of
> the Nodes (leaf Nodes), or if it's possible to just use ResourceTransfer
> to do the job. Here is the code for my custom Transfer class, which
> doesn't really do anything because I didn't implement javaToNative and
> nativeToJava, as I am not sure if it's possible to map the data I am
> converting to a byte[],:
>
> public class NodeTransfer extends ByteArrayTransfer {
>
>
> private static final String MYTYPENAME = "my_type_name";
>
> private static final int MYTYPEID = registerType(MYTYPENAME);
>
> private static NodeTransfer _instance = new NodeTransfer();
>
>
> private NodeTransfer() {}
>
>
> public static NodeTransfer getInstance () {
>
> return _instance;
>
> }
>
>
> @Override
>
> protected int[] getTypeIds() {
>
> // TODO Auto-generated method stub
>
> return null;
>
> }
>
>
> @Override
>
> protected String[] getTypeNames() {
>
> // TODO Auto-generated method stub
>
> return null;
>
> }
>
>
>
>
> }
>
>
>
> here is my Node class:
>
>
>
> public class Node implements IAdaptable {
>
> private String name;
>
> private ParentNode parent;
>
> ........
>
> }
>
>
>
>
> The question is can I use the ResourceTransfer class to do the job, i.e.
>
> viewer.addDragSupport(operations, new Transfer[] {
> ResourceTransfer.getInstance() }, new DragSourceListener() {...
>
> If so, where is the ResourceTransfer class? It seems that it's not at
> org.eclipse.ui.part in my IDE, and when I hit Ctrl+Space on the
> ResourceTransfer, Eclipse won't find it anything at all for this class!
>
>