Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to get editPart from model/diagram filename
how to get editPart from model/diagram filename [message #234537] Wed, 24 June 2009 02:09 Go to next message
Eclipse UserFriend
Hi

I want to perform some operation on all the elements in each of the
diagram files for all the project in the workspace.
I am able to get the diagram and the model filename as a IResource
object.How could i get the editPart from the filename


for now i have pasted the code by which i can get the diagram/model
fileName



IProject[] projects = null;
IProject p = null;
IFolder file = null;
IResource[] members = null;
IResource[] newFile = null;

IWorkspace workspace = ResourcesPlugin.getWorkspace();

// gets all the projects in the workspace
projects = workspace.getRoot().getProjects();
for (int i = 0; i < projects.length; i++) {
p = projects[i];
}
try {
// gets all the folders in the project
members = p.members();
}catch (Exception e){

}

file = (IFolder) p.findMember("<myrequiredfolder>");

try {
newFile = file.members();
}catch(Exception e){
Re: how to get editPart from model/diagram filename [message #234543 is a reply to message #234537] Wed, 24 June 2009 03:27 Go to previous messageGo to next message
Eclipse UserFriend
Hello sowmya,

> the diagram and the model filename as a IResource object.How could i
> get the editPart from the filename
You have to open an editor then you'll be able to interact with EditParts.
I suggest you to use Notation/DomainModel API for these modifications. Nearly
all the necessary information is available through these APIs.
To get Notation model instances you simply have to load EMF resource from
the diagrfam file and then you'll see Diagram instance just in the root of
this resource.

-----------------
Alex Shatalin
Re: how to get editPart from model/diagram filename [message #234548 is a reply to message #234543] Wed, 24 June 2009 03:39 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Alex.
But i am trying to get the diagram editparts without opening the diagram
file.

At the time of launching the runtime workbench i am retriveing all the
projects and the diagram files in it. I need to perform some check for all
the elements in all diagram files in all projects before the runtime
launches completely .

Is there any way i can be doing this
Re: how to get editPart from model/diagram filename [message #234554 is a reply to message #234548] Wed, 24 June 2009 05:31 Go to previous message
Eclipse UserFriend
Hello sowmya,

As I already said, you can use Notation model API to perform nearly all the
checks/modifications you need (without openning an editor).
Another option (if you really need EditParts) is to open diagram in a viewer
without actual UI. This is a GEF-related question and AFAIK GEF allows it.

-----------------
Alex Shatalin
Previous Topic:EMF GMF Integration - Delete key
Next Topic:Use GMF with an UML Profile as meta-model
Goto Forum:
  


Current Time: Sat Jul 19 18:37:56 EDT 2025

Powered by FUDForum. Page generated in 0.04052 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top