Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » One diagram editor for two child objects
One diagram editor for two child objects [message #192086] Wed, 11 June 2008 13:45 Go to next message
Eclipse UserFriend
Originally posted by: quya01.yahoo.com

Hi, I'm new to GMF and to this forum. Please let me know if my question is
not clear.

The ecore model that I'm working on has an abstract class A that has two
subclasses B and C. I want to use the same diagram editor for instances of
both B and C. Can someone tell me is this possible ? And how to do this
please.

Thanks.
Re: One diagram editor for two child objects [message #192151 is a reply to message #192086] Wed, 11 June 2008 15:45 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello mar,

It should be possible. Try creating diagram editor using A as a domainMetaElement
for the diagram.

-----------------
Alex Shatalin
Re: One diagram editor for two child objects [message #192227 is a reply to message #192151] Thu, 12 June 2008 04:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quya01.yahoo.com

Hi Alex, thanks for your suggestion. Do you mean in mydiagram.gmfmap, for
'canvas mapping', property: domain meta information->element, I define its
value as A?

I did that but when I attempt to generated gmfgen model, there is problem
generating it saying the message 'top-level container must be concrete'.

Are there any other solutions? Thanks.
Re: One diagram editor for two child objects [message #192274 is a reply to message #192227] Thu, 12 June 2008 11:09 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello mar,

> Are there any other solutions? Thanks.
Try ignoring this message and generating the code. As a result you'll get
some compilation errors probably in the diagram initialization. You can try
to correct them manually and then you shoud be able to initialize diagrams
for the exisitng models (with B/C used as a roots).

-----------------
Alex Shatalin
Re: One diagram editor for two child objects [message #192816 is a reply to message #192274] Mon, 16 June 2008 11:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quya01.yahoo.com

Try ignoring this message and generating the code. As a result you'll get
some compilation errors probably in the diagram initialization. You can
try to correct them manually and then you shoud be able to initialize
diagrams for the exisitng models (with B/C used as a roots).

Many thanks for your response Alex. But my model still not work. Maybe
because I do not know how to initialize diagrams. Could you help me
please. Really appreciate that.
Re: One diagram editor for two child objects [message #192839 is a reply to message #192816] Mon, 16 June 2008 11:53 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello mar,

> Many thanks for your response Alex. But my model still not work. Maybe
> because I do not know how to initialize diagrams. Could you help me
> please. Really appreciate that.
So, the code was generated and compilation errors were corrected? Now try
calling popup menu action "Initialize ...diagram" on the file with the model
elements (B/C) inside.

-----------------
Alex Shatalin
Re: One diagram editor for two child objects [message #193302 is a reply to message #192839] Wed, 18 June 2008 16:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quya01.yahoo.com

So, the code was generated and compilation errors were corrected? Now try
calling popup menu action "Initialize ...diagram" on the file with the
model elements (B/C) inside.

Hi again, yes, the codes was generated and compilation errors were
corrected. Sorry I'm not quite sure about pop up menu action. Anyway, I
manage to open the editor for one of the subclass say B when I click on
the 'open' button but nothing happen for C. I debug and find out that
unlike B, there is no resource/path for the created instance of object C
in the binary file DeltaDataTree.class. Do you have any idea what when
wrong? Thanks in advance.
Re: One diagram editor for two child objects [message #193498 is a reply to message #193302] Thu, 19 June 2008 09:08 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello mar,

> corrected. Sorry I'm not quite sure about pop up menu action. Anyway,
Here is an example for .mindmap domain model: http://www.eclipse.org/modeling/gmf/new/images1.0/initdiagra mfileaction.png

-----------------
Alex Shatalin
Re: One diagram editor for two child objects [message #193664 is a reply to message #193498] Thu, 19 June 2008 12:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: quya01.yahoo.com

Thanks Alex for the sample but Sorry, mine is different pop up menu? There
is no Initialize..diagram file but there is Create generator model...apart
from other menu.

Could you also tell me how do I get the source for the binary file? Thanks
Alex.
Re: One diagram editor for two child objects [message #193712 is a reply to message #193664] Thu, 19 June 2008 14:30 Go to previous messageGo to next message
Mar Yah is currently offline Mar YahFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Alex, let me explain what I'm trying to do

The initialize diagram pop up menu has been disabled. A button is used to
invoke a common open diagram method. The ViewService.createDiagram()
method returns a null diagram. Attached below is the openDiagram method:

public static void openDiagram(final UMLBelement element, final
IWorkbenchPart part, final String kind, final PreferencesHint hint) throws
Exception {
final Resource diagramResource;
IFile diagramFile = null;
TransactionalEditingDomain editingDomain =
GMFEditingDomainFactory.INSTANCE.createEditingDomain();
IFile selectedModelFile =
WorkspaceSynchronizer.getFile(element.getContaining_UMLBProj ect().eResource());
diagramResource =
editingDomain.getResourceSet().createResource(DiagramUtiliti es.getDiagramURI(element));
try {
diagramFile = WorkspaceSynchronizer.getFile(diagramResource);
} catch (WrappedException ex) {
MessageDialog.openError(part.getSite().getShell(), "Error", "diagram
file loading failed");
}
if (diagramFile.exists()) try {
IDE.openEditor(part.getSite().getPage(), diagramFile);
} catch (PartInitException e) {
MessageDialog.openError(part.getSite().getShell(), "Error", "Diagram
file loading failed");
}
else if
(part.getSite().getPage().saveEditor(part.getSite().getPage( ).getActiveEditor(),
false)) {
if (part.getSite().getPage().getActiveEditor().isDirty() == true) {
MessageDialog.openWarning(part.getSite().getShell(), "Warning", "This
diagram needs to be saved before another can be created");
return;
} else {
List<IFile> affectedFiles = new LinkedList<IFile>();
affectedFiles.add(selectedModelFile);
affectedFiles.add(diagramFile);
AbstractTransactionalCommand command = new
AbstractTransactionalCommand(editingDomain, "Initializing diagram
contents", affectedFiles) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
Diagram diagram = ViewService.createDiagram(element, kind, hint);
diagramResource.getContents().add(diagram);
return CommandResult.newOKCommandResult();
}
};
OperationHistoryFactory.getOperationHistory().execute(comman d, new
NullProgressMonitor(), null);
diagramResource.save(Collections.EMPTY_MAP);
IDE.openEditor(part.getSite().getPage(), diagramFile);
}
}
}

Really looking forward your help. Thanks in advance
Re: One diagram editor for two child objects [message #194248 is a reply to message #193302] Tue, 24 June 2008 09:39 Go to previous message
Mar Yah is currently offline Mar YahFriend
Messages: 6
Registered: July 2009
Junior Member
Sorry, correction..cannot open the diagram editor for both instances of
children B and C.
Previous Topic:Connection information between the Components getting interchanged
Next Topic:GMF 2.1 migration from GMF 2.0
Goto Forum:
  


Current Time: Thu Apr 25 05:11:55 GMT 2024

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

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

Back to the top