Home » Modeling » TMF (Xtext) » Duplicate declarations with cross reference
Duplicate declarations with cross reference [message #1008481] |
Tue, 12 February 2013 11:55  |
Eclipse User |
|
|
|
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?
|
|
|
Re: Duplicate declarations with cross reference [message #1008580 is a reply to message #1008481] |
Wed, 13 February 2013 02:44   |
Eclipse User |
|
|
|
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
|
|
| | | | |
Re: Duplicate declarations with cross reference [message #1010100 is a reply to message #1010023] |
Sat, 16 February 2013 09:47   |
Eclipse User |
|
|
|
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 09:57] by Moderator
|
|
| | | |
Re: Duplicate declarations with cross reference [message #1010265 is a reply to message #1010124] |
Sat, 16 February 2013 21:00   |
Eclipse User |
|
|
|
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 00:31] by Moderator
|
|
|
Re: Duplicate declarations with cross reference [message #1010313 is a reply to message #1010265] |
Sun, 17 February 2013 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 00:26   |
Eclipse User |
|
|
|
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 00:27   |
Eclipse User |
|
|
|
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 #1011499 is a reply to message #1010568] |
Tue, 19 February 2013 11:39  |
Eclipse User |
|
|
|
As the resource I created for the dummy declaration is not written on hard disk, I got the java.io.FileNotFoundExcpetion. The error stack is at the bottom.
Do I have to write out the resource to hard disk? I guess I don't need. However, I probably need override some rename class or method with my own code. Any suggestions? Thank you.
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.FileNotFoundException: CS3_BO_version154\S_SHSTA.wresl (The system cannot find the path specified)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:167)
at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:22)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:220)
at org.eclipse.xtext.ui.refactoring.ui.DefaultLinkedPositionGroupCalculator.getLinkedPositionGroup(DefaultLinkedPositionGroupCalculator.java:102)
at org.eclipse.xtext.ui.refactoring.ui.RenameLinkedMode.start(RenameLinkedMode.java:66)
at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController$1.run(RenameRefactoringController.java:124)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275)
at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1162)
at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startLinkedEditing(RenameRefactoringController.java:121)
at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startRefactoring(RenameRefactoringController.java:79)
at org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler.startRenameElement(DefaultRenameElementHandler.java:135)
at org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler.execute(DefaultRenameElementHandler.java:84)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.io.FileNotFoundException: CS3_BO_version154\S_SHSTA.wresl (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at org.eclipse.emf.ecore.resource.impl.FileURIHandlerImpl.createInputStream(FileURIHandlerImpl.java:99)
at org.eclipse.xtext.resource.ExternalContentSupport$ExternalContentAwareURIHandler.createInputStream(ExternalContentSupport.java:67)
at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:354)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1256)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 49 more
|
|
|
Goto Forum:
Current Time: Mon Jul 07 09:21:43 EDT 2025
Powered by FUDForum. Page generated in 0.12556 seconds
|