Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » ElementTypeRegistry and OSGi(Problems with "invalid registry object" when loading a bundle the second time)
ElementTypeRegistry and OSGi [message #494440] Fri, 30 October 2009 16:04 Go to next message
Wolfram  is currently offline Wolfram Friend
Messages: 3
Registered: October 2009
Junior Member
Hello,


I try to get a replaceble editor to work.

aim: Installation of the editor bundles in running eclipse instance via osgi, open a diagram in the editor, uninstallation of the editor bundles. do this again with different versions of the editor while the eclipse instance remains the same.

problem: The first time it works fine. The second time, I get an error message when I try to open a diagram.

Could not open the editor: An exception was thrown during initialization
and
java.lang.NullPointerException
at sample2.diagram.providers.Sample2ElementTypes.getElement(Sam ple2ElementTypes.java:183)
at sample2.diagram.providers.Sample2ElementTypes.getImageDescri ptor(Sample2ElementTypes.java:159)
.
.
.

then, when I exit eclipse, there is another error message:

An error has occurred: Invalid registry object...


here is a part of the source code which the error message refers to:

public class Sample2ElementTypes extends ElementInitializers {
...
/**
* @generated
*/
public static final IElementType DiagramRoot_1000 =
getElementType("temp9Editor.diagram.DiagramRoot_1000"); //$NON-NLS-1$

...
/**
* @generated
*/
private static IElementType getElementType(String id) {
return ElementTypeRegistry.getInstance().getType(id);
}
}


I am looking forward to an answer!
Yours sincerely,
Wolfram

Re: ElementTypeRegistry and OSGi [message #495318 is a reply to message #494440] Wed, 04 November 2009 14:58 Go to previous messageGo to next message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello Wolfram,

> Could not open the editor: An exception was thrown during
> initialization
> and
> java.lang.NullPointerException
> at sample2.diagram.providers.Sample2ElementTypes.getElement(Sam
> ple2ElementTypes.java:183)
> at sample2.diagram.providers.Sample2ElementTypes.getImageDescri
> ptor(Sample2ElementTypes.java:159)
Looks like ElementTypeRegistry was not updated properly on uninstalling/installing
again diagram plugin.. You can file bugilla for it.

> private static IElementType getElementType(String id) {
> return ElementTypeRegistry.getInstance().getType(id);
> }
> }
getElement() is listed in a stacktrace above - not getElementType()..

-----------------
Alex Shatalin
Re: ElementTypeRegistry and OSGi [message #495839 is a reply to message #495318] Fri, 06 November 2009 11:46 Go to previous messageGo to next message
Wolfram  is currently offline Wolfram Friend
Messages: 3
Registered: October 2009
Junior Member
Hello,

first a more complete version of the relevant code:

java.lang.NullPointerException
at sample2.diagram.providers.Sample2ElementTypes.getElement(Sam ple2ElementTypes.java:183)
at sample2.diagram.providers.Sample2ElementTypes.getImageDescri ptor(Sample2ElementTypes.java:159)
at sample2.diagram.part.Sample2PaletteFactory.createGegenstand1 CreationTool(Sample2PaletteFactory.java:63)


-------------------------------------------------
24 public class Sample2ElementTypes extends ElementInitializers {
...
55 /**
56 * @generated
57 */
58 public static final IElementType Gegenstand_2002 = getElementType("EditorS2A34.diagram.Gegenstand_2002"); //$NON-NLS-1$
...
155 /**
156 * @generated
157 */
158 public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
159 ENamedElement element = getElement(hint);
160 if (element == null) {
161 return null;
162 }
163 return getImageDescriptor(element);
164 }
...
177 /**
178 * Returns 'type' of the ecore object associated with the hint.
179 *
180 * @generated
181 */
182 public static ENamedElement getElement(IAdaptable hint) {
183 Object type = hint.getAdapter(IElementType.class);
.. .
208 }
.. .
210 /**
211 * @generated
212 */
213 private static IElementType getElementType(String id) {
214 return ElementTypeRegistry.getInstance().getType(id);
215 }
...
234 }
-------------------------------------------------

and

-------------------------------------------------
19 public class Sample2PaletteFactory {
...
53 /**
54 * @generated
55 */
56 private ToolEntry createGegenstand1CreationTool() {
57 List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
58 types.add(Sample2ElementTypes.Gegenstand_2002);
59 NodeToolEntry entry = new NodeToolEntry(
60 Messages.Gegenstand1CreationTool_title,
61 Messages.Gegenstand1CreationTool_desc, types);
62 entry.setSmallIcon(Sample2ElementTypes
63 .getImageDescriptor(Sample2ElementTypes.Gegenstand_2002));
64 entry.setLargeIcon(entry.getSmallIcon());
65 return entry;
66 }
...
173 }
-------------------------------------------------


I put getElementType() here, because this method returns the second time null and therefore IElementType Gegenstand_2002 is initialized with null Sad.
So, I thought there must be the problem.

> Looks like ElementTypeRegistry was not updated properly on uninstalling/installing
> again diagram plugin.. You can file bugilla for it.

I tried to find a method in ElementTypeRegistry to do this manually, but unfortunately I didn't find any.
How can I file bugzilla for it?
Sorry, I am quite a newbie and I am searching desperately for a solution...

Thank you,
Wolfram

[Updated on: Fri, 06 November 2009 11:49]

Report message to a moderator

Re: ElementTypeRegistry and OSGi [message #498202 is a reply to message #495839] Sun, 15 November 2009 20:31 Go to previous message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello Wolfram,

> How can I file bugzilla for it?
https://bugs.eclipse.org/bugs/

-----------------
Alex Shatalin
Previous Topic:How to implement non orthogonal diagrams (model perspectives) in GMF?
Next Topic:duplicate link just it is created
Goto Forum:
  


Current Time: Fri Apr 26 00:49:11 GMT 2024

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

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

Back to the top