DND Source on PaletteViewer [message #221010] |
Tue, 08 August 2006 23:23  |
Eclipse User |
|
|
|
Originally posted by: hcurtis.xaware.com
We are trying to use the GEF PaletteViewer in a separate plugin (Not a
graphic editor). In the createPartControl() of the view we are executing
the following:
IEditorPart ie = getSite().getPage().getActiveEditor();
domain = new DefaultEditDomain(ie);
provider = new PaletteViewerProvider(domain);
viewer = provider.createPaletteViewer(aParentComp);
I'm trying to add a SWT TransferDragSourceListener to the PaletteViewer.
viewer.addDragSourceListener(new PaletteDragSource(this));
There seems to be an initialization issue or perhaps there is all ready a
DragSource on the PaletteViewer. When the above line is executed I get:
org.eclipse.swt.SWTError: Cannot initialize Drag
at org.eclipse.swt.dnd.DND.error(DND.java:242)
at org.eclipse.swt.dnd.DND.error(DND.java:208)
at org.eclipse.swt.dnd.DragSource.<init>(DragSource.java:146)
at
org.eclipse.gef.ui.parts.AbstractEditPartViewer.refreshDragS ourceAdapter(AbstractEditPartViewer.java:464)
at
org.eclipse.gef.ui.parts.AbstractEditPartViewer.addDragSourc eListener(AbstractEditPartViewer.java:122)
at
com.xaware.ide.xadev.gui.view.palette.XAPaletteView.createPa rtControl(XAPaletteView.java:82)
........
Can someone suggest an approach to issolate the cause or (even better)
suggest why the error is occuring?
--
Bud Curtis
XAware, Inc.
719-884-5443
|
|
|
Re: DND Source on PaletteViewer [message #221017 is a reply to message #221010] |
Wed, 09 August 2006 00:20   |
Eclipse User |
|
|
|
Originally posted by: hcurtis.xaware.com
I know it is detecting an error in the DragSource constructor:
public DragSource(Control control, int style) {
super(control, checkStyle(style));
this.control = control;
if (control.getData(DRAGSOURCEID) != null) {
DND.error(DND.ERROR_CANNOT_INIT_DRAG); <-- This is the line with the
error
}
but when I start the process of adding the DragSourceListener
viewer.addDragSourceListener(new PaletteDragSource(this));
the control.getData(DRAGSOURCEID) is null. Ther must be a step I'm missing
in executing the
addDragSourceListener(...).
Any help would be much appreciated.
"Bud Curtis" <hcurtis@xaware.com> wrote in message
news:ebb6ag$s1h$1@utils.eclipse.org...
> We are trying to use the GEF PaletteViewer in a separate plugin (Not a
> graphic editor). In the createPartControl() of the view we are executing
> the following:
>
> IEditorPart ie = getSite().getPage().getActiveEditor();
> domain = new DefaultEditDomain(ie);
> provider = new PaletteViewerProvider(domain);
> viewer = provider.createPaletteViewer(aParentComp);
>
> I'm trying to add a SWT TransferDragSourceListener to the PaletteViewer.
>
> viewer.addDragSourceListener(new PaletteDragSource(this));
>
> There seems to be an initialization issue or perhaps there is all ready a
> DragSource on the PaletteViewer. When the above line is executed I get:
>
> org.eclipse.swt.SWTError: Cannot initialize Drag
> at org.eclipse.swt.dnd.DND.error(DND.java:242)
> at org.eclipse.swt.dnd.DND.error(DND.java:208)
> at org.eclipse.swt.dnd.DragSource.<init>(DragSource.java:146)
> at
> org.eclipse.gef.ui.parts.AbstractEditPartViewer.refreshDragS ourceAdapter(AbstractEditPartViewer.java:464)
> at
> org.eclipse.gef.ui.parts.AbstractEditPartViewer.addDragSourc eListener(AbstractEditPartViewer.java:122)
> at
> com.xaware.ide.xadev.gui.view.palette.XAPaletteView.createPa rtControl(XAPaletteView.java:82)
> .......
>
> Can someone suggest an approach to issolate the cause or (even better)
> suggest why the error is occuring?
>
>
> --
> Bud Curtis
> XAware, Inc.
> 719-884-5443
>
|
|
|
Re: DND Source on PaletteViewer [message #221129 is a reply to message #221017] |
Thu, 10 August 2006 03:30  |
Eclipse User |
|
|
|
Maybe the aParentComp have been add the dragsource listener.So You try creat
a child from the aParentComp then create the view ,then add the listener.
"Bud Curtis" <hcurtis@xaware.com> wrote in message
news:ebb9l5$tlf$1@utils.eclipse.org...
>I know it is detecting an error in the DragSource constructor:
>
> public DragSource(Control control, int style) {
> super(control, checkStyle(style));
> this.control = control;
> if (control.getData(DRAGSOURCEID) != null) {
> DND.error(DND.ERROR_CANNOT_INIT_DRAG); <-- This is the line with
> the error
> }
>
> but when I start the process of adding the DragSourceListener
>
> viewer.addDragSourceListener(new PaletteDragSource(this));
>
> the control.getData(DRAGSOURCEID) is null. Ther must be a step I'm
> missing in executing the
> addDragSourceListener(...).
>
> Any help would be much appreciated.
>
>
> "Bud Curtis" <hcurtis@xaware.com> wrote in message
> news:ebb6ag$s1h$1@utils.eclipse.org...
>> We are trying to use the GEF PaletteViewer in a separate plugin (Not a
>> graphic editor). In the createPartControl() of the view we are
>> executing the following:
>>
>> IEditorPart ie = getSite().getPage().getActiveEditor();
>> domain = new DefaultEditDomain(ie);
>> provider = new PaletteViewerProvider(domain);
>> viewer = provider.createPaletteViewer(aParentComp);
>>
>> I'm trying to add a SWT TransferDragSourceListener to the PaletteViewer.
>>
>> viewer.addDragSourceListener(new PaletteDragSource(this));
>>
>> There seems to be an initialization issue or perhaps there is all ready a
>> DragSource on the PaletteViewer. When the above line is executed I get:
>>
>> org.eclipse.swt.SWTError: Cannot initialize Drag
>> at org.eclipse.swt.dnd.DND.error(DND.java:242)
>> at org.eclipse.swt.dnd.DND.error(DND.java:208)
>> at org.eclipse.swt.dnd.DragSource.<init>(DragSource.java:146)
>> at
>> org.eclipse.gef.ui.parts.AbstractEditPartViewer.refreshDragS ourceAdapter(AbstractEditPartViewer.java:464)
>> at
>> org.eclipse.gef.ui.parts.AbstractEditPartViewer.addDragSourc eListener(AbstractEditPartViewer.java:122)
>> at
>> com.xaware.ide.xadev.gui.view.palette.XAPaletteView.createPa rtControl(XAPaletteView.java:82)
>> .......
>>
>> Can someone suggest an approach to issolate the cause or (even better)
>> suggest why the error is occuring?
>>
>>
>> --
>> Bud Curtis
>> XAware, Inc.
>> 719-884-5443
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03364 seconds