SnapToGuides.KEY_VERTICAL_GUIDE never set in >>request.getExtendedData()<< [message #166714] |
Wed, 02 February 2005 17:43  |
Eclipse User |
|
|
|
Hi
I try to implement the snapToGuide feature in my GEF Editor.
Now I have some trouble with them and need help.
1.
==----==
I have copied the code for the SnapTo'G..' in the logic simulator GEF example.
- I see the ruler at the left and the top of my Editor
- I can insert/remove Guides.
- I can move these Guides.
BUT(!!) I don't know how to attach an edit part/model to this Guid's.
The code in the >>My_XYLayoutEditPolicy<< checks an attribute of the
request to determine a possible Guid - but the variable *(guidePos* is always null.
(see code snipet below)
I can't find the code to set the extendedData in the request.
2.
==----==
The Guid at the left draws a horizontal line and the Guide at top draws
a horizontal(!) line too!
==----==
Any idea?!!!
greetings
Andreas
============================================================ ==========================
....SNIPP.....
============================================================ ==========================
protected Command chainGuideAttachmentCommand(Request request, UIGroupElementModel part,
Command cmd, boolean horizontal)
{
Command result = cmd;
// Attach to guide, if one is given
Integer guidePos = (Integer)request.getExtendedData().get(horizontal ?
SnapToGuides.KEY_HORIZONTAL_GUIDE : SnapToGuides.KEY_VERTICAL_GUIDE);
if (guidePos != null)
{
int alignment = ((Integer)request.getExtendedData().get(horizontal ?
snapToGuides.KEY_HORIZONTAL_ANCHOR :
SnapToGuides.KEY_VERTICAL_ANCHOR)).intValue();
ChangeGuideCommand cgm = new ChangeGuideCommand(part, horizontal);
cgm.setNewGuide(findGuideAt(guidePos.intValue(), horizontal), alignment);
result = result.chain(cgm);
}
return result;
}
============================================================ ==========================
....SNAPP.....
============================================================ ==========================
|
|
|
|
ha!!! perfect :-) *jubel* [message #166791 is a reply to message #166738] |
Thu, 03 February 2005 04:17  |
Eclipse User |
|
|
|
Pratik Shah wrote:
> 1. Does your DiagramEditPart return a SnapToGuides helper in its
> getAdapter() method? Look at LogicDiagramEditPart#getAdapter().
>
> 2. Not sure what would be causing this. The guide still appears on the top
> ruler, right? Just the guide line that is added to the main graphical
> viewer is horizontal? Try stepping through the code.
>
> "FreeGroup" <a.herz@FreeGroup.de> wrote in message
> news:ctrl5r$orf$1@www.eclipse.org...
>
>>Hi
>>
>>I try to implement the snapToGuide feature in my GEF Editor.
>>Now I have some trouble with them and need help.
>>
>>1.
>>==----==
>>
>>I have copied the code for the SnapTo'G..' in the logic simulator GEF
>
> example.
>
>> - I see the ruler at the left and the top of my Editor
>> - I can insert/remove Guides.
>> - I can move these Guides.
>>
>>BUT(!!) I don't know how to attach an edit part/model to this Guid's.
>>The code in the >>My_XYLayoutEditPolicy<< checks an attribute of the
>>request to determine a possible Guid - but the variable *(guidePos* is
>
> always null.
>
>>(see code snipet below)
>>
>>I can't find the code to set the extendedData in the request.
>>
>>2.
>>==----==
>>
>>The Guid at the left draws a horizontal line and the Guide at top draws
>>a horizontal(!) line too!
>>
>>==----==
>>
>>
>>Any idea?!!!
>>
>>
>>greetings
>> Andreas
>>
>>
>
> ============================================================ ================
> ==========
>
>> ....SNIPP.....
>>
>
> ============================================================ ================
> ==========
>
>>protected Command chainGuideAttachmentCommand(Request request,
>
> UIGroupElementModel part,
>
>> Command cmd, boolean
>
> horizontal)
>
>>{
>> Command result = cmd;
>> // Attach to guide, if one is given
>> Integer guidePos = (Integer)request.getExtendedData().get(horizontal ?
>> SnapToGuides.KEY_HORIZONTAL_GUIDE :
>
> SnapToGuides.KEY_VERTICAL_GUIDE);
>
>> if (guidePos != null)
>> {
>> int alignment = ((Integer)request.getExtendedData().get(horizontal ?
>> snapToGuides.KEY_HORIZONTAL_ANCHOR :
>> SnapToGuides.KEY_VERTICAL_ANCHOR)).intValue();
>> ChangeGuideCommand cgm = new ChangeGuideCommand(part, horizontal);
>> cgm.setNewGuide(findGuideAt(guidePos.intValue(), horizontal),
>
> alignment);
>
>> result = result.chain(cgm);
>> }
>> return result;
>>}
>>
>
> ============================================================ ================
> ==========
>
>> ....SNAPP.....
>>
>
> ============================================================ ================
> ==========
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02826 seconds