Bug 94680 Strange behaviour when activating/deactivating project specific settings when workspace is locked
I20050509-2010 - lock the workspace using the job example plug-in - open the properties on a Java project - go to code template settings - check enable project specific settings - press OK observe: the OK button gets disabled, but the dialog stay. The user can even click the cancel button in this situations. Pressing cancel still applies the settings. The stack tract in this situation (after pressing the OK button) is "main" prio=7 tid=0x000359e0 nid=0x590 in Object.wait() [0x0007e000..0x0007fc40] at java.lang.Object.wait(Native Method) - waiting on <0x03f15c00> (a org.eclipse.core.internal.jobs.ThreadJob) at org.eclipse.core.internal.jobs.ThreadJob.joinRun(ThreadJob.java:170) - locked <0x03f15c00> (a org.eclipse.core.internal.jobs.ThreadJob) at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:88) at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:190) at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:96) at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:1671) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1711) at org.eclipse.core.internal.resources.ProjectPreferences.save(ProjectPreferences.java:310) at org.eclipse.core.internal.preferences.EclipsePreferences.flush(EclipsePreferences.java:351) at org.eclipse.core.internal.resources.ProjectPreferences.flush(ProjectPreferences.java:530) at org.eclipse.jdt.internal.ui.preferences.CodeTemplateBlock.performOk(CodeTemplateBlock.java:539) at org.eclipse.jdt.internal.ui.preferences.CodeTemplatePreferencePage.performOk(CodeTemplatePreferencePage.java:68) at org.eclipse.jface.preference.PreferenceDialog$11.run(PreferenceDialog.java:850) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1029) at org.eclipse.core.runtime.Platform.run(Platform.java:775) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:148) at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:830) at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:295) at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:218) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:556) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2901) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2534) at org.eclipse.jface.window.Window.runEventLoop(Window.java:803) at org.eclipse.jface.window.Window.open(Window.java:781) at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:157) at org.eclipse.jface.action.Action.runWithEvent(Action.java:996) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2901) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2534) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1601) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1565) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:315) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:230) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:345) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:158) 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:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:328) at org.eclipse.core.launcher.Main.basicRun(Main.java:272) at org.eclipse.core.launcher.Main.run(Main.java:974) at org.eclipse.core.launcher.Main.main(Main.java:950) Martin, don't know if this is use or core resources.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/CodeTemplateBlock.java
private static final String PREF_JAVADOC_STUBS= PreferenceConstants.CODEGEN_ADD_COMMENTS;
	
	private TreeListDialogField fCodeTemplateTree;
	
	private SelectionButtonDialogField fCreateJavaDocComments;
	
	protected ProjectTemplateStore fTemplateStore;
	
	private PixelConverter fPixelConverter;
	private SourceViewer fPatternViewer;
	private Control fSWTWidget;
	private TemplateVariableProcessor fTemplateProcessor;
	
	private final IProject fProject;
	public CodeTemplateBlock(IProject project) {
		
		fProject= project;
		
		fTemplateStore= new ProjectTemplateStore(project);
		try {
			fTemplateStore.load();
		} catch (IOException e) {
			JavaPlugin.log(e);
		}
		
		fTemplateProcessor= new TemplateVariableProcessor();
		
		CodeTemplateAdapter adapter= new CodeTemplateAdapter();
		String[] buttonLabels= new String[] { 
			PreferencesMessages.CodeTemplateBlock_templates_edit_button,