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,

> 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


Back to the top