DZone Forums
Go Back   DZone Forums > Community > Tools & IDEs > Eclipse
Reload this Page Problem with gmf
Notices
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Feb 2011
Default Problem with gmf - 02-24-2011, 05:20 AM

Hi,

i'm new in GMF, i created a GMF model with the eclass "Support",
this eclass has a field "chemin",
in the "supportEditPart" i try to set the field "fFigureSupportCheminFigure" with te path of file returned by a JFileChooser,
the fFigureSupportCheminFigure's text is changed in the diagram, but the field "chemin" in the model doesn't change,

see below the code in "supportEditPart" :


fFigureSupportCheminFigure.addMouseListener(new MouseListener() {

public void mousePressed(MouseEvent me) {
JFileChooser fileChooser = new JFileChooser();
int returnValue = fileChooser.showOpenDialog(null);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
fFigureSupportCheminFigure.setText(selectedFile.ge tAbsolutePath }}
public void mouseReleased(MouseEvent me) {
// TODO Auto-generated method stub
}
public void mouseDoubleClicked(MouseEvent me) {
// TODO Auto-generated method stub
}});

this.add(fFigureSupportCheminFigure);

thank you very much, i'm really in big problem!!
Reply With Quote
  (#2 (permalink)) Old
Member
 
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Join Date: Mar 2011
Default 03-06-2011, 11:22 PM

hi momo
I think the reason is that you only set figure's text but not change the model. There are two kind models, one is the semantic model(EMF), anothor is the annotation model in GMF.
You can obtain the annotation model via the getModel() method of editpart and then you can obtain the semantic model.

Hope can help you!
Reply With Quote
  (#3 (permalink)) Old
Member
 
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Feb 2011
Default 03-09-2011, 05:21 AM

TKS chayton,
I use a transaction to modify the model, and it works well,
Now I have another problem
I need to put my RectangleFigure into a scrollpane, put i don't know how to proceed,
Any idea about this?

THKS a lot
Reply With Quote
Reply

Tags
emf, gmf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com