Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Accessing Selected object in VE


Hi Rashmi,
        It looks like you might be using an older version of VE (1.1.0.1). Unfortunately I was looking at the latest
source which has this API (VE 1.2 M1). It was added when providing JFace support for VE. For the old code you
could use '((EditPartViewer) JavaVisualEditorPart.getAdapter(EditPartViewer.class)).getEditDomain()' which
gives you the GEF EditDomain. This can be safely cast as the CDE's EditDomain which has access to the
getDiagramData().
Regards,
Sri.





"H Ramachandra, Rashmi" <rashmi.h.ramachandra@xxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

12/29/2005 01:38 AM

Please respond to
Discussions people developing code for the Visual Editor project

To
"Discussions people developing code for the Visual Editor project" <ve-dev@xxxxxxxxxxx>
cc
Subject
RE: [ve-dev] Accessing Selected object in VE





Hi Srimanth,
    Thanks for the input. I was able to assign a selection listener to the JavaVisualEditor. Its working fine. I can display the kind of object that is being selected by doing toString() to the selection object. Casting it to IJavaInstance provides with further functionalities. But I am unable to get the edit domain for the JavaVisualEditorPart as the required method ' getEditDomain()' does not seem to exist.
I want to loop through all the components from the root model to get to the component which i want it to be selected.
 
Can you please help me out.
 
Thank You and Regards
Rashmi H.Ramachandra
 
 


From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx] On Behalf Of Srimanth Gunturi
Sent:
Tuesday, 27 December 2005 10:54 PM
To:
Discussions people developing code for the Visual Editor project
Subject:
Re: [ve-dev] Accessing Selected object in VE



Hi Rashmi,


> how do I get the selected component on the visual editor canvas?

If you can get the EditorPart (JavaVisualEditorPart), you can add a listener to its site's page's selection provider -
       getSite().getPage().addSelectionListener(new ISelectionListener(){

               public void selectionChanged(IWorkbenchPart part, ISelection selection) {

                       System.out.println("Selection Changed!");

               }

       });


>
How do I get access to the root model
'JavaVisualEditorPart.getEditDomain().getDiagramData()' will give you the root model. You can cast it to the 'BeanSubclassComposition' class to access the this type, the components etc.

Or if you are coming from Codegen's model, 'IBeanDeclModel.getCompositionModel().getModelRoot()' should give you the 'BeanSubclassComposition' also.


> and the IJAvaInstance of the selected object.

When you get the GEF EditPart of the selected object as described above, just do a 'getModel()' on the EditPart to get the IJavaInstance.


Regards,

Sri.



"H Ramachandra, Rashmi" <rashmi.h.ramachandra@xxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

12/26/2005 11:40 PM

Please respond to
Discussions people developing code for the Visual Editor project


To
<ve-dev@xxxxxxxxxxx>
cc
Subject
[ve-dev] Accessing Selected object in VE







hi all,

how do I get the selected component on the visual editor canvas?

How do I get access to the root model and the IJAvaInstance of the selected object.
I have tried to go through source code of 'org.eclipse.ve.internal.java.codegen.editorpart.BeansList'

and 'org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEditorPart'. I am not able to find any entry point for accessing selected objects.

My requirement is to build a tree that partially replicates the JavaBean View to show both visual and non-visual components present in the java file in the form of a tree.Is there any API provided for developers to access the components in the visual editor. I have tried going through the current API and the source code available for tracking the JavaBean View components, but it has not been fruitful

Can anybody please help.
-rashmi
_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top