Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Drag and drop type?

Hey guys,

I'm contributing a section to Team Central and I would like to let people drag and drop work items into that section.

When a work item is dropped into my section, I'll pull some information out of it.

I've registered by drop target with DND.DROP_COPY | DND.DROP_DEFAULT but I get no notifications when I drop a RTC work item. Regular text works fine.

Is there a new type of drop operation that RTC uses? Any help would be greatly appreciated.

Thanks!

Eric.

0 votes



7 answers

Permanent link
Getting feedback for a drop operation depends on the kinds of Transfer you support. Make sure to support LocalSelectionTransfer and URIReferenceTransfer. Those are commonly used in RTC to contain a reference (or the actual selection) of work items. You can find an example in com.ibm.team.fulltext.ide.ui.internal.search.ArtifactSearchResultPage.hookDropSupport().

Ben
Foundation & Work Item

0 votes


Permanent link
Great thanks for the help!

Sorry, really dumb question - when you say there is an example in com.ibm.team.fulltext.ide.ui.internal.search.ArtifactSearchResultPage.hookDropSupport

what source code are you referring to and where do I get it?

Thanks!

Eric.

0 votes


Permanent link
I couldn't find any references to URIReferenceTransfer, can you tell me what the fully qualified name of that class is?

Thanks!

Eric.

0 votes


Permanent link
Hmm, well I've been able to find a reference to that class and I added it. I didn't realize that the RTC source code was available for download as well - that is incredibly useful.

Unfortunately my drop event still won't fire. I wasn't able to find the exact code that was suggested, but I did find some of the chat code which I believe does the same thing. I pretty much copied the following:

final DropTarget target= new DropTarget(fViewTabFolder, DND.DROP_LINK | DND.DROP_DEFAULT);
target.setTransfer(new Transfer[] { URIReferenceTransfer.getInstance()});
target.addDropListener(new ChatMeetingDropTargetListener());

But my control does not appear to accept the drop. Am I missing anything?

Thanks!

Eric.

0 votes


Permanent link
Maybe a better example for you is the com.ibm.team.workitem.rcp.ui.internal.activation.ActiveWorkItemControl.addDropSupport(Control) because it works on Work Items.

A simple example where I get a Link-Feedback when dragging a Work Item over my Table is this code:

Table t= new Table(parent, SWT.BORDER);
final DropTarget target= new DropTarget(t, DND.DROP_LINK);
target.setTransfer(new Transfer[] { LocalSelectionTransfer.getTransfer() });
target.addDropListener(new DropTargetAdapter() {

@Override
public void dragEnter(final DropTargetEvent event) {
validateDrop(event);
}

@Override
public void dragOperationChanged(final DropTargetEvent event) {
validateDrop(event);
}

@Override
public void drop(final DropTargetEvent event) {
performDrop(event);
}

@Override
public void dropAccept(final DropTargetEvent event) {
validateDrop(event);
}

private void performDrop(final DropTargetEvent event) {
event.detail= DND.DROP_LINK;
}

private void validateDrop(final DropTargetEvent event) {
event.detail= DND.DROP_LINK;
}
});

Ben

0 votes


Permanent link
That worked!!! Thanks for your help, I really appreciate it!

I'm really amazed at how relatively easy it is to extend Eclipse/RTC. This was my first plug-in for Eclipse and all things considered it has been a really pleasant experience.

Thanks!

Eric.

0 votes


Permanent link
Great to hear that, enjoy :)

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: Aug 24 '08, 9:15 p.m.

Question was seen: 7,910 times

Last updated: Aug 24 '08, 9:15 p.m.

Confirmation Cancel Confirm