Home » Eclipse Projects » Rich Client Platform (RCP) » Graphical editor start problem - setFocus
Graphical editor start problem - setFocus [message #461272] |
Mon, 08 January 2007 09:16  |
Eclipse User |
|
|
|
Originally posted by: eclipse.patcom.demon.co.uk
Hello
I have a graphical editor - losely based on the Shapes Editor example -
and I am having problems getting it to run. Instead of the Navigator, I
have a tree viewer that is building a hierachical model. An action fired
from the tree viwer's pop-up menu launches the editor. I know that the
editor is being created and is getting past PartTester but it falls over
at the setFocus method.
This is because the graphicalViewer attribute (from the GraphicalEditor
super class) is not being set.
My editor sub-classes GraphicalEditorWithFlyoutPalette and I have
provided methods for configureGraphicalViewer and
initializeGraphicalViewer but niether of these methods are fired.
The action that starts the editor uses
diagramEditor = window.getActivePage().openEditor(diagramEditorInput,
"com.....designer.DiagramEditor");
The plugin contains
<extension point="org.eclipse.ui.editors">
<editor
class="com.....designer.DiagramEditor"
contributorClass="com......designer.DiagramEditorActionBarContributer "
default="true"
icon="shapes.gif"
id="com......designer.DiagramEditor"
name="Designer Editor"/>
</extension>
I must be missing something but cannot find out what it is.
Many thanks
Mike
|
|
| | | | | |
Re: Graphical editor start problem - setFocus [message #461378 is a reply to message #461363] |
Wed, 10 January 2007 04:33   |
Eclipse User |
|
|
|
Originally posted by: eclipse.patcom.demon.co.uk
Hello Jakub
I do appreciate your help, but I am afraid we are still not there, is
GraphicalViewerImpl one of your classes ?
This would still be a problem as the createGraphicalViwer method does
not get fired, I think the initial problem must lie outside of the
Editor in the way the workbench starts the Editor.
In the shapes example, the Editor is associated with a resource and in
the plugin, it has an extension of shapes. The wizard starts the Editor
by using
IDE.openEditor(page, newFile, true);
Some thing in this route must cause the graphical viewer to be
instantiated an set into the Editor attribute graphialViewer because in
the shapes example, the only two methods to do with the graphical viewer
are the configureGraphicalViewer and initializeGraphicalViewer, both of
which expect the graphicalViewer attribute to be already populated.
I had assumed that the editor super class,
GraphicalEditorWithFlyoutPalette, created the viewer and populated the
graphicalViewer attribute, but it does not seam to.
Many thanks
Mike
Jakub Jurkiewicz wrote:
> Sorry for that, class GraphicalViwerCreator was my class. I've put the
> code from GraphicalViewerCreator#createViewer to the
> createGraphicalViewer method and for me it works, so check it:
> protected void createGraphicalViewer(Composite parent) {
> IEditorSite editorSite = getEditorSite();
> GraphicalViewer viewer = new GraphicalViewerImpl();
> viewer.createControl(parent);
> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
> viewer.setEditPartFactory(new ScreenEditPartFactory());
> viewer.getControl().setBackground(ColorConstants.white);
>
> getEditDomain().addViewer(viewer);
> getSite().setSelectionProvider(viewer);
> viewer.setContents(screen);
>
> this.graphicalViewer = viewer;
>
> }
>
> I hope this works!
> Jakub Jurkiewicz
>
> mgb wrote:
>> Thanks Jakub
>>
>> That is strange, I wonder why those methods were included in the example.
>>
>> I have tried adding your code but do not have GraphicalViwerCreator -
>> do you know where this class should be
>>
>> Cheers
>>
>> Mike
>>
>> Jakub Jurkiewicz wrote:
>>> I've just run my editor, and I can see that neither
>>> configureGraphicalViewer() method nor initializeGraphicalViewer() is
>>> called (I don't have them implemented). There is only
>>> createGraphicalViewer(Composite parent) called.
>>> My implementation looks more less like this:
>>> protected void createGraphicalViewer(Composite parent) {
>>> IEditorSite editorSite = getEditorSite();
>>> GraphicalViewer viewer = new GraphicalViewerCreator(editorSite)
>>> .createViewer(parent);
>>>
>>> // hook the viewer into the EditDomain
>>> getEditDomain().addViewer(viewer);
>>> // acticate the viewer as selection provider for Eclipse
>>> getSite().setSelectionProvider(viewer);
>>> // set the viewer's content
>>> viewer.setContents(screen);
>>>
>>> this.graphicalViewer = viewer;
>>>
>>> }
>>>
>>> Check this and let me know how it goes.
>>>
>>> Jakub Jurkiewicz
>
|
|
|
Re: Graphical editor start problem - setFocus [message #461412 is a reply to message #461378] |
Wed, 10 January 2007 11:51   |
Eclipse User |
|
|
|
No, GraphicalViewerImpl class is from org.eclipse.gef.ui.parts package.
I don't have any clue what can be wrong. Could you show me your
plugin.xml file?
Did you look at this tutotial:
http://www.eclipse.org/articles/Article-GEF-diagram-editor/s hape.html -
it shows how to build shape editor.
If you still have this problem I can still try to help you.
And if you find what was wrong, please tell me what was it, ok?
regards
Jakub Jurkiewicz
mgb wrote:
> Hello Jakub
>
> I do appreciate your help, but I am afraid we are still not there, is
> GraphicalViewerImpl one of your classes ?
>
> This would still be a problem as the createGraphicalViwer method does
> not get fired, I think the initial problem must lie outside of the
> Editor in the way the workbench starts the Editor.
>
> In the shapes example, the Editor is associated with a resource and in
> the plugin, it has an extension of shapes. The wizard starts the Editor
> by using
>
> IDE.openEditor(page, newFile, true);
>
> Some thing in this route must cause the graphical viewer to be
> instantiated an set into the Editor attribute graphialViewer because in
> the shapes example, the only two methods to do with the graphical viewer
> are the configureGraphicalViewer and initializeGraphicalViewer, both of
> which expect the graphicalViewer attribute to be already populated.
>
> I had assumed that the editor super class,
> GraphicalEditorWithFlyoutPalette, created the viewer and populated the
> graphicalViewer attribute, but it does not seam to.
>
> Many thanks
>
> Mike
> Jakub Jurkiewicz wrote:
>> Sorry for that, class GraphicalViwerCreator was my class. I've put the
>> code from GraphicalViewerCreator#createViewer to the
>> createGraphicalViewer method and for me it works, so check it:
>> protected void createGraphicalViewer(Composite parent) {
>> IEditorSite editorSite = getEditorSite();
>> GraphicalViewer viewer = new GraphicalViewerImpl();
>> viewer.createControl(parent);
>> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
>> viewer.setEditPartFactory(new ScreenEditPartFactory());
>> viewer.getControl().setBackground(ColorConstants.white);
>>
>> getEditDomain().addViewer(viewer);
>> getSite().setSelectionProvider(viewer);
>> viewer.setContents(screen);
>>
>> this.graphicalViewer = viewer;
>>
>> }
>>
>> I hope this works!
>> Jakub Jurkiewicz
>>
>> mgb wrote:
>>> Thanks Jakub
>>>
>>> That is strange, I wonder why those methods were included in the
>>> example.
>>>
>>> I have tried adding your code but do not have GraphicalViwerCreator -
>>> do you know where this class should be
>>>
>>> Cheers
>>>
>>> Mike
>>>
>>> Jakub Jurkiewicz wrote:
>>>> I've just run my editor, and I can see that neither
>>>> configureGraphicalViewer() method nor initializeGraphicalViewer() is
>>>> called (I don't have them implemented). There is only
>>>> createGraphicalViewer(Composite parent) called.
>>>> My implementation looks more less like this:
>>>> protected void createGraphicalViewer(Composite parent) {
>>>> IEditorSite editorSite = getEditorSite();
>>>> GraphicalViewer viewer = new GraphicalViewerCreator(editorSite)
>>>> .createViewer(parent);
>>>>
>>>> // hook the viewer into the EditDomain
>>>> getEditDomain().addViewer(viewer);
>>>> // acticate the viewer as selection provider for Eclipse
>>>> getSite().setSelectionProvider(viewer);
>>>> // set the viewer's content
>>>> viewer.setContents(screen);
>>>>
>>>> this.graphicalViewer = viewer;
>>>>
>>>> }
>>>>
>>>> Check this and let me know how it goes.
>>>>
>>>> Jakub Jurkiewicz
>>
|
|
|
Re: Graphical editor start problem - setFocus [message #461566 is a reply to message #461412] |
Fri, 12 January 2007 06:37  |
Eclipse User |
|
|
|
Originally posted by: eclipse.patcom.demon.co.uk
Problem solved - it apears to be a mismatch of versions problem. I had
3.2 GEF in a 3.1.1 Eclipse, with everything moved to a 3.1.1 eclipse
with a 3.1.1 GEF the Editor now starts.
However within the PaletteFactory, I had to change
com.wcg.catalyst.common.designer.model.EllipticalFigure.clas s to new
com.wcg.catalyst.common.designer.model.EllipticalFigure().ge tClass() in
the CombinedTemplateCreationEntry constructor
Many thanks for your help
Cheers
Mike
Jakub Jurkiewicz wrote:
> No, GraphicalViewerImpl class is from org.eclipse.gef.ui.parts package.
>
> I don't have any clue what can be wrong. Could you show me your
> plugin.xml file?
> Did you look at this tutotial:
> http://www.eclipse.org/articles/Article-GEF-diagram-editor/s hape.html -
> it shows how to build shape editor.
>
> If you still have this problem I can still try to help you.
> And if you find what was wrong, please tell me what was it, ok?
>
> regards
> Jakub Jurkiewicz
>
> mgb wrote:
>> Hello Jakub
>>
>> I do appreciate your help, but I am afraid we are still not there, is
>> GraphicalViewerImpl one of your classes ?
>>
>> This would still be a problem as the createGraphicalViwer method does
>> not get fired, I think the initial problem must lie outside of the
>> Editor in the way the workbench starts the Editor.
>>
>> In the shapes example, the Editor is associated with a resource and in
>> the plugin, it has an extension of shapes. The wizard starts the
>> Editor by using
>>
>> IDE.openEditor(page, newFile, true);
>>
>> Some thing in this route must cause the graphical viewer to be
>> instantiated an set into the Editor attribute graphialViewer because
>> in the shapes example, the only two methods to do with the graphical
>> viewer are the configureGraphicalViewer and initializeGraphicalViewer,
>> both of which expect the graphicalViewer attribute to be already
>> populated.
>>
>> I had assumed that the editor super class,
>> GraphicalEditorWithFlyoutPalette, created the viewer and populated the
>> graphicalViewer attribute, but it does not seam to.
>>
>> Many thanks
>>
>> Mike
>> Jakub Jurkiewicz wrote:
>>> Sorry for that, class GraphicalViwerCreator was my class. I've put
>>> the code from GraphicalViewerCreator#createViewer to the
>>> createGraphicalViewer method and for me it works, so check it:
>>> protected void createGraphicalViewer(Composite parent) {
>>> IEditorSite editorSite = getEditorSite();
>>> GraphicalViewer viewer = new GraphicalViewerImpl();
>>> viewer.createControl(parent);
>>> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
>>> viewer.setEditPartFactory(new ScreenEditPartFactory());
>>> viewer.getControl().setBackground(ColorConstants.white);
>>>
>>> getEditDomain().addViewer(viewer);
>>> getSite().setSelectionProvider(viewer);
>>> viewer.setContents(screen);
>>>
>>> this.graphicalViewer = viewer;
>>>
>>> }
>>>
>>> I hope this works!
>>> Jakub Jurkiewicz
>>>
>>> mgb wrote:
>>>> Thanks Jakub
>>>>
>>>> That is strange, I wonder why those methods were included in the
>>>> example.
>>>>
>>>> I have tried adding your code but do not have GraphicalViwerCreator
>>>> - do you know where this class should be
>>>>
>>>> Cheers
>>>>
>>>> Mike
>>>>
>>>> Jakub Jurkiewicz wrote:
>>>>> I've just run my editor, and I can see that neither
>>>>> configureGraphicalViewer() method nor initializeGraphicalViewer()
>>>>> is called (I don't have them implemented). There is only
>>>>> createGraphicalViewer(Composite parent) called.
>>>>> My implementation looks more less like this:
>>>>> protected void createGraphicalViewer(Composite parent) {
>>>>> IEditorSite editorSite = getEditorSite();
>>>>> GraphicalViewer viewer = new
>>>>> GraphicalViewerCreator(editorSite)
>>>>> .createViewer(parent);
>>>>>
>>>>> // hook the viewer into the EditDomain
>>>>> getEditDomain().addViewer(viewer);
>>>>> // acticate the viewer as selection provider for Eclipse
>>>>> getSite().setSelectionProvider(viewer);
>>>>> // set the viewer's content
>>>>> viewer.setContents(screen);
>>>>>
>>>>> this.graphicalViewer = viewer;
>>>>>
>>>>> }
>>>>>
>>>>> Check this and let me know how it goes.
>>>>>
>>>>> Jakub Jurkiewicz
>>>
|
|
|
Goto Forum:
Current Time: Thu Mar 27 01:11:34 EDT 2025
Powered by FUDForum. Page generated in 0.05430 seconds
|