Accessing domain objects through property section [message #1692149] |
Tue, 14 April 2015 01:13 |
Joao Faccin Messages: 2 Registered: April 2015 |
Junior Member |
|
|
Hello everyone,
I'm working on a property section that extends from GFPropertySection. In this property section I have a CCombo, which I want to populate with specific data from a set of instantiated objects in my domain when I select an element of another specific class.
So, I'm running this code in my property section to get this set of instantiated objects:
ArrayList<String> fooClassElements = new ArrayList<String>();
EList<EObject> contents = getDiagram().eResource().getContents();
for (EObject eObject : contents) {
if (eObject instanceof FooClass) {
fooClassElements.add(((FooClass) eObject).getName());
}
}
The problem is that I'm getting a NullPointerException from the GFPropertySection#getDiagram() method. Stacktrace shows that the problem arises when AbstractPropertySection#getPart() is called, returning a null value when it must return a valid IWorkbenchPart.
I would like to know if I'm missing something or if there is a better way to access domain instances through a property section.
Thanks in advance!
EDIT: I was mistaken about the scope to use the GFPropertySection#getDiagram() method. I solved the problem moving this code snippet to its correct place.
[Updated on: Tue, 14 April 2015 16:21] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03789 seconds