|
Re: java.lang.ExceptionInInitializerError with PaletteView [message #189458 is a reply to message #189427] |
Wed, 27 July 2005 15:36 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
Stack trace?
"Lucia" <cheng_lucia@yahoo.com> wrote in message
news:38d43f10e09f3c425eccc4863191014e$1@www.eclipse.org...
> Hi, GEF-experts,
>
> I am trying to write a little example according to the flow example
> provided by GEF.
>
> I have not done a lot of changed but the Palette could not be initialized.
>
> Help me please....
>
> Here is my code:
>
> ############################################################ #####
> public class MyEditor extends GraphicalEditorWithPalette {
>
> private PaletteRoot root;
> public GanttChartEditor(){
> DefaultEditDomain defaultEditDomain = new DefaultEditDomain(this);
> setEditDomain(defaultEditDomain);
> }
> protected PaletteRoot getPaletteRoot() {
> if (root == null)
> root = MyPaletteFactory.createPalette();
> return root;
> }
>
> protected void initializeGraphicalViewer() {
> }
>
> public void doSave(IProgressMonitor monitor) {
> }
>
> public void doSaveAs() {
> }
>
> public boolean isSaveAsAllowed() {
> return false;
> }
>
> protected final CommandStack getCommandStack()
> {
> return getEditDomain().getCommandStack();
> }
>
>
> protected void configureGraphicalViewer() {
> super.configureGraphicalViewer();
> getGraphicalViewer().setRootEditPart(new ScalableRootEditPart());
> }
>
> protected void initializePaletteViewer() {
> super.initializePaletteViewer();
> }
> }
>
> thanks
>
> Lucia
>
|
|
|
|
Re: java.lang.ExceptionInInitializerError with PaletteView [message #189502 is a reply to message #189486] |
Wed, 27 July 2005 15:52 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
This is the important bit:
Caused by: java.lang.NullPointerException
at
org.eclipse.gef.ui.palette.DefaultPaletteViewerPreferences.<init >(DefaultPal
etteViewerPreferences.java:62)
at
org.eclipse.gef.ui.palette.PaletteViewer.<clinit>(PaletteViewer.java:89)
.... 70 more
Can you debug to see what's null?
"Lucia" <cheng_lucia@yahoo.com> wrote in message
news:63b893d423632197e4f55eea25ed9952$1@www.eclipse.org...
> Hi,
>
> I made a second example. And the same error...
>
> ENTRY org.eclipse.jface 4 2 2005-07-27 17:37:46.694
> !MESSAGE Problems occurred when invoking code from plug-in:
> "org.eclipse.jface".
> !STACK 0
> java.lang.ExceptionInInitializerError
> at
>
wzl.cosmos.projecting.ganttcharteditor.ui.GanttChartEditor.c reatePaletteView
er(GanttChartEditor.java:139)
> at
>
wzl.cosmos.projecting.ganttcharteditor.ui.GanttChartEditor.c reatePartControl
(GanttChartEditor.java:86)
> at
>
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.jav
a:585)
> at
>
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:365)
> at
>
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReferenc
e.java:552)
> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:28 3)
> at
>
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(Presentable
Part.java:126)
> at
>
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(Pres
entablePartFolder.java:268)
> at
>
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftTo
RightTabOrder.java:65)
> at
>
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPar
t(TabbedStackPresentation.java:391)
> at
>
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.jav
a:1102)
> at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1051)
> at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:12 56)
> at org.eclipse.ui.internal.PartStack.add(PartStack.java:442)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:109 )
> at
>
org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.ja
va:60)
> at
>
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:2
12)
> at
>
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:202
)
> at
>
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:753
)
> at
>
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager
..java:665)
> at
> org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:628)
> at
>
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.ja
va:2323)
> at
>
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2258
)
> at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage .java:2250)
> at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2236)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:69)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2231)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2212)
> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:371)
> at org.eclipse.ui.ide.IDE.openEditor(IDE.java:334)
> at
>
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtil
ity.java:251)
> at
>
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtil
ity.java:131)
> at
>
org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:
49)
> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:16 9)
> at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:15 3)
> at
>
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDisp
atchAction.java:222)
> at
>
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchActi
on.java:198)
> at
>
org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpe
n(PackageExplorerActionGroup.java:296)
> at
>
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageEx
plorerPart.java:869)
> at
>
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:741)
> at
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
:1044)
> at org.eclipse.core.runtime.Platform.run(Platform.java:783)
> at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
> at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 8)
> at
>
org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:73
9)
> at
>
org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:
968)
> at
>
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.jav
a:1067)
> at
> org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:243)
> at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:238)
> at
> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:277)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
> at
>
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:103)
> at
>
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.
java:226)
> at
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
> at
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
..java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
> at org.eclipse.core.launcher.Main.run(Main.java:973)
> at org.eclipse.core.launcher.Main.main(Main.java:948)
> Caused by: java.lang.NullPointerException
> at
>
org.eclipse.gef.ui.palette.DefaultPaletteViewerPreferences.<init >(DefaultPal
etteViewerPreferences.java:62)
> at
> org.eclipse.gef.ui.palette.PaletteViewer.<clinit>(PaletteViewer.java:89)
> ... 70 more
>
>
############################################################ ################
#
> And my new code:
>
############################################################ ################
#
> package wzl.cosmos.projecting.ganttcharteditor.ui;
>
> import java.util.EventObject;
>
> import org.eclipse.core.resources.IMarker;
> import org.eclipse.core.runtime.IProgressMonitor;
> import org.eclipse.gef.DefaultEditDomain;
> import org.eclipse.gef.EditDomain;
> import org.eclipse.gef.EditPartFactory;
> import org.eclipse.gef.GraphicalViewer;
> import org.eclipse.gef.commands.CommandStack;
> import org.eclipse.gef.commands.CommandStackListener;
> import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
> import org.eclipse.gef.palette.PaletteRoot;
> import org.eclipse.gef.ui.palette.PaletteViewer;
> import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
> import org.eclipse.swt.SWT;
>
> import org.eclipse.swt.custom.SashForm;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.ui.IEditorInput;
> import org.eclipse.ui.IEditorPart;
> import org.eclipse.ui.IEditorSite;
> import org.eclipse.ui.PartInitException;
> import org.eclipse.ui.part.EditorPart;
>
> import wzl.cosmos.projecting.ganttcharteditor.GanttChartPaletteFact ory;
>
> public class GanttChartEditor extends EditorPart {
>
> private EditDomain domain;
>
> private PaletteViewer paletteViewer;
>
> private PaletteRoot root;
>
> private boolean isDirty;
>
> private GraphicalViewer graphicalViewer;
>
> public GanttChartEditor(){
> }
>
> public void doSave(IProgressMonitor monitor) {
> getCommandStack().markSaveLocation();
>
> }
>
> public void doSaveAs() {
> getCommandStack().markSaveLocation();
>
> }
>
> public void init(IEditorSite site, IEditorInput input) throws
> PartInitException {
> setSite(site);
> setInput(input);
>
> getCommandStack().addCommandStackListener(getCommandStackLis tener());
>
> }
>
> public void gotoMarker(IMarker marker){
>
> }
>
> public boolean isDirty() {
> // TODO Auto-generated method stub
> return isDirty;
> }
>
> protected void setDirty(boolean dirty){
>
> if (isDirty != dirty){
> isDirty = dirty;
> firePropertyChange(IEditorPart.PROP_DIRTY);
> }
> }
>
> public boolean isSaveAsAllowed() {
> // TODO Auto-generated method stub
> return false;
> }
>
> public void createPartControl(Composite parent) {
> SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
> //sashForm.setWeights(new int[]{3,7});
> paletteViewer = createPaletteViewer(sashForm);
> graphicalViewer= createGraphicalViewer(sashForm);
>
>
> }
>
> public void setFocus() {
> // TODO Auto-generated method stub
>
> }
>
> public void dispose(){
>
> getCommandStack().removeCommandStackListener(getCommandStack Listener());
> super.dispose();
> }
>
>
> public EditDomain getEditDomain(){
> if (domain==null)
> domain = new DefaultEditDomain(this);
> return domain;
> }
>
> private CommandStackListener commandStackListener= new
> CommandStackListener(){
> public void commandStackChanged(EventObject event)
> {
> setDirty(getCommandStack().isDirty());
> }
> };
>
> public CommandStack getCommandStack(){
> return getEditDomain().getCommandStack();
> }
>
> protected CommandStackListener getCommandStackListener(){
> return commandStackListener;
> }
>
> private GraphicalViewer createGraphicalViewer(Composite parent){
> GraphicalViewer viewer = new ScrollingGraphicalViewer();
> viewer.createControl(parent);
> viewer.getControl().setBackground(parent.getBackground());
> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
>
> getEditDomain().addViewer(viewer);
> viewer.setEditPartFactory(getEditPartFactory());
> viewer.setContents(getContent());
>
> return viewer;
>
> }
>
> private PaletteViewer createPaletteViewer(Composite parent){
> PaletteViewer viewer = new PaletteViewer();
> viewer.createControl(parent);
> getEditDomain().addViewer(viewer);
> getEditDomain().setPaletteRoot(getPaletteRoot());
> return viewer;
> }
>
> private PaletteRoot getPaletteRoot(){
> if (root == null)
> root = GanttChartPaletteFactory.createPalette();
> return root;
> }
>
> public GraphicalViewer getGraphicalViewer(){
> return graphicalViewer;
> }
>
> public PaletteViewer getPaletteViewer(){
> return paletteViewer;
> }
>
> protected Object getContent()
> {
> //TO DO: return model;
> return null;
> }
>
> protected EditPartFactory getEditPartFactory(){
> //TO DO: return part factory;
> return null;
> }
>
> }
>
> Any suggestion is welcome.
>
> Lucia
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02785 seconds