|import packages in gef cannot be resolved [message #216567]
||Sat, 20 May 2006 20:45
Originally posted by: tazmailian2000.yahoo.com|
I am trying to build a diagram editor with GEF in Eclipse. Therefore I
used the shapes-example from
http://www.eclipse.org/articles/Article-GEF-diagram-editor/s hape.html and
I would like to use this as a start of my application. After that I would
like to change the code to make it fit my requirements.
However, some packages that are needed by the shapes-example are not
found. I get a lot of errors, saying that "the import [name of the
package] cannot be resolved".
To be more specific: In the 'ShapesEditor' class for example, all of the
following imports generate errors:
import org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPref erences;
So these are both GEF and other imports.
What I did was:
1 Make a new Java project
2 Make two source-folders and imported the jar-files
'org.eclipse.gef_3.1.1' and 'org.eclipse.draw2d_3.1.1', so that I am able
to write legal import statements like 'org.eclipse.gef. ...' and
'org.eclipse.draw2d. ...', but not, as I mentioned earlier, some
3 Make a source-folder and imported the source files from the example. (I
unzipped the zip-file 'src.zip' and then I imported (via import file
system) the 'src' folder in a source-folder).
What I just can't believe is that the shapes-example files don't provide
all the packages which are necessary to compile and build the
shapes-application, so I must have missed something.
Can anybody please tell me what I've done wrong? I've tried a lot, but I
am pretty new to Eclipse so it could be the stupidest thing.
Thanks for reading this long story.
|Re: import packages in gef cannot be resolved [message #216781 is a reply to message #216567]
||Wed, 24 May 2006 09:16
Originally posted by: cmahoney.ca.ibm.com|
Take a look to see that those packages are listed in the plug-ins under
Windows > Preferences > Target Platform. This should point to an Ecilpse
installation which should have most of those packages.
You will need to install GEF separately. It does not come with Eclpse. Go
to http://www.eclipse.org/gef/ and click on Downloads.
"Thijs Langeveld" <email@example.com> wrote in message
> I am trying to build a diagram editor with GEF in Eclipse. Therefore I
> used the shapes-example from
> http://www.eclipse.org/articles/Article-GEF-diagram-editor/s hape.html and
> I would like to use this as a start of my application. After that I would
> like to change the code to make it fit my requirements.
> However, some packages that are needed by the shapes-example are not
> found. I get a lot of errors, saying that "the import [name of the
> package] cannot be resolved".
> To be more specific: In the 'ShapesEditor' class for example, all of the
> following imports generate errors:
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Control;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.core.resources.IFile;
> import org.eclipse.core.resources.ResourcesPlugin;
> import org.eclipse.core.runtime.CoreException;
> import org.eclipse.core.runtime.IPath;
> import org.eclipse.core.runtime.IProgressMonitor;
> import org.eclipse.jface.dialogs.ProgressMonitorDialog;
> import org.eclipse.jface.util.TransferDropTargetListener;
> import org.eclipse.ui.IActionBars;
> import org.eclipse.ui.IEditorInput;
> import org.eclipse.ui.IEditorPart;
> import org.eclipse.ui.IFileEditorInput;
> import org.eclipse.ui.actions.ActionFactory;
> import org.eclipse.ui.actions.WorkspaceModifyOperation;
> import org.eclipse.ui.dialogs.SaveAsDialog;
> import org.eclipse.ui.part.FileEditorInput;
> import org.eclipse.ui.part.IPageSite;
> import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
> import org.eclipse.gef.ContextMenuProvider;
> import org.eclipse.gef.DefaultEditDomain;
> import org.eclipse.gef.EditPartViewer;
> import org.eclipse.gef.GraphicalViewer;
> import org.eclipse.gef.dnd.TemplateTransferDragSourceListener;
> import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
> import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
> import org.eclipse.gef.palette.PaletteRoot;
> import org.eclipse.gef.requests.CreationFactory;
> import org.eclipse.gef.requests.SimpleFactory;
> import org.eclipse.gef.ui.actions.ActionRegistry;
> import org.eclipse.gef.ui.palette.PaletteViewer;
> import org.eclipse.gef.ui.palette.PaletteViewerProvider;
> import org.eclipse.gef.ui.parts.ContentOutlinePage;
> import org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette;
> import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
> import org.eclipse.gef.ui.parts.TreeViewer;
> So these are both GEF and other imports.
> What I did was:
> 1 Make a new Java project
> 2 Make two source-folders and imported the jar-files
> 'org.eclipse.gef_3.1.1' and 'org.eclipse.draw2d_3.1.1', so that I am able
> to write legal import statements like 'org.eclipse.gef. ...' and
> 'org.eclipse.draw2d. ...', but not, as I mentioned earlier, some
> particular packages.
> 3 Make a source-folder and imported the source files from the example. (I
> unzipped the zip-file 'src.zip' and then I imported (via import file
> system) the 'src' folder in a source-folder).
> What I just can't believe is that the shapes-example files don't provide
> all the packages which are necessary to compile and build the
> shapes-application, so I must have missed something.
> Can anybody please tell me what I've done wrong? I've tried a lot, but I
> am pretty new to Eclipse so it could be the stupidest thing.
> Thanks for reading this long story.
|Re: import packages in gef cannot be resolved [message #216850 is a reply to message #216781]
||Thu, 25 May 2006 17:37
Originally posted by: tazmailian2000.yahoo.com|
I've got it!
First of all, thanks for helping me, Cherie!
I looked at my Target Platform 'properties', as you told me, and all
packages I needed were there.
After another search for the solution I miraculously found out that you
have to add Executable JAR files via the project properties!
(Right-Click on project name in the package explorer -> Properties, then
in the new window select 'Java Build Path', tab 'Libraries' and from there
I had to add my JAR-files.)
I did it with the 'import' function. (Right Click on project name ->
import). That was a very bad choice, because the packages of this JAR
appeared in the package explorer, but it didn't import the classes of
these packages. So I could type 'import org.eclipse.gef.*;' and it did not
give an error. So the package was included. However, I couldn't type
'import org.eclipse.gef.ContextMenuProvider' and neither could I use
classes from these packages.
So, after 2 weeks of misery I think I'm able to sleep again.
Powered by FUDForum
. Page generated in 0.02503 seconds