|
Re: GEF functionality within other editor window [message #777079 is a reply to message #777071] |
Mon, 09 January 2012 20:01 |
Russ Loucks Messages: 11 Registered: December 2011 |
Junior Member |
|
|
On 01/09/2012 01:41 PM, Mav3ric F wrote:
> Hey, I got a new task assigned today. I should implement a GEF Edior
> within one page of of FormEditor.
>
> Is this even possible or can GEF only be used within a subclass of its
> own GraphicalEditor?
>
> If it is possible can you please give me some hints how it can be
> accomplished? I thought about implementing a GraphicalViewer in the
> page, but I'm not sure how I can perfom with the other stuff like
> EditDomain, ActionRegistry, Listeners etc. as they are not directly
> available in the FormPage.
>
> Thanks for any help!
> Mav
I do this. I have an XML (text) editor as one page in my FormEditor and
a GEF editor in another page. Some details:
1) The FormEditor.addPages() method looks like:
createXMLPage (model);
createGraphPage (model);
2) The createXMLPage(model) method:
this.xmlEditor = new XMLEditor (this);
setPageText (addPage (xmlEditor, this.input), "XML Text");
3) the createGraphPage (model) method:
this.graphEditor = new GraphEditor (this,model);
setPageText (addPage (this.graphEditor, this.input), "Design graph");
My GraphEditor is a GraphicalEditorWithFlyoutPalette. In the
constructor just cache the parent (from the param list) as an
IEditorPart. you'll need this to 'fix' the 'delete' problem when trying
to delete an object in your design graph....
In the FormEditor.doSave() method:
if (null != graphEditor) {
graphEditor.doSave (monitor);
Model model = (editor)input.getModel();
<persist model>
}
In the GraphEditor.doSave(monitor) method:
Model model = digram.getDetails();
editorInput.setModel (model);
Works well. Hope that's what you're after.
|
|
|
Re: GEF functionality within other editor window [message #777141 is a reply to message #777079] |
Mon, 09 January 2012 23:27 |
Russ Loucks Messages: 11 Registered: December 2011 |
Junior Member |
|
|
On 01/09/2012 02:01 PM, Russ Loucks wrote:
> On 01/09/2012 01:41 PM, Mav3ric F wrote:
>> Hey, I got a new task assigned today. I should implement a GEF Edior
>> within one page of of FormEditor.
>>
>> Is this even possible or can GEF only be used within a subclass of its
>> own GraphicalEditor?
>>
>> If it is possible can you please give me some hints how it can be
>> accomplished? I thought about implementing a GraphicalViewer in the
>> page, but I'm not sure how I can perfom with the other stuff like
>> EditDomain, ActionRegistry, Listeners etc. as they are not directly
>> available in the FormPage.
>>
>> Thanks for any help!
>> Mav
>
> I do this. I have an XML (text) editor as one page in my FormEditor and
> a GEF editor in another page. Some details:
>
> 1) The FormEditor.addPages() method looks like:
> createXMLPage (model);
> createGraphPage (model);
>
> 2) The createXMLPage(model) method:
> this.xmlEditor = new XMLEditor (this);
> setPageText (addPage (xmlEditor, this.input), "XML Text");
>
> 3) the createGraphPage (model) method:
> this.graphEditor = new GraphEditor (this,model);
> setPageText (addPage (this.graphEditor, this.input), "Design graph");
>
> My GraphEditor is a GraphicalEditorWithFlyoutPalette. In the constructor
> just cache the parent (from the param list) as an IEditorPart. you'll
> need this to 'fix' the 'delete' problem when trying to delete an object
> in your design graph....
>
> In the FormEditor.doSave() method:
>
> if (null != graphEditor) {
> graphEditor.doSave (monitor);
> Model model = (editor)input.getModel();
> <persist model>
> }
>
> In the GraphEditor.doSave(monitor) method:
> Model model = digram.getDetails();
> editorInput.setModel (model);
>
> Works well. Hope that's what you're after.
Sorry, I guess I didn't explain my self very well. I've attached a
figure which shows what I'm talking about. I have a set of figures and
three are connected to one. I would like to annotate (e.g., name) the
connections unambiguously like the attached.
I can definitely add labels to connections, but when I have a large
number of connections with a common target figure, the labels on the
connections are a bit muddled.
The attached figure shows sort of what I would like to do. I would like
to attach a label to a connection but then have some sort of visual
'connection line' between the label and its owner (connection figure).
Hope this makes sense.
r
|
|
|
Re: GEF functionality within other editor window [message #777449 is a reply to message #777071] |
Tue, 10 January 2012 14:36 |
Matthias F Messages: 20 Registered: June 2011 |
Junior Member |
|
|
Thanks for you answer. Your solution works, but unfortunately it is not exactly what I want. I guess I haven't explained it well enough.
I only have one FormPage and the GEF Editor shall be a part(section) of this page. I already managed to get the GEF Editor into the Section.
Simplified example:
public class ChartSection extends ModelSection
{
private final LogicEditor le;
public ChartSection(final IEditorSite editorSite, final IEditorInput EditorInput)
{
super();
le = new LogicEditor();
try
{
le.init(editorSite, editorInput);
} catch (PartInitException e)
{
e.printStackTrace();
}
}
@Override
protected void createContents(final Composite parent, final Section section)
{
parent.setLayout(new FillLayout());
le.createPartControl(parent);
}
}
Currently I tried adding the Logic Example of GEF. (I needed to adjust the EditorInput, as it normally expects a IFileEditorInput;
ModelSection is a custom implementation of org.eclipse.ui.forms.widgets.Section)
This works so far. I have the Editor with the palette inside my page and I can add and move elements on the editor.
However the actions, like delete etc. wont work because the ActionBarContributer of the LogicEditor is not loaded.
Is there a way how I can pass the events from FormEditor to the LogicEditor?
I tried to add a FocusListener on the composite of the GEF Editor an then set the SelectionProvider and the active editor in the ActionBarContributer but I couldn't get the Listener to work...
Do you have any ideas how to get this thing to work properly?
[Updated on: Tue, 10 January 2012 14:38] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03453 seconds