Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » [solved] singleton part (make Editor as singleton )
icon14.gif  [solved] singleton part [message #1060685] Mon, 27 May 2013 19:22 Go to previous message
AIT YAHIA Idir is currently offline AIT YAHIA IdirFriend
Messages: 39
Registered: April 2013
hi all.

this is what I want to do

I created a single Tableviewer in postContruction, and the user load the data from an external XML file via a menu command.

but when I try to load data via a method in the class, the recovered viewer is null (the method is called from a new instance of the class).
and I have a NullPointerException

I tried to make a class as singleton with anotation @Singleton, but i can't get existing instance (

it's the basic approach look like, but it's been two days that I'm trying to fix without success.

can someone help me by telling me how to proceed.

thanks in advance

My viepart class
public class MyViewPart {

private TableViewer viewer;

public void createControls(Composite parent)
  viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
 { // my code here }
public void loadData(filename)()
  // my code here

My Menu commande handler

public class LoadDataHandler {

public void execute() {
	    Shell shell = new Shell(Display.getDefault());
	    DirectoryDialog dialog = new DirectoryDialog(shell);
	    String fileSelected =;
	    MyViewPart data = new MyViewPart();


[Updated on: Tue, 28 May 2013 18:23]

Report message to a moderator

Read Message icon14.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Read Message
Previous Topic:Using e3 properties view in e4 RCP application
Next Topic:How to add an ISaveHandler and IWindowCloseHandler to the Model
Goto Forum:

Current Time: Sat Jul 22 08:57:42 GMT 2017

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

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