Community
Participate
Working Groups
final State state = new ToggleState(); final boolean checked = readBoolean(element, ATT_STATE, false); state.setValue((checked) ? Boolean.TRUE : Boolean.FALSE); command.addState(IMenuStateIds.STYLE, state); As seen in the fourth line above, we are adding a State object into the Command. However, this code is executed every time a new workbench window is opened. This effectively means that someone that tries to attach an IStateListener to some command's state will become useless once a new workbench window is opened as the state object is replaced and is no longer registered with the command. ------------------------------- This is broken in _both_ 3.x and 4.x. Thread [main] (Suspended (breakpoint at line 442 in LegacyActionPersistence)) LegacyActionPersistence.convertActionToCommand(IConfigurationElement, String, String, List) line: 442 LegacyActionPersistence.readActions(String, IConfigurationElement[], List, Expression, String) line: 737 LegacyActionPersistence.readActionsAndMenus(IConfigurationElement, String, List, Expression, String) line: 786 LegacyActionPersistence.readActionSets(IConfigurationElement[], int) line: 841 LegacyActionPersistence.read() line: 678 WorkbenchWindow.initializeDefaultServices() line: 4129 WorkbenchWindow.<init>(int) line: 399 Workbench3xImplementation.createWorkbenchWindow(int) line: 31 Workbench.newWorkbenchWindow() line: 1925 Workbench.access$14(Workbench) line: 1923 Workbench$21.runWithException() line: 1207 Workbench$21(StartupThreading$StartupRunnable).run() line: 31 UISynchronizer(Synchronizer).syncExec(Runnable) line: 180 UISynchronizer.syncExec(Runnable) line: 150 Display.syncExec(Runnable) line: 4683 StartupThreading.runWithWorkbenchExceptions(StartupThreading$StartupRunnable) line: 50 Workbench.busyOpenWorkbenchWindow(String, IAdaptable) line: 1205 Workbench.access$31(Workbench, String, IAdaptable) line: 1201 Workbench$58.run() line: 2220 BusyIndicator.showWhile(Display, Runnable) line: 70 Workbench.openWorkbenchWindow(String, IAdaptable) line: 2217 OpenInNewWindowHandler.execute(ExecutionEvent) line: 58 ------------------------------- Thread [main] (Suspended (breakpoint at line 256 in LegacyActionPersistence)) LegacyActionPersistence.convertActionToCommand(IConfigurationElement, String, String, List) line: 256 LegacyActionPersistence.readActions(String, IConfigurationElement[], List, Expression, String) line: 524 LegacyActionPersistence.readActionsAndMenus(IConfigurationElement, String, List, Expression, String) line: 570 LegacyActionPersistence.readActionSets(IConfigurationElement[], int) line: 625 LegacyActionPersistence.read() line: 471 WorkbenchWindow.initializeDefaultServices() line: 2278 WorkbenchWindow.setup() line: 495 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 88 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 55 Method.invoke(Object, Object...) line: 613 MethodRequestor.execute() line: 56 InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 838 InjectorImpl.inject(Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 110 InjectorImpl.inject(Object, PrimaryObjectSupplier) line: 80 ContextInjectionFactory.inject(Object, IEclipseContext) line: 72 Workbench.createWorkbenchWindow(IAdaptable, IPerspectiveDescriptor, MWindow, boolean) line: 1233 Workbench.openWorkbenchWindow(IAdaptable, IPerspectiveDescriptor, MWindow, boolean) line: 2244 Workbench.openWorkbenchWindow(String, IAdaptable) line: 2236 OpenInNewWindowHandler.execute(ExecutionEvent) line: 58
Created attachment 209316 [details] LegacyActionPersistence patch v1
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the "stalebug" whiteboard tag.