Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Zest Graph Viewer reference points to null all of a sudden
Zest Graph Viewer reference points to null all of a sudden [message #665550] Fri, 15 April 2011 00:53 Go to next message
Florian Wieland is currently offline Florian Wieland
Messages: 6
Registered: April 2011
Junior Member
Hi,

I am programming an application within Eclipse RCP, there I have got an editor containing a tree viewer and a view containing a graph viewer (Zest). The graph viewer should mirror the currently activated tree viewer. I am able to set the initial model to the graph viewer but when another tree is activated or opened in the tree viewer I want to update the graph viewer by setting a new input [viewer.setInput(newModel)]. But now it comes when I do this, the graph viewer reference has become null and obviously I get a nullpointerexeption.

I do not set it to null, could it be something within Eclipse? Here is some of the viewer code witch I mainly took from the vogella-tutorium.

Are there any known solutions? Do I use the setInput in a wrong way? How could it be, that the reference gets null and even a second reference I initiated got null so someone might have stolen my viewer object even with references still pointing at it but on the other hand the graph is still shown in the GUI....
I hope there is some enlightening
Greetings Florian


public class GraphView extends ViewPart implements IZoomableWorkbenchPart,IStartup,IPartListener{
	
	public static final String ID = "hazardtree.graphView.GraphView";
	private GraphViewer viewer;

	public GraphView() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public void createPartControl(Composite parent) {
		viewer = new GraphViewer(parent, SWT.BORDER);
		viewer.setContentProvider(new GraphContentProvider());
		viewer.setLabelProvider(new GraphLabelProvider());
		viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
		LayoutAlgorithm layout = setLayout();
		viewer.setLayoutAlgorithm(layout, true);
		viewer.applyLayout();
		fillToolBar();
		viewer.setInput(ChainFactory.buildChain(0));
	}

[...]
	
@Override
	public void partActivated(IWorkbenchPart part) {
		if (part instanceof ChainEditor){
      	  Chain chain = ((ChainEditor)part).getChain();
    	  if (chain != null){
    		  this.viewer.setInput(chain);
    	  }
		}
	}
FileFieldEditor Help [message #665665 is a reply to message #665550] Fri, 15 April 2011 08:10 Go to previous messageGo to next message
frank b is currently offline frank b
Messages: 36
Registered: July 2009
Member
Hello,

I'm using a FileFieldEditor form jface plugin in a preference page to
allow user to select an executable file within her or his file system.

A problem comes when I select an "app" executable file in Mac OSX.
As it is actually a Folder, it is not considered to be a valid file
in "checkState" method of FileFieldEditor : the test "if
(file.isFile())" on line 137 obviously returns false and goes through
an error "value must be an existing file". As a result, "Apply" and "OK"
buttons are not enabled.

Am I misusing FileFieldEditor ? Is there another more suitable class ?
Is there a workaround for app mac "files" ? Should FileFieldEditor
handle 'app' files ?

Thks a lot,
frank

PS : org.eclipse.jface_3.5.2.M20100120-0800.jar
Re: Zest Graph Viewer reference points to null all of a sudden [message #665861 is a reply to message #665550] Sun, 17 April 2011 09:25 Go to previous message
Florian Wieland is currently offline Florian Wieland
Messages: 6
Registered: April 2011
Junior Member
Hi Florian,

i think you're in serious trouble, having an object thief around. But the solution is actually to think around the corner. You are not an object short, you have one to much. When eclipse calls the createPartControll it creates an object and sets the viewer. Before that eclipse calls the earlyStartup method an creates another object. The listeners are obviosly set from this object as it is done within this method. Just delet the ISartup implementation and set the Listener from the createPartControl and there will only be one object.

Can anyone explain why there are two objects?

Greetings,
Florian Smile))
Previous Topic:[Databinding] Problem with datetime, validation and unit testing
Next Topic:TreeViewer refresh performance
Goto Forum:
  


Current Time: Tue Jul 22 17:36:07 EDT 2014

Powered by FUDForum. Page generated in 0.01671 seconds