Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ATT: Ms. Irvine - Bug in Eclipse Article: DND
ATT: Ms. Irvine - Bug in Eclipse Article: DND [message #447268] Sat, 11 December 2004 20:02 Go to next message
Mani Ghamari is currently offline Mani GhamariFriend
Messages: 33
Registered: July 2009
Member
Dear Ms. Irvine,

I am failing to compile the sample DND code and think there is a bug in that
code, maybe you want to update that article (or am I missing something
here?):

http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml

line 53 of the Drop Target example does not compile (misplaced constructs
error in eclipse).
I can see why the code does not compile, yet the purpose of the mentioned
lined is not quite clear to me.
My guess would be that line 52 should be replaced with the following (could
be wrong, though):

if ((event.operations & DND.DROP_COPY) != 0)) {

instead of :

event.detail = (event.operations & DND.DROP_COPY) != 0) {


/* *********** pasted from the article example code ************

51 public void dragOperationChanged(DropTargetEvent event) {
52 if (event.detail == DND.DROP_DEFAULT) {
53 event.detail = (event.operations & DND.DROP_COPY) != 0) {
// <<<< BAD LINE
54 event.detail = DND.DROP_COPY;
55 } else {
56 event.detail = DND.DROP_NONE;
57 }
58 }
59 // allow text to be moved but files should only be copied
60 if (fileTransfer.isSupportedType(event.currentDataType)){
61 if (event.detail != DND.DROP_COPY) {
62 event.detail = DND.DROP_NONE;
63 }
64 }
65 }

Thank you for the great support and advice in the forums...

Mani Ghamari
Re: Ms. Irvine - Bug in Eclipse Article: DND [message #447302 is a reply to message #447268] Mon, 13 December 2004 13:23 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
You are correct, the code should be:

if ((event.operations & DND.DROP_COPY) != 0) {
event.detail = DND.DROP_COPY;
} else {
event.detail = DND.DROP_NONE;
}

I will fix the article.

At one time I think the code was:

event.detail = (event.operations & DND.DROP_COPY) != 0 ? DND.DROP_COPY :
DND.DROP_NONE;

but this line was too long for the article format and was incorrectly
rearranged into an if statement. Sorry.


"Mani Ghamari" <mani.ghamari@linkast.com> wrote in message
news:cpfjon$gh2$1@www.eclipse.org...
> Dear Ms. Irvine,
>
> I am failing to compile the sample DND code and think there is a bug in
> that code, maybe you want to update that article (or am I missing
> something here?):
>
> http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.h tml
>
> line 53 of the Drop Target example does not compile (misplaced constructs
> error in eclipse).
> I can see why the code does not compile, yet the purpose of the mentioned
> lined is not quite clear to me.
> My guess would be that line 52 should be replaced with the following
> (could be wrong, though):
>
> if ((event.operations & DND.DROP_COPY) != 0)) {
>
> instead of :
>
> event.detail = (event.operations & DND.DROP_COPY) != 0) {
>
>
> /* *********** pasted from the article example code ************
>
> 51 public void dragOperationChanged(DropTargetEvent event) {
> 52 if (event.detail == DND.DROP_DEFAULT) {
> 53 event.detail = (event.operations & DND.DROP_COPY) != 0) { //
> <<<< BAD LINE
> 54 event.detail = DND.DROP_COPY;
> 55 } else {
> 56 event.detail = DND.DROP_NONE;
> 57 }
> 58 }
> 59 // allow text to be moved but files should only be copied
> 60 if (fileTransfer.isSupportedType(event.currentDataType)){
> 61 if (event.detail != DND.DROP_COPY) {
> 62 event.detail = DND.DROP_NONE;
> 63 }
> 64 }
> 65 }
>
> Thank you for the great support and advice in the forums...
>
> Mani Ghamari
>
Previous Topic:GUI hanging.
Next Topic:Complex table design
Goto Forum:
  


Current Time: Thu Apr 25 05:02:31 GMT 2024

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

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

Back to the top