Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] edit part viewer exception.

Hi Zahid,

 

When does the exception come up? Does it show up when you open the runtime workbench or is it showing up when you try to create/move/delete an edit part? I had similar exception issues for which I could not track the source; If you tell me which action led to this exception, I can help you solve it.

 

Thanks & Gluck.

 

-----Original Message-----
From: gef-dev-admin@xxxxxxxxxxx [mailto:gef-dev-admin@xxxxxxxxxxx] On Behalf Of Zahid Hussain
Sent: Friday, February 27, 2004 6:12 PM
To: gef-dev@xxxxxxxxxxx
Subject: RE: [gef-dev] Re: Resizing figures.

 

I am getting following exception and struggling to find the source. I have modified LogicDesgner sample application and would appreciate if some one can help where to catch this exception and get stack trace.

======

 

java.lang.NullPointerException

            at org.eclipse.gef.ui.parts.AbstractEditPartViewer.fireSelectionChanged(AbstractEditPartViewer.java:186)

            at org.eclipse.gef.ui.parts.AbstractEditPartViewer.appendSelection(AbstractEditPartViewer.java:115)

            at org.eclipse.gef.ui.parts.AbstractEditPartViewer.select(AbstractEditPartViewer.java:466)

            at org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart$2.focusGained(DrawerEditPart.java:72)

            at org.eclipse.draw2d.Figure.handleFocusGained(Figure.java:675)

            at org.eclipse.draw2d.SWTEventDispatcher.setFocus(SWTEventDispatcher.java:470)

            at org.eclipse.draw2d.SWTEventDispatcher.dispatchFocusGained(SWTEventDispatcher.java:104)

            at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchFocusGained(DomainEventDispatcher.java:208)

            at org.eclipse.draw2d.LightweightSystem$EventHandler.focusGained(LightweightSystem.java:331)

            at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:104)

            at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81)

            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)

            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:865)

            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:845)

            at org.eclipse.swt.widgets.Control.WM_SETFOCUS(Control.java:3956)

            at org.eclipse.swt.widgets.Canvas.WM_SETFOCUS(Canvas.java:215)

            at org.eclipse.swt.widgets.Control.windowProc(Control.java:2828)

            at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361)

            at org.eclipse.swt.internal.win32.OS.SetFocus(Native Method)

            at org.eclipse.swt.widgets.Control.forceFocus(Control.java:599)

            at org.eclipse.swt.widgets.Control.setFocus(Control.java:1924)

            at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:386)

            at org.eclipse.swt.widgets.Composite.WM_LBUTTONDOWN(Composite.java:565)

            at org.eclipse.swt.widgets.Control.windowProc(Control.java:2799)

            at org.eclipse.swt.widgets.Display.windowProc(Display.java:2361)

            at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)

            at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1303)

            at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1543)

            at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402)

            at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)

            at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858)

            at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

            at java.lang.reflect.Method.invoke(Method.java:324)

            at org.eclipse.core.launcher.Main.basicRun(Main.java:291)

            at org.eclipse.core.launcher.Main.run(Main.java:747)

            at org.eclipse.core.launcher.Main.main(Main.java:583)

!ENTRY org.eclipse.ui 4 4 Feb 27, 2004 19:06:53.821

-----Original Message-----
From: gef-dev-admin@xxxxxxxxxxx [mailto:gef-dev-admin@xxxxxxxxxxx] On Behalf Of Randy Hudson
Sent:
Friday, February 13, 2004 2:35 PM
To: gef-dev@xxxxxxxxxxx
Subject: Re: [gef-dev] Re: Resizing figures.

 


Please ask questions on the newsgroup where everyone can benefit/help.  The mailing list is for development issues.

-Randy


 

michaelsun@xxxxxxxxxx
Sent by: gef-dev-admin@xxxxxxxxxxx

02/13/2004 02:13 PM
Please respond to gef-dev

       
        To:        gef-dev@xxxxxxxxxxx
        cc:        bharath@xxxxxxxxxxxx
        Subject:        [gef-dev] Re: Resizing figures.




hello Bharath

After I make the following changes, it works, though I
am not familiar with emf, ecore classes
such as EAttribute, EClass, and the ENotificationImpl.
I try using PropertyChangeListener as my ModelListener
to replace Adapter.


1. modify
NetworkXYLayoutEditPolicy.createChildEditPolicy method

protected EditPolicy createChildEditPolicy(EditPart
child) {
                                 
                                 
                                 NetworkNodeEditPart childEditPart =
(NetworkNodeEditPart) child;

                                 NodeFigure rectangle = (NodeFigure)
childEditPart.getFigure();
                                 
                                 return new ResizableEditPolicy();

}

2. In the interface Node.java,  add two new methods

Dimension getSize();
               
void setSize(Dimension s);

3. In NodeImpl.java add
protected Dimension size_EDEFAULT = new
Dimension(-1,-1);
protected Dimension size=size_EDEFAULT;


public Dimension getSize() {
                                 return size;
}

public void setSize(Dimension dimension) {
                                 
                                 Dimension oldDimension = dimension;
                                 size = dimension;
                                 if (eNotificationRequired())
                                                  eNotify(new ENotificationImpl(this,
Notification.SET, NetworkPackage.NODE_SIZE,
oldDimension, size));
                                 
}

and it is easy for you to modify other methods, for
example, only add more "case return" following the
method pattern.


4. In NetworkPackage.java, add something like
int NODE_SIZE=11; //randomly choose the int
EClass getSize();

5. In NetworkPackageImpl.java, add
public EClass getSize(){
                                 return (EClass)nodeEClass.getEReferences().get(11);
}

6. In SetConstrainCommand.java, add
two new fields:
private Dimension newSize;
private Dimension oldSize;

in execute() add part.setSize(newSize),
also add it to other methods.

7. In NetworkNodeEditPart.java, modify
refreshVisuals(), replace
Dimension size = new Dimension(-1,-1);
with Dimension size = getNetworkNode().getSize();


>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>On
Fri, 13 Feb 2004 10:32:07 -0600, "Bharath S" wrote:

>
> Hi Michael,
>
> I am trying to resize figures too and I am having
> problems. Can you guide me
> with this?
>
> Thanks!
>
> Bharath.
>  
>
> -----Original Message-----
> From: gef-dev-admin@xxxxxxxxxxx
> [mailto:gef-dev-admin@xxxxxxxxxxx] On Behalf
> Of michaelsun@xxxxxxxxxx
> Sent:
Friday, February 13, 2004 9:03 AM
> To: gef-dev@xxxxxxxxxxx
> Subject: Re: [gef-dev] NodeFigure can not be resized?
>
> Now the problem is fixed by modifying the
> NetworkXYLayoutEditorPolicy, NetworkNodeEditParty,
> Node, NodeImpl and SetConstraintCommand to handle
> resizing the figure. If anyone need help at this
> point, let me know.
>
> Michael
>
> >On Thu,
12 Feb 2004 11:36:56 -0800 (PST),
> michaelsun@xxxxxxxxxx wrote:
>
> >
> > I only modified the NodeFigure to extends
> > RectangleFigure, rendering the Rectangle
> > shape works well in the viewer. But the NodeFigure
> > can not be resized. I take a look at the
> > NetworkNodeEditPart, still can not figure it out.
Any
> > help? thanks!
> >
> > Michael
> > _______________________________________________
> > gef-dev mailing list
> > gef-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/gef-dev
> _______________________________________________
> gef-dev mailing list
> gef-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/gef-dev
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/gef-dev


Back to the top