Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » NullPointerException in ApplicationActionBarAdvisor
NullPointerException in ApplicationActionBarAdvisor [message #553552] Tue, 17 August 2010 23:43 Go to next message
Michael Yara is currently offline Michael YaraFriend
Messages: 27
Registered: July 2009
Junior Member
Hello,

I am getting the following error in my ApplicationActionBarAdvisor class.

java.lang.NullPointerException

	at org.eclipse.ui.internal.actions.CommandAction.init(CommandAction.java:201)

	at org.eclipse.ui.internal.actions.CommandAction.<init>(CommandAction.java:86)

	at org.eclipse.ui.internal.actions.CommandAction.<init>(CommandAction.java:65)

	at org.eclipse.ui.actions.ActionFactory$WorkbenchCommandAction.<init>(ActionFactory.java:85)

	at org.eclipse.ui.actions.ActionFactory$41.create(ActionFactory.java:1146)

	at com.xmlnamespace.operatorpanel.isymphonyclientrcp.ApplicationActionBarAdvisor.makeActions(ApplicationActionBarAdvisor.java:27)

	at org.eclipse.ui.application.ActionBarAdvisor.fillActionBars(ActionBarAdvisor.java:147)

	at org.eclipse.ui.internal.WorkbenchWindow.fillActionBars(WorkbenchWindow.java:3481)

	at org.eclipse.ui.internal.WorkbenchWindow.<init>(WorkbenchWindow.java:404)

	at org.eclipse.ui.internal.tweaklets.Workbench3xImplementation.createWorkbenchWindow(Workbench3xImplementation.java:31)

	at org.eclipse.ui.internal.Workbench.newWorkbenchWindow(Workbench.java:1731)

	at org.eclipse.ui.internal.Workbench.access$14(Workbench.java:1729)

	at org.eclipse.ui.internal.Workbench$60.runWithException(Workbench.java:3362)

	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)

	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)

	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)

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

	at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)

	at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)

	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)

	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)

	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)

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

	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)

	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)

	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)

	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)

	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

	at com.xmlnamespace.operatorpanel.isymphonyclientrcp.Application.start(Application.java:26)

	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)

	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)

	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

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

	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.lang.reflect.Method.invoke(Unknown Source)

	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)

	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)

	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)


This error seems to happen randomly and once it happens if i close my RCP app the workbench widow closes however the process is still running and I have to kill it manually.

Here is my make actions method:

    protected void makeActions(IWorkbenchWindow window) {
    	    	
	        exitAction = ActionFactory.QUIT.create(window); <<<<<<<< EXCEPTION HERE
	        register(exitAction);
	        
	        aboutAction = ActionFactory.ABOUT.create(window);
	        register(aboutAction);
	                
			preferencesAction = ActionFactory.PREFERENCES.create(window);
			register(preferencesAction);
		

    }



I traced the exception in the source and the exception seems to be thrown at this line in the CommandAction Class:

	protected void init(IServiceLocator serviceLocator, String commandIdIn,
			Map parameterMap) {
		if (handlerService != null) {
			// already initialized
			return;
		}
		handlerService = (IHandlerService) serviceLocator
				.getService(IHandlerService.class);
		ICommandService commandService = (ICommandService) serviceLocator
				.getService(ICommandService.class);
		ICommandImageService commandImageService = (ICommandImageService) serviceLocator
				.getService(ICommandImageService.class);

		createCommand(commandService, commandIdIn, parameterMap);
		if (parameterizedCommand != null) {
			setId(parameterizedCommand.getId());
			try {
				setText(parameterizedCommand.getName());
			} catch (NotDefinedException e) {
				// if we get this far it shouldn't be a problem
			}
			parameterizedCommand.getCommand().addCommandListener(
					getCommandListener());
			parameterizedCommand.getCommand().setEnabled(
					handlerService.getCurrentState());
			setEnabled(parameterizedCommand.getCommand().isEnabled());
			setImageDescriptor(commandImageService.getImageDescriptor(
					commandIdIn, ICommandImageService.TYPE_DEFAULT));<<<<<<<<<<<<<<EXCEPTION HERE
			setDisabledImageDescriptor(commandImageService.getImageDescriptor(
					commandIdIn, ICommandImageService.TYPE_DISABLED));
			setHoverImageDescriptor(commandImageService.getImageDescriptor(
					commandIdIn, ICommandImageService.TYPE_HOVER));
		}
	}



Could anyone explain to me why this would be happening?


Best Regards,
Mike

[Updated on: Tue, 17 August 2010 23:55]

Report message to a moderator

Re: NullPointerException in ApplicationActionBarAdvisor [message #553613 is a reply to message #553552] Wed, 18 August 2010 08:19 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 18/08/10 5:13 AM, Michael Yara wrote:
> Hello,
>
> I am getting the following error in my ApplicationActionBarAdvisor class.
>
>
> java.lang.NullPointerException
>
> at
> org.eclipse.ui.internal.actions.CommandAction.init(CommandAc tion.java:201)
>
> at
> org.eclipse.ui.internal.actions.CommandAction.<init>(CommandAction.java:86)
>


Sounds like there is no ICommandImageService is registered. Its
actually registered when the workbench is created. Not sure why it
should be null.

Can you create a bug with steps to reproduce this?
http://bit.ly/NewBugInPlatformUI

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Previous Topic:Multiple windows for Eclipse RCP apps
Next Topic:load plugin programmatically
Goto Forum:
  


Current Time: Thu Apr 25 20:36:31 GMT 2024

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

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

Back to the top