Home » Modeling » GMF (Graphical Modeling Framework) » Exception when generating diagram code from .gmfgen
| |
Re: Exception when generating diagram code from .gmfgen [message #195395 is a reply to message #195338] |
Wed, 02 July 2008 12:34 |
Patry Olivier 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 #195609 is a reply to message #195568] |
Thu, 03 July 2008 11:33 |
Patry Olivier 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 #195709 is a reply to message #195624] |
Thu, 03 July 2008 15:47 |
Patry Olivier 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,
|
|
| | |
Goto Forum:
Current Time: Wed Apr 17 21:10:15 GMT 2024
Powered by FUDForum. Page generated in 0.02655 seconds
|