Problem in retrieving the selected editpart from diagram editor [message #44287] |
Mon, 11 September 2006 04:46 |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_004A_01C6D5AC.E0DD0470
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I have attached some tabbed property sections to my gmf diagram editor.
One of these property section displays a full-fledged editor ( kinda =
JavaEditor)
This editor extends TextEditor and is created using the editor site of =
GMF diagram editor as shown in the code.
Then we load the editor content from one of the domain element / default =
source.
The editor is displayed just fine in the section.=20
But as I select a different editpart in the diagram editor it always =
gets me the TextSelection containing the Document holding the reference =
to the text editor instead of the editpart.
How can I reset the workbench selection and get the selected editpart ?
------------------------------------------------------------ -------------=
------------------------------------------------------------ -------------=
---------------------------------
public class RuleEditorSection extends AbstractModelerPropertySection {
public void doCreateControls(Composite parent, TabbedPropertySheetPage =
aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
=
diagramEditor=3DMyDiagramEditorPlugin.getInstance().getWorkb ench().getAct=
iveWorkbenchWindow().getActivePage().getActiveEditor();
String docSource =3D getSourceFromTemplate(); =20
ruleEditor =3D new RuleEditor();
ruleEditor.setSite(diagramEditor.getSite());=20
ruleEditor.setInput(diagramEditor.getEditorInput());
=
ruleEditor.getDocumentProvider().getDocument(ruleEditor.getE ditorInput())=
..set(docSource);
ruleEditor.createPartControl(parent);
}
~ Kaniska
------=_NextPart_000_004A_01C6D5AC.E0DD0470
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have attached some tabbed property =
sections to my=20
gmf diagram editor.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>One of these property section displays =
a=20
<STRONG>full-fledged editor</STRONG> ( kinda JavaEditor)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>This editor extends TextEditor and is =
created using=20
the <STRONG>editor site</STRONG> of GMF diagram editor as shown in the=20
code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Then we load the editor =
content from one of=20
the domain element / default source.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The editor is displayed just fine in =
the section.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>But as I select a different =
editpart in the=20
diagram editor</STRONG> it always gets me the =
<STRONG>TextSelection</STRONG>=20
containing the <STRONG>Document </STRONG>holding the reference to the =
text=20
editor instead of the editpart.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><STRONG>How can I reset =
the workbench=20
selection and get the selected editpart ?</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2> ------------------------------------------------------------ ----=
------------------------------------------------------------ -------------=
------------------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>public class =
<STRONG>RuleEditorSection</STRONG>=20
extends AbstractModelerPropertySection {</FONT></DIV>
<DIV>
<P align=3Dleft><FONT face=3DArial size=3D2><B><FONT color=3D#7f0055=20
size=3D2>public</B></FONT><FONT size=3D2> </FONT><B><FONT =
color=3D#7f0055=20
size=3D2>void</B></FONT><FONT size=3D2> doCreateControls(Composite =
parent,=20
TabbedPropertySheetPage aTabbedPropertySheetPage</FONT><FONT size=3D2>) =
{</P>
<P></FONT><B><FONT color=3D#7f0055 size=3D2>super</B></FONT><FONT=20
size=3D2>.createControls(<STRONG>parent</STRONG>,=20
aTabbedPropertySheetPage);</P></FONT></FONT>
<P align=3Dleft><FONT face=3DArial size=3D2> =20
diagramEditor=3DMyDiagramEditorPlugin.getInstance().getWorkb ench().getAct=
iveWorkbenchWindow().getActivePage().getActiveEditor();</FONT ></P>
<P align=3Dleft><FONT face=3DArial =
size=3D2> </FONT><FONT face=3DArial=20
size=3D2> String docSource =3D getSourceFromTemplate();</FONT><FONT =
face=3DArial=20
size=3D2> </FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> <STRONG> =
ruleEditor =3D=20
new RuleEditor();</STRONG></FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =20
ruleEditor.setSite(<STRONG>diagramEditor.getSite());</STRONG > =
</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2> =20
ruleEditor.setInput(diagramEditor.getEditorInput());</FONT> </P>
<P align=3Dleft><FONT face=3DArial size=3D2> =20
ruleEditor.<STRONG>getDocumentProvider().getDocument(ruleEditor.getEditor=
Input()).set</STRONG>(docSource);</FONT></P>
<P><FONT face=3DArial size=3D2> =20
ruleEditor.<STRONG>createPartControl</STRONG>(<STRONG>parent </STRONG>);</=
FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>}</FONT></P>
<P align=3Dleft><FONT face=3DArial size=3D2>~ =
Kaniska</FONT></P></DIV></BODY></HTML>
------=_NextPart_000_004A_01C6D5AC.E0DD0470--
|
|
|
Powered by
FUDForum. Page generated in 0.03005 seconds