Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 157793

Summary: [PropertiesDialog] 'Resource' and 'Project References' property page fail if modifying closed project
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: Tod Creasey <Tod_Creasey>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dj.houghton
Version: 3.3   
Target Milestone: 3.3 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Updared project reference page
none
Updated ResourceInfo page none

Description Dani Megert CLA 2006-09-19 08:25:42 EDT
I20060919-0010.

The 'Resource' and the 'Project References' property page fail if modifying closed project

1. create a simple project and close it
2. context menu > Properties
3. change some preferences (e.g. the encoding)
4. click OK

==>

!ENTRY org.eclipse.core.resources 4 4 2006-09-19 14:27:10.024
!MESSAGE Exception occurred while saving project preferences: /Simple Closed/.settings/org.eclipse.core.runtime.prefs.
!STACK 1
org.eclipse.core.internal.resources.ResourceException: Resource '/Simple Closed' is not open.
	at org.eclipse.core.internal.resources.Project.checkAccessible(Project.java:145)
	at org.eclipse.core.internal.resources.Folder.assertCreateRequirements(Folder.java:32)
	at org.eclipse.core.internal.resources.Folder.create(Folder.java:88)
	at org.eclipse.core.internal.resources.ProjectPreferences$2.run(ProjectPreferences.java:551)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737)
	at org.eclipse.core.internal.resources.ProjectPreferences.save(ProjectPreferences.java:566)
	at org.eclipse.core.internal.preferences.EclipsePreferences.flush(EclipsePreferences.java:352)
	at org.eclipse.core.internal.resources.ProjectPreferences.flush(ProjectPreferences.java:364)
	at org.eclipse.ui.internal.ide.LineDelimiterEditor.store(LineDelimiterEditor.java:270)
	at org.eclipse.ui.internal.ide.dialogs.ResourceInfoPage.performOk(ResourceInfoPage.java:569)
	at org.eclipse.jface.preference.PreferenceDialog$11.run(PreferenceDialog.java:889)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:850)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
	at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:869)
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:377)
	at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:230)
	at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:638)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3390)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3009)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:156)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
	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:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3390)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3009)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165)
	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:341)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:285)
	at org.eclipse.core.launcher.Main.run(Main.java:987)
	at org.eclipse.core.launcher.Main.main(Main.java:962)
!SUBENTRY 1 org.eclipse.core.resources 4 372 2006-09-19 14:27:10.024
!MESSAGE Resource '/Simple Closed' is not open.

!ENTRY org.eclipse.ui.ide 4 4 2006-09-19 14:27:10.034
!MESSAGE Exception occurred while saving project preferences: /Simple Closed/.settings/org.eclipse.core.runtime.prefs.

!ENTRY org.eclipse.ui.ide 4 4 2006-09-19 14:27:10.034
!MESSAGE Exception occurred while saving project preferences: /Simple Closed/.settings/org.eclipse.core.runtime.prefs.
!STACK 0
org.osgi.service.prefs.BackingStoreException: Exception occurred while saving project preferences: /Simple Closed/.settings/org.eclipse.core.runtime.prefs.
	at org.eclipse.core.internal.resources.ProjectPreferences.save(ProjectPreferences.java:574)
	at org.eclipse.core.internal.preferences.EclipsePreferences.flush(EclipsePreferences.java:352)
	at org.eclipse.core.internal.resources.ProjectPreferences.flush(ProjectPreferences.java:364)
	at org.eclipse.ui.internal.ide.LineDelimiterEditor.store(LineDelimiterEditor.java:270)
	at org.eclipse.ui.internal.ide.dialogs.ResourceInfoPage.performOk(ResourceInfoPage.java:569)
	at org.eclipse.jface.preference.PreferenceDialog$11.run(PreferenceDialog.java:889)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:850)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
	at org.eclipse.jface.preference.PreferenceDialog.okPressed(PreferenceDialog.java:869)
	at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.okPressed(FilteredPreferenceDialog.java:377)
	at org.eclipse.jface.preference.PreferenceDialog.buttonPressed(PreferenceDialog.java:230)
	at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:638)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3390)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3009)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:156)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
	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:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3390)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3009)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165)
	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:341)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:285)
	at org.eclipse.core.launcher.Main.run(Main.java:987)
	at org.eclipse.core.launcher.Main.main(Main.java:962)
Comment 1 Tod Creasey CLA 2006-09-21 09:06:29 EDT
Dani I would like your opinion.

This issue is going to happen to lot of pages that are currently out there (including two of the ltk ones at least). I think the best solution is to disable OK on closed projects (with an error message of course).

What do you think?
Comment 2 Dani Megert CLA 2006-09-21 09:13:38 EDT
>(including two of the ltk ones at least)
Which ones do you mean?
Comment 3 Dani Megert CLA 2006-09-21 09:34:00 EDT
>This issue is going to happen to lot of pages 
I could not find that many.

>disable OK on closed projects 
In my opinion the correct solution would be to make the controls (or as a general solution the whole page) plus the 'Restore To Defaults' button read-only. Leaving 'Apply' and 'OK' enabled shouldn't hurt since no changes can be made.
Comment 4 Tod Creasey CLA 2006-09-21 10:05:01 EDT
When you propose readOnly are you suggesting we do a setEnabled(false) on the main control?

This would make browsing difficult for things like lists and tables.

DJ was also keen on the idea that we just fix our pages - if you think the same we likely should just got this wat.

The RefactoringpropertyPage is the one with this problem - I'll log a bug if we go the "fix it all" route.
Comment 5 Dani Megert CLA 2006-09-21 10:14:52 EDT
>When you propose readOnly are you suggesting we do a setEnabled(false) on the
>main control?
No, I wasn't talking about an implementation at that point ;-) i.e. meant: make everything that allows input non-modifiable.

I was also thinking along the lines of DJ i.e. don't try to come up with a general solution but just fix the pages that cause problems.

>RefactoringpropertyPage 
How do you make that one appear for closed projects? Please log a bug.
Comment 6 Tod Creasey CLA 2006-09-21 11:05:36 EDT
The exception below is actually with storing the line delimiter preference. I think fixing the indvidual pages is a better idea.

Dani I am trying to figure out how I got the refactoring page for a closed project but I am having a hard time. I'll log a bug when I can replicate.
Comment 7 Dani Megert CLA 2006-09-21 11:35:15 EDT
>I'll log a bug when I can replicate.
Ah, yeah - that's the 'Refactoring History' property page. It shouldn't even appear. That it does in some cases is covered by bug 154735.
Comment 8 Tod Creasey CLA 2006-09-22 15:38:53 EDT
Created attachment 50725 [details]
Updared project reference page
Comment 9 Tod Creasey CLA 2006-09-22 15:39:20 EDT
Created attachment 50726 [details]
Updated ResourceInfo page
Comment 10 Tod Creasey CLA 2006-09-25 10:45:59 EDT
Fixed in build >20060925
Comment 11 Dani Megert CLA 2006-09-26 11:34:38 EDT
Verified in I20060926-0935.