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,
        If all you want to do is select a particular IJavaInstance, a simpler way is to get the list of
EditPartViewers from editDomain.getViewers(), and in each viewer's 'EditPartRegistry' check to
see if the IJavaInstance has an EditPart. If it does, you can do a EditPartViewer.select(EditPart).
        The 'setSelection(IJavaElement)' is on the JavaEditor and not the VE Editor.
Regards,
Sri.




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

01/03/2006 06:45 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,
    Thank you.I am able to get the EditDomain and loop through the components of DiagramData. The components are in the form of IJavaInstance. Even the selection listener gives the selected object in the form of IJavaInstance. But the method 'JavaVisualEditorPart.setSelection(IJavaElement) ' accepts IJavaElement.
I have two questions here.
 
1.) How do I extract or convert the IJavaInstance to corresponding  IJavaElement( for getting it selected on the VisualEditor.)?
 
2.) How do I get the live instance of the component being selected? i.e If I select a JButton on the panel , I want to get a live instance of JButton ( handle to JButton object).
 
Any help this regard is greatly appreciated.
Thank You and Best Regards,
Rashmi H.Ramachandra


From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx] On Behalf Of Srimanth Gunturi
Sent:
Saturday, 31 December 2005 1:30 AM
To:
Discussions people developing code for the Visual Editor project
Subject:
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_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top