Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358071 - Exception when starting xtend.ui and xtend.check.ui plugins in head-less application
Summary: Exception when starting xtend.ui and xtend.check.ui plugins in head-less appl...
Status: CLOSED FIXED
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: M2   Edit
Assignee: Sven Efftinge CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-19 04:23 EDT by Ali AKAR CLA
Modified: 2013-02-21 08:13 EST (History)
3 users (show)

See Also:
karsten.thoms: juno+


Attachments
patch for bug 358071 (2.43 KB, patch)
2011-09-26 07:40 EDT, Benedikt Niehues CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ali AKAR CLA 2011-09-19 04:23:38 EDT
In my head-less application, which use Xpand/Xtend/Check, when the framework attempt to start org.eclipse.xtend.ui and org.eclipse.xtend.check.ui an exception is thrown which prevent the plugin to start normally. In both start methods PreferencesConstants.initializeDefaultValues(getPreferenceStore()) is called  which cause the exception. I fixed the problem by the above code in both methods:

org.eclipse.xtend.check.ui.CheckEditorPlugin.start(BundleContext)
org.eclipse.xtend.ui.XtendEditorPlugin.start(BundleContext)

 public void start(final BundleContext context) throws Exception {
        super.start(context);
        if(PlatformUI.isWorkbenchRunning()){
        	Activator.getDefault();
        	PreferencesConstants.initializeDefaultValues(getPreferenceStore());
        }
  }
Comment 1 Karsten Thoms CLA 2011-09-20 12:47:16 EDT
Hi Ali,

when your application is head-less, why do you have to include UI plugins in your configuration?

~Karsten
Comment 2 Ali AKAR CLA 2011-09-22 07:16:15 EDT
Hi Karsten,

We have a tool based on Eclipse and the application (org.eclipse.equinox.app.IApplication) is shipped within the tool. I don't have any configuration file for the application, the configuration file is used for the whole tool (I don't know if we can have one configuration file per application shipped within the tool). To run the application the user point to myTool.exe and give the id of the application he want to launch (-application appId).
Another issue is that I can't get ride from UI plugins since the plugin "org.eclipse.xtend.shared.ui" must be included in my configuration file and it required "org.eclipse.ui.ide" and "org.eclipse.ui.editors".
Comment 3 Ali AKAR CLA 2011-09-22 11:40:49 EDT
I would like just to mention that my application don't have any dependency to both plugins.
Comment 4 Ali AKAR CLA 2011-09-22 11:50:35 EDT
Below is the stack trace which show when is the CheckEditorPlugin is activated: 
The call to org.eclipse.xtend.shared.ui.Activator#getRegisteredResourceContributors() in org.eclipse.xtend.shared.ui.core.builder.XtendXpandBuilder.XtendXpandDeltaVisitor.XtendXpandDeltaVisitor(XtendXpandBuilder, IProgressMonitor)

Thread [Worker-0] (Suspended (breakpoint at line 58 in CheckEditorPlugin))	
	CheckEditorPlugin.start(BundleContext) line: 58	
	BundleContextImpl$1.run() line: 783	
	AccessController.doPrivileged(PrivilegedExceptionAction<T>) line: not available [native method]	
	BundleContextImpl.startActivator(BundleActivator) line: 774	
	BundleContextImpl.start() line: 755	
	BundleHost.startWorker(int) line: 370	
	BundleHost(AbstractBundle).start(int) line: 284	
	SecureAction.start(Bundle, int) line: 417	
	BundleLoader.setLazyTrigger() line: 265	
	EclipseLazyStarter.postFindLocalClass(String, Class, ClasspathManager) line: 106	
	ClasspathManager.findLocalClass(String) line: 453	
	DefaultClassLoader.findLocalClass(String) line: 216	
	BundleLoader.findLocalClass(String) line: 393	
	BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 469	
	BundleLoader.findClass(String, boolean) line: 422	
	BundleLoader.findClass(String) line: 410	
	DefaultClassLoader.loadClass(String, boolean) line: 107	
	DefaultClassLoader(ClassLoader).loadClass(String) line: 247	
	BundleLoader.loadClass(String) line: 338	
	BundleHost.loadClass(String, boolean) line: 232	
	BundleHost(AbstractBundle).loadClass(String) line: 1197	
	EquinoxRegistryStrategy(RegistryStrategyOSGI).createExecutableExtension(RegistryContributor,
String, String) line: 174	
	ExtensionRegistry.createExecutableExtension(RegistryContributor, String, String) line: 904	
	ConfigurationElement.createExecutableExtension(String) line: 243	
	ConfigurationElementHandle.createExecutableExtension(String) line: 55	
	Activator.getRegisteredResourceContributors() line: 189	
	XtendXpandBuilder$XtendXpandDeltaVisitor.<init>(XtendXpandBuilder, IProgressMonitor) line: 65	
	XtendXpandBuilder.fullBuild(IProgressMonitor) line: 300	
	XtendXpandBuilder.build(int, Map, IProgressMonitor) line: 158	
	BuildManager$2.run() line: 629	
	SafeRunner.run(ISafeRunnable) line: 42	
	BuildManager.basicBuild(int, IncrementalProjectBuilder, Map, MultiStatus, IProgressMonitor) line: 172	
	BuildManager.basicBuild(IProject, int, ICommand[], MultiStatus, IProgressMonitor) line: 203	
	BuildManager$1.run() line: 255	
	SafeRunner.run(ISafeRunnable) line: 42	
	BuildManager.basicBuild(IProject, int, MultiStatus, IProgressMonitor) line: 258	
	BuildManager.basicBuildLoop(IProject[], IProject[], int, MultiStatus, IProgressMonitor) line: 311	
	BuildManager.build(int, IProgressMonitor) line: 343	
	AutoBuildJob.doBuild(IProgressMonitor) line: 144	
	AutoBuildJob.run(IProgressMonitor) line: 242	
	Worker.run() line: 54
Comment 5 Benedikt Niehues CLA 2011-09-26 07:40:40 EDT
Created attachment 204006 [details]
patch for bug 358071

this patch applies the changes described in the description to the codebase
Comment 6 Ali AKAR CLA 2011-09-26 09:25:38 EDT
OK for the patch !
Comment 7 Karsten Thoms CLA 2011-09-26 11:16:27 EDT
Applied and reviewed the patch. Thanks for submitting.
Comment 8 Karsten Thoms CLA 2013-02-21 08:13:44 EST
Bug resolved before Xpand 1.2 release date => Closing