Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Exception when generating diagram code from .gmfgen
Exception when generating diagram code from .gmfgen [message #195269] Wed, 02 July 2008 09:01 Go to next message
Patry Olivier is currently offline Patry OlivierFriend
Messages: 54
Registered: July 2009
Member
Hello,

I'm using Eclipse Ganymede (Modeling tools version) and working on a
EMF/GMF project.

I follow the GMF process for code generation :
* .ecore
* .genmodel -> generate model (edit, editor)
* .gmfgraph
* .gmftool
* .gmfmap -> generator model
* .gmfgen -> generate diagram code
##### Exception :

Exception occurred while generating code
Ambiguous definitions
xpt::editor::DocumentProvider::fileEditorInputClassFQName FOR
gmfgen::GenDiagram and
aspects::xpt::editor::DocumentProvider::fileEditorInputClass FQName FOR
gmfgen::GenDiagram for param types []


I didn't understand this exception.
I saw a similar problem on this thread :
news://eclipse.modeling.gmf:80/c6f1ac739ee35b4cf43ba2846fe01 51c$1@www.eclipse.org

but the solution seems to be unappropriate for me, I didn't have the
second problem mentioned by him.

Thanks,

Olivier PATRY
Re: Exception when generating diagram code from .gmfgen [message #195338 is a reply to message #195269] Wed, 02 July 2008 11:18 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Olivier,

> Exception occurred while generating code
> Ambiguous definitions
> xpt::editor::DocumentProvider::fileEditorInputClassFQName FOR
> gmfgen::GenDiagram and
> aspects::xpt::editor::DocumentProvider::fileEditorInputClass FQName FOR
> gmfgen::GenDiagram for param types []
Sounds rather strange. Can you try to generate one of the GMF example diagrams
to make sure GMF itself was installed properly?

-----------------
Alex Shatalin
Re: Exception when generating diagram code from .gmfgen [message #195395 is a reply to message #195338] Wed, 02 July 2008 12:34 Go to previous messageGo to next message
Patry Olivier is currently offline Patry OlivierFriend
Messages: 54
Registered: July 2009
Member
Alex Shatalin a écrit :
> Hello Olivier,
>
>> Exception occurred while generating code
>> Ambiguous definitions
>> xpt::editor::DocumentProvider::fileEditorInputClassFQName FOR
>> gmfgen::GenDiagram and
>> aspects::xpt::editor::DocumentProvider::fileEditorInputClass FQName FOR
>> gmfgen::GenDiagram for param types []
> Sounds rather strange. Can you try to generate one of the GMF example
> diagrams to make sure GMF itself was installed properly?
>
> -----------------
> Alex Shatalin
>
>

Hi, thanks for answer.

I test the GMF Tutorial, it works (quite) as expected, no error found,
execution ok. (Features seems to not work as expected, maybe a personal
error)

So, the code generation works well on a "from scratch" example.
Notice that my project was created by someone else with an older version
of eclipse(3.3)/emf/gmf(sdk 2.0).

I use the "migrate to GMF 2.1" command on the popup menu on *.gmfgraph
*.gmfmap

I take a look on xpt files but it wasn't clear for me.

Thanks, regards,
Olivier
Re: Exception when generating diagram code from .gmfgen [message #195427 is a reply to message #195395] Wed, 02 July 2008 16:37 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Olivier,

Looks like you have custom template in aspects/xpt/editor/DocumentProvider.xpt
with "DEFINE fileEditorInputClassFQName FOR gmfgen::GenDiagram".
You have to change this definition to "AROUND fileEditorInputClassFQName
FOR gmfgen::GenDiagram".

-----------------
Alex Shatalin
Re: Exception when generating diagram code from .gmfgen [message #195530 is a reply to message #195427] Thu, 03 July 2008 07:36 Go to previous messageGo to next message
Patry Olivier is currently offline Patry OlivierFriend
Messages: 54
Registered: July 2009
Member
Alex Shatalin a écrit :
> Hello Olivier,
>
> Looks like you have custom template in
> aspects/xpt/editor/DocumentProvider.xpt with "DEFINE
> fileEditorInputClassFQName FOR gmfgen::GenDiagram".
> You have to change this definition to "AROUND fileEditorInputClassFQName
> FOR gmfgen::GenDiagram".
>
> -----------------
> Alex Shatalin
>
>
Hello,

unfortunatly, I got the same exception error with this modification in
my xpt file :(

I've tried this process under a Linux PC and didn't get any exception
with the same code. An idea ?

Thanks
Re: Exception when generating diagram code from .gmfgen [message #195568 is a reply to message #195530] Thu, 03 July 2008 09:45 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Olivier,

> unfortunatly, I got the same exception error with this modification in
> my xpt file :(
Can you copy a trace here?
Is it something related to template resource encoding? It should be ISO-8859-1.

-----------------
Alex Shatalin
Re: Exception when generating diagram code from .gmfgen [message #195609 is a reply to message #195568] Thu, 03 July 2008 11:33 Go to previous messageGo to next message
Patry Olivier is currently offline Patry OlivierFriend
Messages: 54
Registered: July 2009
Member
Alex Shatalin a écrit :
> Hello Olivier,
>
>> unfortunatly, I got the same exception error with this modification in
>> my xpt file :(
> Can you copy a trace here?
> Is it something related to template resource encoding? It should be
> ISO-8859-1.
>
> -----------------
> Alex Shatalin
>
>
Did you mean a trace of my xpt file?

Here an excerpt of the DocumentProvider.xpt


«DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
throw new org.eclipse.core.runtime.CoreException(new
org.eclipse.core.runtime.Status(org.eclipse.core.runtime.ISt atus.ERROR,
«editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
org.eclipse.osgi.util.NLS.bind(
«EXPAND
xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIn correctInputError())
FOR editorGen»,
new Object[] {element, «IF null == editorGen.application»"«EXPAND
fileEditorInputClassFQName»", «ENDIF»"«EXPAND
uriEditorInputClassFQName»"}), «EXPAND xpt::Common::nonNLS(1)»«IF null
== editorGen.application» «EXPAND xpt::Common::nonNLS(2)»«ENDIF»
null));
«ENDDEFINE»


«DEFINE fileEditorInputClassFQName FOR
gmfgen::GenDiagram»org.eclipse.ui.part.FileEditorInput«END DEFINE»

«DEFINE uriEditorInputClassFQName FOR
gmfgen::GenDiagram»org.eclipse.emf.common.ui.URIEditorInput «ENDDEFINE»



How is this problem related with encoding issue? The ISO-8829-1 encoding
is for the xpt files ?

Thanks again for helping
Re: Exception when generating diagram code from .gmfgen [message #195624 is a reply to message #195609] Thu, 03 July 2008 12:12 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Olivier,

>>> unfortunatly, I got the same exception error with this modification
>>> in my xpt file :(
I have to read it more carefully. :-) I thought exception was thrown by xpand
editor.. Sorry.

> «DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
If you posted here whole content of aspects/xpt/editor/DocumentProvider.xpt
(xutom template) I do not see the reason for this template at all - it is
just copying original template contents..
I suggest you to remove "DEFINE uriEditorInputClassFQName", "DEFINE fileEditorInputClassFQName"
and call it using fully-qualified names like:
«EXPAND xpt::editor::DocumentProvider::uriEditorInputClassFQName ....

-----------------
Alex Shatalin
Re: Exception when generating diagram code from .gmfgen [message #195709 is a reply to message #195624] Thu, 03 July 2008 15:47 Go to previous messageGo to next message
Patry Olivier is currently offline Patry OlivierFriend
Messages: 54
Registered: July 2009
Member
Alex Shatalin a écrit :
> Hello Olivier,
>
>>>> unfortunatly, I got the same exception error with this modification
>>>> in my xpt file :(
> I have to read it more carefully. :-) I thought exception was thrown by
> xpand editor.. Sorry.
>
>> «DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
> If you posted here whole content of
> aspects/xpt/editor/DocumentProvider.xpt (xutom template) I do not see
> the reason for this template at all - it is just copying original
> template contents..
> I suggest you to remove "DEFINE uriEditorInputClassFQName", "DEFINE
> fileEditorInputClassFQName" and call it using fully-qualified names like:
> «EXPAND xpt::editor::DocumentProvider::uriEditorInputClassFQName ....
>
> -----------------
> Alex Shatalin
>
>
Hi,

I paste here the DocumentProvider.xpt

/*
* Copyright (c) 2007 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexander Shatalin (Borland) - initial API and implementation
*/

«IMPORT "http://www.eclipse.org/gmf/2006/GenModel
«EXTENSION xpt::editor::Utils»

«AROUND doSaveDocument FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor
monitor, Object element,
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .IDocument
document, boolean overwrite) throws org.eclipse.core.runtime.CoreException {
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
if (!overwrite && !info.isSynchronized()) {
throw new org.eclipse.core.runtime.CoreException(new
org.eclipse.core.runtime.Status(org.eclipse.core.runtime.ISt atus.ERROR,
«editorGen.plugin.getActivatorQualifiedClassName()».ID,
«IF null ==
editorGen.application»org.eclipse.core.resources.IResourceS tatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.ISta tus.ERROR«ENDIF»,

«EXPAND
xpt::Externalizer::accessorCall(i18nKeyForDocumentUnsynchron izedFileSaveError())
FOR editorGen»,
null));
}
«IF null == editorGen.application-»
info.stopResourceListening();
«ENDIF-»
fireElementStateChanging(element);
java.util.List resources = info.getResourceSet().getResources();
try {
monitor.beginTask(«EXPAND
xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveDiagra mTask()) FOR
editorGen», resources.size() + 1 + 1); //"Saving diagram"
monitor.subTask("Validating on save");
org.eclipse.gmf.runtime.notation.Diagram diagram =
(org.eclipse.gmf.runtime.notation.Diagram) document.getContent();
ValidateAction.runValidation(diagram); // delegate validation
monitor.worked(1);

for (java.util.Iterator it = resources.iterator(); it.hasNext();) {
org.eclipse.emf.ecore.resource.Resource nextResource =
(org.eclipse.emf.ecore.resource.Resource) it.next();
monitor.setTaskName(org.eclipse.osgi.util.NLS.bind(
«EXPAND
xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveNextRe sourceTask())
FOR editorGen»,
nextResource.getURI()));
if (nextResource.isLoaded() &&
!info.getEditingDomain().isReadOnly(nextResource)) {
try {
nextResource.save(«EXPAND xpt::Common::getSaveOptions»);
} catch (java.io.IOException e) {
fireElementStateChangeFailed(element);
throw new org.eclipse.core.runtime.CoreException(new
org.eclipse.core.runtime.Status(org.eclipse.core.runtime.ISt atus.ERROR,
«editorGen.plugin.getActivatorQualifiedClassName()».ID,
org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal .EditorStatusCodes.RESOURCE_FAILURE,
e.getLocalizedMessage(), null));
}
}
monitor.worked(1);
}
monitor.done();
info.setModificationStamp(computeModificationStamp(info));
} catch (RuntimeException x) {
fireElementStateChangeFailed(element);
throw x;
} «IF null == editorGen.application» finally {
info.startResourceListening();
} «ENDIF»
} else {
org.eclipse.emf.common.util.URI newResoruceURI;
java.util.List affectedFiles = null;
«IF null == editorGen.application»if (element instanceof «EXPAND
fileEditorInputClassFQName») {
org.eclipse.core.resources.IFile newFile = ((«EXPAND
fileEditorInputClassFQName») element).getFile();
affectedFiles = java.util.Collections.singletonList(newFile);
newResoruceURI =
org.eclipse.emf.common.util.URI.createPlatformResourceURI(ne wFile.getFullPath().toString(),
true);
} else «ENDIF»if(element instanceof «EXPAND uriEditorInputClassFQName») {
newResoruceURI = ((«EXPAND uriEditorInputClassFQName») element).getURI();
} else {
fireElementStateChangeFailed(element);
«EXPAND throwIncorrectInputException-»
}
if (false == document instanceof
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .IDiagramDocument)
{
fireElementStateChangeFailed(element);
throw new org.eclipse.core.runtime.CoreException(new
org.eclipse.core.runtime.Status(org.eclipse.core.runtime.ISt atus.ERROR,
«editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
"Incorrect document used: " + document + " instead of
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .IDiagramDocument ",
null)); «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
}

org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .IDiagramDocument
diagramDocument =
(org.eclipse.gmf.runtime.diagram.ui.resources.editor.documen t.IDiagramDocument)
document;
final org.eclipse.emf.ecore.resource.Resource newResource =
diagramDocument.getEditingDomain().getResourceSet().createRe source(newResoruceURI);
final org.eclipse.gmf.runtime.notation.Diagram diagramCopy =
(org.eclipse.gmf.runtime.notation.Diagram)
org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.ge tDiagram());
try {
new
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand(diagramDocument.getEditingDomain(),
org.eclipse.osgi.util.NLS.bind(«EXPAND
xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveAs()) FOR
editorGen», diagramCopy.getName()), affectedFiles) {
protected org.eclipse.gmf.runtime.common.core.command.CommandResult
doExecuteWithResult(org.eclipse.core.runtime.IProgressMonito r monitor,
org.eclipse.core.runtime.IAdaptable info) throws
org.eclipse.core.commands.ExecutionException {
newResource.getContents().add(diagramCopy);
return
org.eclipse.gmf.runtime.common.core.command.CommandResult.ne wOKCommandResult();
}
}.execute(monitor, null);
newResource.save(«EXPAND xpt::Common::getSaveOptions»);
} catch (org.eclipse.core.commands.ExecutionException e) {
fireElementStateChangeFailed(element);
throw new org.eclipse.core.runtime.CoreException(new
org.eclipse.core.runtime.Status(org.eclipse.core.runtime.ISt atus.ERROR,
«editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
e.getLocalizedMessage(), null));
} catch (java.io.IOException e) {
fireElementStateChangeFailed(element);
throw new org.eclipse.core.runtime.CoreException(new
org.eclipse.core.runtime.Status(org.eclipse.core.runtime.ISt atus.ERROR,
«editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
e.getLocalizedMessage(), null));
}
newResource.unload();
}
}
«ENDAROUND»

«DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
throw new org.eclipse.core.runtime.CoreException(new
org.eclipse.core.runtime.Status(org.eclipse.core.runtime.ISt atus.ERROR,
«editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
org.eclipse.osgi.util.NLS.bind(
«EXPAND
xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIn correctInputError())
FOR editorGen»,
new Object[] {element, «IF null == editorGen.application»"«EXPAND
fileEditorInputClassFQName»", «ENDIF»"«EXPAND
uriEditorInputClassFQName»"}), «EXPAND xpt::Common::nonNLS(1)»«IF null
== editorGen.application» «EXPAND xpt::Common::nonNLS(2)»«ENDIF»
null));
«ENDDEFINE»


«DEFINE fileEditorInputClassFQName FOR
gmfgen::GenDiagram»org.eclipse.ui.part.FileEditorInput«END DEFINE»

«DEFINE uriEditorInputClassFQName FOR
gmfgen::GenDiagram»org.eclipse.emf.common.ui.URIEditorInput «ENDDEFINE»



If I understood you correctly, this template do nothing at all. It juste
copy things ? I'll try to modify things as you said but I didn't know
the xpt usage.

Goodbye,
Re: Exception when generating diagram code from .gmfgen [message #195726 is a reply to message #195624] Thu, 03 July 2008 15:53 Go to previous messageGo to next message
Patry Olivier is currently offline Patry OlivierFriend
Messages: 54
Registered: July 2009
Member
Alex Shatalin a écrit :
> Hello Olivier,
>
>>>> unfortunatly, I got the same exception error with this modification
>>>> in my xpt file :(
> I have to read it more carefully. :-) I thought exception was thrown by
> xpand editor.. Sorry.
>
>> «DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
> If you posted here whole content of
> aspects/xpt/editor/DocumentProvider.xpt (xutom template) I do not see
> the reason for this template at all - it is just copying original
> template contents..
> I suggest you to remove "DEFINE uriEditorInputClassFQName", "DEFINE
> fileEditorInputClassFQName" and call it using fully-qualified names like:
> «EXPAND xpt::editor::DocumentProvider::uriEditorInputClassFQName ....
>
> -----------------
> Alex Shatalin
>
>
Me again, I answer my self.

I delete the last parts of the xpt file (throwIncorrectInputException to
end) and the code generation works fine.

Is it a good way to solve this issue?
What is this code used for?

Thanks again,
Re: Exception when generating diagram code from .gmfgen [message #195773 is a reply to message #195726] Fri, 04 July 2008 11:46 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Olivier,

> Is it a good way to solve this issue?
Well, the "tail" of this template (throwIncorrectInputException, fileEditorInputClassFQName
, uriEditorInputClassFQName) looks not necessary because you are just copying
original template.. Here you can either call original DEFINEs orcreate your
custom one with different parameters... "aspects" folder was designed to
hold "arounds" for the original templates + some custom DEFINEs. If you'd
like to override original DEFINE completely you can put corresponding custom
template in a folder without "aspects" top-level folder...

> What is this code used for?
It is a question to an author of this custom template.. ;-)

-----------------
Alex Shatalin
Previous Topic:Cannot delete connection when specified field in the property is filled in with content
Next Topic:setroutingconstraint curve problem
Goto Forum:
  


Current Time: Tue Apr 23 17:57:31 GMT 2024

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

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

Back to the top