Home » Modeling » TMF (Xtext) » Duplicate declarations with cross reference
|
Re: Duplicate declarations with cross reference [message #1008580 is a reply to message #1008481] |
Wed, 13 February 2013 07:44 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
As an alterantive, you could try to derive the actual declaration on
demand and use cross references in all other places. We are using this
approach in languages that don't provide an explicit declaration for all
model elements.
I.e., if one of your models refers to a variable, it's looked up in the
scope, and if it doesn't exist yet, its definition is inferred (created)
using the IDerivedStateComputer mechanism. The referring element than
points to this declaration. This way you keep a single definition of
each element and an arbitrary number of cross-references to it.
Am 12.02.13 17:55, schrieb Hao Xie:
> The language we used for modeling doesn't have a clear scope concept
> which makes implementation of scoping very hard in Xtext.
> For example, the same variable of "A" is defined two locations in a
> model, but the usage of the variable A (cross references) can be link to
> one of the two declarations only during run time. During the editing, it
> is very hard to tell a usage should be cross referenced to which
> declaration. Generally all the usages and declarations for the same
> variable are linked together. I can explain with an example if needed.
> An easy way I can think of is to link all the cross references with the
> two declarations all together. When a refactor is conducted, all the
> cross references and two declarations are all changed together without
> distinguish which declarations are used or what scope a cross reference
> belongs to.
>
> The default cross reference mechanism is different from what I expected.
> The default cross reference will link some of the usages to one
> declaration and other usages to the other declaration based on
> calculations from its internal scheme, which generally is not right
> according to my code or purpose.
>
> Do you think I can group all the usages and all the declaration for the
> same variable into one set of cross references without distinguishing
> the scope of each individual declaration?
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
| | | | |
Re: Duplicate declarations with cross reference [message #1010100 is a reply to message #1010023] |
Sat, 16 February 2013 14:47 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I used XText 2.4.
I didn't implement IDerivedStateComputer as there is no example online.
I also didn't override getScope in DefaultLinkingService (not sure if that is the reason).
The following code are my overriding of getLinkedObjects in DefaultLinkingService.I am not sure if I need generate resource file on hard disk through FileOutputStream as I did in the code. Also I am not sure if URI should match with the resource file name.
After the failure in "find reference", I am wondering if the method everyone used is to generate some temperory files with undeclared variables declared in the temp files. Then the workspace includes those temp files so that reference link works. But I doubt it.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node)
throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
Resource resource = context.eResource().getResourceSet().getResource(uri, false);
if ( resource ==null){
resource = context.eResource().getResourceSet().createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
SerializerOptions op = new SerializerOptions(false, true);
Map map = new HashMap();
map.put(XtextResource.OPTION_SERIALIZATION_OPTIONS, op);
IWorkspace workspace = ResourcesPlugin.getWorkspace();
String workspaceDirectory =
workspace.getRoot().getLocation().toFile().getAbsolutePath();
String resourceFolderDir = workspaceDirectory+"\\resource";
File resourceFolder=new File(resourceFolderDir);
try {
if (!resourceFolder.exists()) resourceFolder.mkdir();
String resourceDirectory=
resourceFolderDir+"\\resource_"+crossRefString+".txt";
FileOutputStream output =
new FileOutputStream(resourceDirectory);
resource.save(output, map);
} catch (Exception e) {
e.printStackTrace();
}
list = Collections.singletonList((EObject)declare);
}else{
EObject o=resource.getContents().get(0);
list = Collections.singletonList(o);
}
}
return list;
}
[Updated on: Sat, 16 February 2013 14:57] Report message to a moderator
|
|
| |
Re: Duplicate declarations with cross reference [message #1010110 is a reply to message #1010104] |
Sat, 16 February 2013 15:23 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I did use. You will find it in the above code as:
resource = context.eResource().getResourceSet().createResource(uri);
So what you mean is FileOutPutStream to save the resource on hard disk is not necessary, right?
But I don't know why "find reference" doesn't work, but editor display no error on resolve references to declaration.
[Updated on: Sat, 16 February 2013 15:25] Report message to a moderator
|
|
| |
Re: Duplicate declarations with cross reference [message #1010265 is a reply to message #1010124] |
Sun, 17 February 2013 02:00 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
[Updated on: Sun, 17 February 2013 05:31] Report message to a moderator
|
|
|
Re: Duplicate declarations with cross reference [message #1010313 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010314 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010317 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010318 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010321 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010322 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010325 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010326 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010329 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010330 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010333 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010334 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010337 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010338 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010341 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010342 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010345 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010346 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010350 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010351 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010354 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010355 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010359 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010360 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010363 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010364 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010367 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010368 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010371 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010372 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010375 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010376 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010381 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010382 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010385 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010386 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010389 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010390 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010393 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010394 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010398 is a reply to message #1010265] |
Sun, 17 February 2013 05:26 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
|
Re: Duplicate declarations with cross reference [message #1010399 is a reply to message #1010124] |
Sun, 17 February 2013 05:27 |
Hao Xie Messages: 68 Registered: January 2013 |
Member |
|
|
I think I found the problem of my code, but fail to find the solution. I believe I can make it work with my own LinkService class.
When I use resource = resourceSet.createResource(uri) in my code, a XMIResourceImpl resource is created. However, my program file is LazyLinkingResource resource.
I think the two kinds of resources can't reference each other. I need create LazyLinkingResource with the function of resourceSet.createResource(uri). However, I don't have a solution now.
@Override
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
List<EObject> list = super.getLinkedObjects(context, ref, node);
if ( list.isEmpty()) {
final String crossRefString = getCrossRefNodeAsString(node);
URI uri = URI.createURI(crossRefString+".dmy");
ResourceSet resourceSet = context.eResource().getResourceSet();
Resource resource = resourceSet.getResource(uri, false);
if ( resource ==null){
resource = resourceSet.createResource(uri);
WreslEditorFactory f = WreslEditorFactoryImpl.eINSTANCE;
Declaration declare =
(Declaration) f.create(WreslEditorPackage.Literals.DECLARATION);
declare.setName(crossRefString);
resource.getContents().add(declare);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, declare);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}else{
EObject o=resource.getContents().get(0);
IEObjectDescription eObjectDescription =
EObjectDescription.create(crossRefString, o);
list =
Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
}
return list;
}
|
|
| | | |
Goto Forum:
Current Time: Tue Sep 24 14:46:12 GMT 2024
Powered by FUDForum. Page generated in 0.09717 seconds
|