Bug 86107 ClassCastException while importing Organize Imports preferences
I20050219-1500 Found the following while importing Organize Import preferences from the Organize Import preference page. java.lang.ClassCastException at org.eclipse.jdt.internal.ui.preferences.ImportOrganizeConfigurationBlock$ImportOrganizeLabelProvider.getText(ImportOrganizeConfigurationBlock.java:115) at org.eclipse.jface.viewers.StructuredViewer.buildLabel(StructuredViewer.java:1730) at org.eclipse.jface.viewers.TableViewer.doUpdateItem(TableViewer.java:421) at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:352) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1015) at org.eclipse.core.runtime.Platform.run(Platform.java:757) at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:1655) at org.eclipse.jface.viewers.TableViewer.internalRefreshAll(TableViewer.java:804) at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:710) at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:699) at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1172) at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1109) at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1170) at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1129) at org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField.setElements(ListDialogField.java:549) at org.eclipse.jdt.internal.ui.preferences.ImportOrganizeConfigurationBlock.doButtonPressed(ImportOrganizeConfigurationBlock.java:281) at org.eclipse.jdt.internal.ui.preferences.ImportOrganizeConfigurationBlock.access$0(ImportOrganizeConfigurationBlock.java:250) at org.eclipse.jdt.internal.ui.preferences.ImportOrganizeConfigurationBlock$ImportOrganizeAdapter.customButtonPressed(ImportOrganizeConfigurationBlock.java:135) at org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField.buttonPressed(ListDialogField.java:202) at org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField.doButtonSelected(ListDialogField.java:450) at org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField.access$0(ListDialogField.java:446) at org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField$2.widgetSelected(ListDialogField.java:413) 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:2908) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541) at org.eclipse.jface.window.Window.runEventLoop(Window.java:718) at org.eclipse.jface.window.Window.open(Window.java:696) at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:66) at org.eclipse.jface.action.Action.runWithEvent(Action.java:1003) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:557) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:507) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:421) 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:2908) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1612) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1578) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:293) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:333) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:150) 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:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:268) at org.eclipse.core.launcher.Main.basicRun(Main.java:260) at org.eclipse.core.launcher.Main.run(Main.java:887) at org.eclipse.core.launcher.Main.main(Main.java:871)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/ImportOrganizeConfigurationBlock.java
String fileName= dialog.open();
		if (fileName != null) {
			dialogSettings.put(DIALOGSETTING_LASTSAVEPATH, dialog.getFilterPath());
			
			Properties properties= new Properties();
			for (int i= 0; i < elements.size(); i++) {
				ImportOrderEntry entry= (ImportOrderEntry) elements.get(i);
				properties.setProperty(String.valueOf(i), entry.serialize());
			}
			FileOutputStream fos= null;
			try {
				fos= new FileOutputStream(fileName);
				properties.store(fos, "Organize Import Order"); 
			} catch (IOException e) {
				JavaPlugin.log(e);
				String title= PreferencesMessages.getString("ImportOrganizeConfigurationBlock.saveDialog.error.title"); 
				String message= PreferencesMessages.getString("ImportOrganizeConfigurationBlock.saveDialog.error.message"); 
				MessageDialog.openError(getShell(), title, message);				
			} finally {
				if (fos != null) {
					try { fos.close(); } catch (IOException e) {}
				}
			}
		}
	}
	private void updateStatus(IStatus status) {
		fContext.statusChanged(status);
	}
	
	/* (non-Javadoc)