Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Strange "Access restriction" error creating diagram editor code
Strange "Access restriction" error creating diagram editor code [message #156863] Tue, 23 October 2007 21:25 Go to next message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
I have a problem that may or may not be related to GMF (I must admit I
don't even fully understand the error message that I get):

For my to-be graphical editor I wanted a "NoteFigure" (i.e. a sheet with
a bent corner like the one used in many applications for comments or
annotations).

I wanted to spare me having to define my own note figure and so I
searched and found exactly such a figure already present in GMF. I thus
simply defined my notes figure class as follows:
----------------------------------------
package foo.figures;

public class MyNoteFigure
extends org.eclipse.gmf.runtime.diagram.ui.figures.NoteFigure
{
public MyNoteFigure() {
super(1, 1, new org.eclipse.draw2d.geometry.Insets(1,1,1,1));
}
}
----------------------------------------
.... and added this to my "foo" project's source tree. In order to get
this class to compile I also had to add the plugin
"org.eclipse.gmf.runtime.diagram.ui" to the required plug-ins (on the
dependencies-tab when editing in plugin.xml. I also checked the
"reexport this dependency" checkbox on this). This seemed to work, i.e.
the basic project compiles fine.

I then had GMF create me the diagram editor code, i.e. the "foo.diagram"
project, from my foo.gmfgen.

Strange enough (and to me unexplicable so far) the generated project has
a compile error (only this one): In the package foo.diagram.edit.parts
there is a class "ArtifactEditPart" ("Artifact" is one of the graphical
elementsI defined). In that file the import
-------------------------
....
import foo.figures.MyNoteFigure;
....
-------------------------
is marked with an error reading:

Access restriction: The type MyNoteFigure is not accessible due to
restriction on required project foo.
foo.diagram/src/foo/diagram/edit/parts ArtifactEditPart.java line 8
1193171083156 11703452

Why is there this access restriction? I have defined the required plugin
as dependency and I also re-export that dependency. The referenced
org.eclipse.gmf.runtime.diagram.ui.figures.NoteFigure is a public class,
so IMHO there should no problem extending it, either. Or what (possibly
other) access restriction is eclipse talking about here and why? What
exactly is or might be meant here? Any hint or explanation would be
greatly appreciated!

Regards,
Michael
Re: Strange "Access restriction" error creating diagram editor code [message #156895 is a reply to message #156863] Wed, 24 October 2007 09:13 Go to previous message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
Ah - I finally found and understood (well, somewhat) what's going on
here:

I needed to add my custom made package containing the MyNodeFigure-class
to the base plugin's list of Exported packages (on the runtime tab of
the plugin.xml editor). Apparently all packages NOT listed there
automatically get a "forbidden" attribute and are hence not accessible
by other plugins.

That happens when too much is done automagically and one has no clue
what's all going off in the background...

Michael
Previous Topic:problems with phantom elements
Next Topic:drag and drop - update new element
Goto Forum:
  


Current Time: Tue Jul 16 13:21:26 GMT 2024

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

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

Back to the top