Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java2
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java160
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java4
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java34
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java12
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java22
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java182
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java44
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java22
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java84
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java20
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java62
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java46
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java36
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java14
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java38
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java40
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java58
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java28
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java92
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java12
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java34
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java32
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java40
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java318
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java330
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java14
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java68
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java62
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java30
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java802
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java52
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java82
-rw-r--r--org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java2576
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java178
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java212
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java32
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java98
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java152
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java16
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java68
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java356
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java60
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java6
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java24
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java34
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java8
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java16
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java110
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java20
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java16
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java28
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java32
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java28
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java28
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java24
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java88
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java16
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java26
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java18
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java28
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java12
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java20
-rw-r--r--org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java36
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java6
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java104
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java24
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java2
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java48
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java34
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java304
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java148
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java6
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java176
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java76
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java98
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java30
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java28
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java86
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java30
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java94
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java16
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java64
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java106
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java64
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java32
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java56
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java54
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java18
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java12
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/LocalSuite.java8
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java34
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java934
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/DynamicRenderingBindings.java36
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/MemoryRenderingTests.java68
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/CheckTests.java80
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ChildrenUpdateTests.java74
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ColumnPresentationTests.java94
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ContentTests.java330
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DeltaTests.java842
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTests.java376
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java54
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerCheckTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerContentTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerDeltaTests.java20
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerFilterTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerLazyTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPerformanceTests.java16
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPopupTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerSelectionTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerStateTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerTopIndexTests.java576
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerUpdateTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/LazyTests.java262
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PerformanceTests.java390
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PopupTests.java204
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java22
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/SelectionTests.java292
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/StateTests.java1266
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java1668
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java114
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreePathWrapper.java68
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/UpdateTests.java796
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerContentTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerDeltaTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerFilterTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerLazyModeTests.java14
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPerformanceTests.java16
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPopupTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerSelectionTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerStateTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerUpdateTests.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VisibleVirtualItemValidator.java124
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugListSelectionDialog.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugSelectionDialog.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CompositeDebugImageDescriptor.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java70
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java512
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java68
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java796
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java228
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java176
-rwxr-xr-xorg.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTFactory.java140
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java120
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java250
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/CollapseAllAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java1152
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java62
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java116
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java88
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java152
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java68
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/AccessWatchpointToggleAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java68
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModificationWatchpointToggleAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModifyWatchpointAction.java132
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RetargetBreakpointAction.java76
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java92
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressionAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/ReevaluateWatchExpressionAction.java52
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/SelectAllExpressionsAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java70
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionFactoryTester.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java160
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueAction.java74
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueInputDialog.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java120
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java52
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java80
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java78
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/IEnabledTarget.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java102
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java176
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java50
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java72
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java112
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AsynchronousDebugLabelAdapter.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointsViewInput.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/WatchExpressionCellModifier.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/CommonTabLite.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java188
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java218
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpoints.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpointsPage.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpoints.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java86
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CompileErrorProjectPromptStatusHandler.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DebugModePromptStatusHandler.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java102
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java240
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectFavoritesDialog.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingType.java82
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java72
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java1908
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementLabelProvider.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementMementoProvider.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugTargetContentProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java146
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java104
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionLabelProvider.java224
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java196
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/MemoryRetrievalContentProvider.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/StackFrameContentProvider.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java312
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableLabelProvider.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ViewerInputProvider.java64
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java114
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/AddSourceContainerDialog.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java214
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupResult.java142
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/DirectorySourceContainerDialog.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerDialog.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PasswordPrompt.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java294
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java252
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableModel.java108
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java646
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java186
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java82
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/LabelRequestMonitor.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java138
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PartPresentationContext.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java144
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java72
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java192
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java230
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java392
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java112
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java80
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java62
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/IInternalTreeModelViewer.java524
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelContentProvider.java434
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProvider.java82
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java1428
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java2580
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/SubTreeModelViewer.java964
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java130
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java2010
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java268
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java128
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerInputUpdate.java146
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java2086
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java242
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java240
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java282
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java154
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java438
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java306
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java252
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java996
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java332
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java318
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java86
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java148
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java102
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousContentAdapter.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousLabelAdapter.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IChildrenRequestMonitor.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IContainerRequestMonitor.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/ILabelRequestMonitor.java50
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java132
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetEventHandler.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java160
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultVariableViewModelProxy.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java410
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionEventHandler.java60
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchProxy.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java88
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java142
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java1210
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java1064
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java136
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java94
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java132
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java370
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java132
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java80
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java116
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java610
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java622
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java100
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java158
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java156
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java116
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java1202
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java454
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java234
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java710
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java226
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java332
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java1272
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java840
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java96
-rwxr-xr-xorg.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingCellModifier.java276
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRendering.java52
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java164
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingCellModifier.java318
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesViewMessages.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/EditVariableLogicalStructureAction.java70
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectionDragAdapter.java62
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java214
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java98
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java90
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java502
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java276
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java460
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegate.java174
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegateExtension.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java224
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IInstructionPointerPresentation.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java344
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java128
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java470
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java394
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java92
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java108
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManagerListener.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IVariableValueEditor.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IWatchExpressionFactoryAdapter2.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java276
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java172
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java64
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/ISuspendTrigger.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java214
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingBindingsProvider.java74
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite2.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java74
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingType.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingTypeDelegate.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/ISourceLookupResult.java60
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java2
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java516
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java20
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java12
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java2
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java20
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java2
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java130
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java20
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java2
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java192
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java64
555 files changed, 34343 insertions, 34343 deletions
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java
index 8ddd8ea49..c1dc1f9a0 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java
@@ -101,7 +101,7 @@ public class ExternalToolsCoreUtil {
* @throws CoreException if unable to access the associated attribute
*/
public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException {
- return configuration.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
+ return configuration.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
}
/**
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java
index 9ad2ab499..37d7d6fa2 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java
@@ -65,7 +65,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
private static String buildType = IExternalToolConstants.BUILD_TYPE_NONE;
private static IProject buildProject= null;
- private static IResourceDelta buildDelta= null;
+ private static IResourceDelta buildDelta= null;
@Override
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
@@ -74,9 +74,9 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
}
ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]);
- if (config == null) {
- throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null);
- }
+ if (config == null) {
+ throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null);
+ }
IProject[] projectsWithinScope= null;
IResource[] resources = ExternalToolsCoreUtil.getResourcesForBuildScope(config);
if (resources != null) {
@@ -85,64 +85,64 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
projectsWithinScope[i]= resources[i].getProject();
}
}
- boolean kindCompatible= commandConfiguredForKind(config, kind);
- if (kindCompatible && configEnabled(config)) {
- doBuildBasedOnScope(resources, kind, config, args, monitor);
- }
+ boolean kindCompatible= commandConfiguredForKind(config, kind);
+ if (kindCompatible && configEnabled(config)) {
+ doBuildBasedOnScope(resources, kind, config, args, monitor);
+ }
return projectsWithinScope;
}
- private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) {
- try {
- if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
- ICommand command= getCommand();
- //adapt the builder command to make use of the 3.1 support for setting command build kinds
- //this will only happen once for builder/command defined before the support existed
- BuilderCoreUtils.configureTriggers(config, command);
- IProjectDescription desc= getProject().getDescription();
- ICommand[] commands= desc.getBuildSpec();
- int index= getBuilderCommandIndex(commands, command);
- if (index != -1) {
- commands[index]= command;
- desc.setBuildSpec(commands);
- getProject().setDescription(desc, null);
- ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy();
- copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
- copy.doSave();
- }
- return command.isBuilding(kind);
- }
- } catch (CoreException e) {
- ExternalToolsCore.log(e);
- return true;
- }
- return true;
- }
+ private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) {
+ try {
+ if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
+ ICommand command= getCommand();
+ //adapt the builder command to make use of the 3.1 support for setting command build kinds
+ //this will only happen once for builder/command defined before the support existed
+ BuilderCoreUtils.configureTriggers(config, command);
+ IProjectDescription desc= getProject().getDescription();
+ ICommand[] commands= desc.getBuildSpec();
+ int index= getBuilderCommandIndex(commands, command);
+ if (index != -1) {
+ commands[index]= command;
+ desc.setBuildSpec(commands);
+ getProject().setDescription(desc, null);
+ ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy();
+ copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
+ copy.doSave();
+ }
+ return command.isBuilding(kind);
+ }
+ } catch (CoreException e) {
+ ExternalToolsCore.log(e);
+ return true;
+ }
+ return true;
+ }
- private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) {
+ private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) {
Map<String, String> commandArgs = command.getArguments();
- if (commandArgs == null) {
- return -1;
- }
- String handle= commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE);
- if (handle == null) {
- return -1;
- }
- for (int i = 0; i < buildSpec.length; ++i) {
- ICommand buildSpecCommand= buildSpec[i];
- if (ID.equals(buildSpecCommand.getBuilderName())) {
+ if (commandArgs == null) {
+ return -1;
+ }
+ String handle= commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE);
+ if (handle == null) {
+ return -1;
+ }
+ for (int i = 0; i < buildSpec.length; ++i) {
+ ICommand buildSpecCommand= buildSpec[i];
+ if (ID.equals(buildSpecCommand.getBuilderName())) {
Map<String, String> buildSpecArgs = buildSpecCommand.getArguments();
- if (buildSpecArgs != null) {
- String buildSpecHandle= buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE);
- if (handle.equals(buildSpecHandle)) {
- return i;
- }
- }
- }
- }
- return -1;
- }
+ if (buildSpecArgs != null) {
+ String buildSpecHandle= buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE);
+ if (handle.equals(buildSpecHandle)) {
+ return i;
+ }
+ }
+ }
+ }
+ return -1;
+ }
/**
* Returns whether the given builder config is enabled or not.
@@ -204,15 +204,15 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
return buildProject;
}
- /**
- * Returns the <code>IResourceDelta</code> that is being built and has triggered the current external
- * tool builder. <code>null</code> is returned if no build is currently occurring.
- *
- * @return resource delta for the build or <code>null</code>
- */
- public static IResourceDelta getBuildDelta() {
- return buildDelta;
- }
+ /**
+ * Returns the <code>IResourceDelta</code> that is being built and has triggered the current external
+ * tool builder. <code>null</code> is returned if no build is currently occurring.
+ *
+ * @return resource delta for the build or <code>null</code>
+ */
+ public static IResourceDelta getBuildDelta() {
+ return buildDelta;
+ }
/**
* Stores the currently active build kind and build project when a build begins
@@ -238,9 +238,9 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
buildType = IExternalToolConstants.BUILD_TYPE_AUTO;
buildDelta = getDelta(getProject());
break;
- case IncrementalProjectBuilder.CLEAN_BUILD :
- buildType = IExternalToolConstants.BUILD_TYPE_CLEAN;
- break;
+ case IncrementalProjectBuilder.CLEAN_BUILD :
+ buildType = IExternalToolConstants.BUILD_TYPE_CLEAN;
+ break;
default :
buildType = IExternalToolConstants.BUILD_TYPE_NONE;
break;
@@ -254,7 +254,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
private void buildEnded() {
buildType= IExternalToolConstants.BUILD_TYPE_NONE;
buildProject= null;
- buildDelta= null;
+ buildDelta= null;
}
private boolean buildScopeIndicatesBuild(IResource[] resources) {
@@ -281,20 +281,20 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
return false;
}
- @Override
+ @Override
protected void clean(IProgressMonitor monitor) throws CoreException {
- ICommand command= getCommand();
- ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]);
- if (!configEnabled(config)) {
- return;
- }
+ ICommand command= getCommand();
+ ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]);
+ if (!configEnabled(config)) {
+ return;
+ }
- if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
- //old behavior
- super.clean(monitor);
- return;
- }
+ if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
+ //old behavior
+ super.clean(monitor);
+ return;
+ }
launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, null, monitor);
- }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java
index c9918df00..de6959f19 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java
@@ -53,9 +53,9 @@ public class DynamicVariable extends StringVariable implements IDynamicVariable
}
}
try {
- return fResolver.resolveValue(this, argument);
+ return fResolver.resolveValue(this, argument);
} catch (RuntimeException e) {
- throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind("Error while evaluating variable {0}.",new String[]{getName()}), e)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind("Error while evaluating variable {0}.",new String[]{getName()}), e)); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java
index eefb3845f..ffbeadbcd 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java
@@ -33,27 +33,27 @@ public class EclipseHomeVariableResolver implements IDynamicVariableResolver {
@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
- Location installLocation = Platform.getInstallLocation();
- if (installLocation != null) {
- URL url = installLocation.getURL();
- if (url != null) {
+ Location installLocation = Platform.getInstallLocation();
+ if (installLocation != null) {
+ URL url = installLocation.getURL();
+ if (url != null) {
// Try to convert the URL to an OS string, to be consistent with
// how other variables, like ${workspace_loc} resolve. See
// ResourceResolver.translateToValue(). [bugzilla 263535]
- String file = url.getFile();
- IPath path = Path.fromOSString(file);
- String osstr = path.toOSString();
- if (osstr.length() != 0) {
- return osstr;
- }
+ String file = url.getFile();
+ IPath path = Path.fromOSString(file);
+ String osstr = path.toOSString();
+ if (osstr.length() != 0) {
+ return osstr;
+ }
- if (file.length() != 0) {
- return file;
- }
- }
- }
- return null;
- }
+ if (file.length() != 0) {
+ return file;
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
index e0013b526..fa980503a 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
@@ -558,13 +558,13 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
new StringSubstitutionEngine().validateStringVariables(expression, this);
}
- @Override
+ @Override
public String getContributingPluginId(IStringVariable variable) {
- if (variable instanceof StringVariable) {
- return ((StringVariable) variable).getConfigurationElement().getContributor().getName();
- }
- return null;
- }
+ if (variable instanceof StringVariable) {
+ return ((StringVariable) variable).getConfigurationElement().getContributor().getName();
+ }
+ return null;
+ }
@Override
public void preferenceChange(PreferenceChangeEvent event) {
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java
index db0ffb833..1731d14ac 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java
@@ -75,17 +75,17 @@ public interface IStringVariableManager {
*/
IDynamicVariable getDynamicVariable(String name);
- /**
- * Returns the plug-in identifier of the plug-in that contributed the
- * given variable via extension or <code>null</code> if the given
- * variable wasn't contributed via extension.
- *
- * @param variable the variable
- * @return the plug-in identifier of the plug-in that contributed the
- * given variable or <code>null</code>
- * @since 3.1
- */
- String getContributingPluginId(IStringVariable variable);
+ /**
+ * Returns the plug-in identifier of the plug-in that contributed the
+ * given variable via extension or <code>null</code> if the given
+ * variable wasn't contributed via extension.
+ *
+ * @param variable the variable
+ * @return the plug-in identifier of the plug-in that contributed the
+ * given variable or <code>null</code>
+ * @since 3.1
+ */
+ String getContributingPluginId(IStringVariable variable);
/**
* Recursively resolves and replaces all variable references in the given
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
index 313d3218e..534b5a79b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
@@ -154,10 +154,10 @@ import org.eclipse.debug.internal.core.DebugCoreMessages;
*/
public final class DebugEvent extends EventObject {
- /**
- * All objects that can be serialized should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
+ /**
+ * All objects that can be serialized should have a stable serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
/**
* Resume event kind.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java
index c913ea4a3..cd3a23d3d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java
@@ -32,10 +32,10 @@ import org.eclipse.core.runtime.IStatus;
*/
public class DebugException extends CoreException {
- /**
- * All objects that can be serialized should have a stable serialVersionUID
- */
- private static final long serialVersionUID = 1L;
+ /**
+ * All objects that can be serialized should have a stable serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
/**
* Indicates a request made of a debug element has failed
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 53d6db5c2..b1d681ee0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -276,21 +276,21 @@ public class DebugPlugin extends Plugin {
*/
public static final String ATTR_LAUNCH_TIMESTAMP = PI_DEBUG_CORE + ".launch.timestamp"; //$NON-NLS-1$
- /**
- * This launch attribute designates the encoding to be used by the console
- * associated with the launch.
- * <p>
- * For release 3.3, the system encoding is used when unspecified. Since 3.4,
- * the inherited encoding is used when unspecified. See {@link ILaunchManager} for a
- * description in <code>getEncoding(ILaunchConfiguration)</code>.
- * </p>
- * <p>
- * Value of this constant is the same as the value of the old
- * <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code> constant for backward
- * compatibility.
- * </p>
- * @since 3.3
- */
+ /**
+ * This launch attribute designates the encoding to be used by the console
+ * associated with the launch.
+ * <p>
+ * For release 3.3, the system encoding is used when unspecified. Since 3.4,
+ * the inherited encoding is used when unspecified. See {@link ILaunchManager} for a
+ * description in <code>getEncoding(ILaunchConfiguration)</code>.
+ * </p>
+ * <p>
+ * Value of this constant is the same as the value of the old
+ * <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code> constant for backward
+ * compatibility.
+ * </p>
+ * @since 3.3
+ */
public static final String ATTR_CONSOLE_ENCODING = "org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING"; //$NON-NLS-1$
/**
@@ -419,43 +419,43 @@ public class DebugPlugin extends Plugin {
EventNotifier fNotifier = new EventNotifier();
AsynchRunner fRunner = new AsynchRunner();
- /**
- * Creates a new event dispatch job.
- */
- public EventDispatchJob() {
- super(DebugCoreMessages.DebugPlugin_1);
- setPriority(Job.INTERACTIVE);
- setSystem(true);
- }
+ /**
+ * Creates a new event dispatch job.
+ */
+ public EventDispatchJob() {
+ super(DebugCoreMessages.DebugPlugin_1);
+ setPriority(Job.INTERACTIVE);
+ setSystem(true);
+ }
- @Override
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- while (!fEventQueue.isEmpty()) {
- Object next = null;
- synchronized (fEventQueue) {
- if (!fEventQueue.isEmpty()) {
- next = fEventQueue.remove(0);
- }
- }
- if (next instanceof Runnable) {
- fRunner.async((Runnable) next);
- } else if (next != null) {
- fNotifier.dispatch((DebugEvent[]) next);
- }
- }
- return Status.OK_STATUS;
- }
-
- @Override
+ while (!fEventQueue.isEmpty()) {
+ Object next = null;
+ synchronized (fEventQueue) {
+ if (!fEventQueue.isEmpty()) {
+ next = fEventQueue.remove(0);
+ }
+ }
+ if (next instanceof Runnable) {
+ fRunner.async((Runnable) next);
+ } else if (next != null) {
+ fNotifier.dispatch((DebugEvent[]) next);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
public boolean shouldRun() {
- return shouldSchedule();
- }
+ return shouldSchedule();
+ }
- @Override
+ @Override
public boolean shouldSchedule() {
- return !(isShuttingDown() || fEventListeners.isEmpty());
- }
+ return !(isShuttingDown() || fEventListeners.isEmpty());
+ }
}
@@ -662,7 +662,7 @@ public class DebugPlugin extends Plugin {
}
fEventListeners.clear();
- fEventFilters.clear();
+ fEventFilters.clear();
SourceLookupUtils.shutdown();
Preferences.savePreferences(DebugPlugin.getUniqueIdentifier());
@@ -796,37 +796,37 @@ public class DebugPlugin extends Plugin {
return LogicalStructureManager.getDefault().getLogicalStructureTypes(value);
}
- /**
- * Returns the default logical structure type among the given combination of
- * logical structure types, or <code>null</code> if none. When the given combination
- * of logical structure type is applicable for a value, the default logical structure
- * type is used to display a value.
- *
- * @param types a combination of structures applicable to a value
- * @return the default structure that should be used to display the value
- * or <code>null</code> if none
- *
- * @since 3.1
- */
- public static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types) {
- return LogicalStructureManager.getDefault().getSelectedStructureType(types);
- }
-
- /**
- * Sets the default logical structure type among the given combination of logical structure
- * types. The logical structure types provided should all be applicable to a single
- * value. Specifying <code>null</code> indicates there is no default logical structure
- * for the given combination of types.
- *
- * @param types a combination of logical structure types applicable to a value
- * @param def the default logical structure among the given combination of types
- * or <code>null</code> if none
- *
- * @since 3.1
- */
- public static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def) {
- LogicalStructureManager.getDefault().setEnabledType(types, def);
- }
+ /**
+ * Returns the default logical structure type among the given combination of
+ * logical structure types, or <code>null</code> if none. When the given combination
+ * of logical structure type is applicable for a value, the default logical structure
+ * type is used to display a value.
+ *
+ * @param types a combination of structures applicable to a value
+ * @return the default structure that should be used to display the value
+ * or <code>null</code> if none
+ *
+ * @since 3.1
+ */
+ public static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types) {
+ return LogicalStructureManager.getDefault().getSelectedStructureType(types);
+ }
+
+ /**
+ * Sets the default logical structure type among the given combination of logical structure
+ * types. The logical structure types provided should all be applicable to a single
+ * value. Specifying <code>null</code> indicates there is no default logical structure
+ * for the given combination of types.
+ *
+ * @param types a combination of logical structure types applicable to a value
+ * @param def the default logical structure among the given combination of types
+ * or <code>null</code> if none
+ *
+ * @since 3.1
+ */
+ public static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def) {
+ LogicalStructureManager.getDefault().setEnabledType(types, def);
+ }
/**
* Convenience method that performs a runtime exec on the given command line
@@ -876,8 +876,8 @@ public class DebugPlugin extends Plugin {
p= Runtime.getRuntime().exec(cmdLine, envp, workingDirectory);
}
} catch (IOException e) {
- Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e);
- throw new CoreException(status);
+ Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e);
+ throw new CoreException(status);
} catch (NoSuchMethodError e) {
//attempting launches on 1.2.* - no ability to set working directory
IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERR_WORKING_DIRECTORY_NOT_SUPPORTED, DebugCoreMessages.DebugPlugin_Eclipse_runtime_does_not_support_working_directory_2, e);
@@ -1165,7 +1165,7 @@ public class DebugPlugin extends Plugin {
}
for (IDebugEventSetListener iDebugEventSetListener : fEventListeners) {
fListener = iDebugEventSetListener;
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
fEvents = null;
fFilter = null;
@@ -1236,9 +1236,9 @@ public class DebugPlugin extends Plugin {
abort("Unable to parse XML document.", e); //$NON-NLS-1$
} finally {
try{
- if (stream != null) {
- stream.close();
- }
+ if (stream != null) {
+ stream.close();
+ }
} catch(IOException e) {
abort("Unable to parse XML document.", e); //$NON-NLS-1$
}
@@ -1651,25 +1651,25 @@ public class DebugPlugin extends Plugin {
* @since 3.4
*/
public static Object getAdapter(Object element, Class<?> type) {
- Object adapter = null;
- if (element != null) {
- if (type.isInstance(element)) {
+ Object adapter = null;
+ if (element != null) {
+ if (type.isInstance(element)) {
return element;
} else {
if (element instanceof IAdaptable) {
- adapter = ((IAdaptable)element).getAdapter(type);
+ adapter = ((IAdaptable)element).getAdapter(type);
}
// for objects that don't subclass PlatformObject, check the platform's adapter manager
if (adapter == null && !(element instanceof PlatformObject)) {
- adapter = Platform.getAdapterManager().getAdapter(element, type);
+ adapter = Platform.getAdapterManager().getAdapter(element, type);
}
// force load the adapter in case it really is available
if (adapter == null) {
adapter = Platform.getAdapterManager().loadAdapter(element, type.getName());
}
}
- }
- return adapter;
+ }
+ return adapter;
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
index 4228c4f93..892c97fee 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
@@ -241,28 +241,28 @@ public interface IBreakpointManager {
*/
void setEnabled(boolean enabled);
- /**
- * Returns the name (user readable String) of the given
- * breakpoint's type or <code>null</code> if none has been
- * specified.
- *
- * @param breakpoint the breakpoint
- * @return the name of the given breakpoint's type or <code>null</code>
- * @since 3.1
- */
- String getTypeName(IBreakpoint breakpoint);
-
- /**
- * Returns an array of {@link IBreakpointImportParticipant}s for the given
- * breakpoint marker id, never <code>null</code>.
- *
- * @param markertype the {@link String} identifier of the marker type
- * @return an array of {@link IBreakpointImportParticipant}s for the given marker type,
- * never <code>null</code>
- * @throws CoreException if an exception occurs
- * @since 3.5
- */
- IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException;
+ /**
+ * Returns the name (user readable String) of the given
+ * breakpoint's type or <code>null</code> if none has been
+ * specified.
+ *
+ * @param breakpoint the breakpoint
+ * @return the name of the given breakpoint's type or <code>null</code>
+ * @since 3.1
+ */
+ String getTypeName(IBreakpoint breakpoint);
+
+ /**
+ * Returns an array of {@link IBreakpointImportParticipant}s for the given
+ * breakpoint marker id, never <code>null</code>.
+ *
+ * @param markertype the {@link String} identifier of the marker type
+ * @return an array of {@link IBreakpointImportParticipant}s for the given marker type,
+ * never <code>null</code>
+ * @throws CoreException if an exception occurs
+ * @since 3.5
+ */
+ IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException;
/**
* Returns the triggers for the breakpoints associated with the workspace or
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java
index 6734919ee..461131954 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java
@@ -156,17 +156,17 @@ public interface IExpressionManager {
*/
IWatchExpressionDelegate newWatchExpressionDelegate(String id);
- /**
- * Returns whether a watch expression delegate has been contributed for
- * the given debug model.
- *
- * @param id the unique identifier of a debug model
- * @return whether a watch expression delegate has been contributed for
- * the given debug model
- * @since 3.1
- * @see IWatchExpressionDelegate
- */
- boolean hasWatchExpressionDelegate(String id);
+ /**
+ * Returns whether a watch expression delegate has been contributed for
+ * the given debug model.
+ *
+ * @param id the unique identifier of a debug model
+ * @return whether a watch expression delegate has been contributed for
+ * the given debug model
+ * @since 3.1
+ * @see IWatchExpressionDelegate
+ */
+ boolean hasWatchExpressionDelegate(String id);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java
index 827697b32..d220503fc 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IRequest.java
@@ -37,51 +37,51 @@ import org.eclipse.core.runtime.IStatus;
*/
public interface IRequest {
- /**
- * Sets the status for this request indicating whether this request
- * succeeded, failed, or was canceled. When a request fails, the status
- * indicates why the request failed. A <code>null</code> status is considered
- * to be successful. Only clients fulfilling a request should call this
- * method. Clients making a request are not intended to call this method.
- *
- * @param status request status or <code>null</code>
- */
- void setStatus(IStatus status);
+ /**
+ * Sets the status for this request indicating whether this request
+ * succeeded, failed, or was canceled. When a request fails, the status
+ * indicates why the request failed. A <code>null</code> status is considered
+ * to be successful. Only clients fulfilling a request should call this
+ * method. Clients making a request are not intended to call this method.
+ *
+ * @param status request status or <code>null</code>
+ */
+ void setStatus(IStatus status);
- /**
- * Returns the status of this request, or <code>null</code>.
- *
- * @return request status - <code>null</code> is equivalent
- * to an OK status
- */
- IStatus getStatus();
+ /**
+ * Returns the status of this request, or <code>null</code>.
+ *
+ * @return request status - <code>null</code> is equivalent
+ * to an OK status
+ */
+ IStatus getStatus();
- /**
- * Indicates this request is complete. Clients must call this method
- * whether the request succeeds, fails, or is cancelled to indicate that
- * processing is complete. Only clients fulfilling a request should call this
- * method. Clients making a request are not intended to call this method.
- */
- void done();
+ /**
+ * Indicates this request is complete. Clients must call this method
+ * whether the request succeeds, fails, or is cancelled to indicate that
+ * processing is complete. Only clients fulfilling a request should call this
+ * method. Clients making a request are not intended to call this method.
+ */
+ void done();
- /**
- * Cancels this request. A request may be canceled by the originator of request
- * or a client fulfilling a request. Optionally a canceled status may be set on
- * this request with more details. A client fulfilling a request must still call
- * <code>done()</code> to indicate the request is complete.
- */
- void cancel();
+ /**
+ * Cancels this request. A request may be canceled by the originator of request
+ * or a client fulfilling a request. Optionally a canceled status may be set on
+ * this request with more details. A client fulfilling a request must still call
+ * <code>done()</code> to indicate the request is complete.
+ */
+ void cancel();
- /**
- * Returns whether this request has been canceled.
- * <p>
- * Clients fulfilling a request are expected to poll a request (using <code>isCanceled</code>)
- * periodically and abort at their earliest convenience calling <code>done()</code>.
- * A request can be canceled by the originator of the request or a processor fulfilling a
- * request.
- * </p>
- * @return whether this request has been canceled
- */
- boolean isCanceled();
+ /**
+ * Returns whether this request has been canceled.
+ * <p>
+ * Clients fulfilling a request are expected to poll a request (using <code>isCanceled</code>)
+ * periodically and abort at their earliest convenience calling <code>done()</code>.
+ * A request can be canceled by the originator of the request or a processor fulfilling a
+ * request.
+ * </p>
+ * @return whether this request has been canceled
+ */
+ boolean isCanceled();
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
index fad75de0f..0f2cf17a3 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
@@ -493,9 +493,9 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
}
/**
- * Returns whether any processes or targets can be disconnected.
- * Ones that are already terminated or disconnected are ignored.
- *
+ * Returns whether any processes or targets can be disconnected.
+ * Ones that are already terminated or disconnected are ignored.
+ *
* @see org.eclipse.debug.core.model.IDisconnect#canDisconnect()
*/
@Override
@@ -517,7 +517,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
} finally {
readLock.unlock();
}
- return false;
+ return false;
}
/**
@@ -546,10 +546,10 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
}
/**
- * Returns whether all of the contained targets and processes are
- * disconnected. Processes that don't support disconnecting are not
- * counted.
- *
+ * Returns whether all of the contained targets and processes are
+ * disconnected. Processes that don't support disconnecting are not
+ * counted.
+ *
* @see org.eclipse.debug.core.model.IDisconnect#isDisconnected()
*/
@Override
@@ -571,8 +571,8 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
} finally {
readLock.unlock();
}
- // only return true if there are processes or targets that are disconnected
- return hasChildren();
+ // only return true if there are processes or targets that are disconnected
+ return hasChildren();
}
@Override
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
index 0bc82a904..15b204aad 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java
@@ -166,7 +166,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
/**
* Scheduling rule to serialize commands on an object
*/
- private class SerialPerObjectRule implements ISchedulingRule {
+ private class SerialPerObjectRule implements ISchedulingRule {
private Object fObject = null;
@@ -326,7 +326,7 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
* @return adapter or <code>null</code>
*/
protected Object getAdapter(Object element, Class<?> type) {
- return DebugPlugin.getAdapter(element, type);
+ return DebugPlugin.getAdapter(element, type);
}
/**
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
index b31cb9280..ef7c44ebf 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
@@ -346,14 +346,14 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint,
* possibly <code>null</code>
* @since 3.1
*/
- protected ISchedulingRule getMarkerRule(IResource resource) {
- ISchedulingRule rule = null;
- if (resource != null) {
- IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
- rule = ruleFactory.markerRule(resource);
- }
- return rule;
- }
+ protected ISchedulingRule getMarkerRule(IResource resource) {
+ ISchedulingRule rule = null;
+ if (resource != null) {
+ IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
+ rule = ruleFactory.markerRule(resource);
+ }
+ return rule;
+ }
/**
* Returns a scheduling rule to use when modifying or deleting this breakpoint's marker,
@@ -364,34 +364,34 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint,
* @return a scheduling rule to use when modifying or deleting this breakpoint's marker
* @since 3.1
*/
- protected ISchedulingRule getMarkerRule() {
- ISchedulingRule rule = null;
- IMarker marker = getMarker();
- if (marker != null) {
- IResource resource = marker.getResource();
- if (resource != null) {
- IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
- rule = ruleFactory.markerRule(resource);
- }
- }
- return rule;
- }
-
- /**
+ protected ISchedulingRule getMarkerRule() {
+ ISchedulingRule rule = null;
+ IMarker marker = getMarker();
+ if (marker != null) {
+ IResource resource = marker.getResource();
+ if (resource != null) {
+ IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
+ rule = ruleFactory.markerRule(resource);
+ }
+ }
+ return rule;
+ }
+
+ /**
* Execute the given workspace runnable with the scheduling rule to use when running the operation.
*
* @param rule the rule to use when running the operation
- * @param wr the runnable operation
- * @throws DebugException If a core exception occurs performing the operation
+ * @param wr the runnable operation
+ * @throws DebugException If a core exception occurs performing the operation
* @since 3.1
*/
- protected void run(ISchedulingRule rule, IWorkspaceRunnable wr) throws DebugException {
- try {
- ResourcesPlugin.getWorkspace().run(wr, rule, IWorkspace.AVOID_UPDATE, null);
- } catch (CoreException e) {
- throw new DebugException(e.getStatus());
- }
- }
+ protected void run(ISchedulingRule rule, IWorkspaceRunnable wr) throws DebugException {
+ try {
+ ResourcesPlugin.getWorkspace().run(wr, rule, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e) {
+ throw new DebugException(e.getStatus());
+ }
+ }
@Override
public String toString() {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java
index 38bcb82dd..d8be9a753 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java
@@ -31,27 +31,27 @@ import org.eclipse.debug.core.ILaunchConfiguration;
*/
public abstract class DebugElement extends PlatformObject implements IDebugElement {
- private IDebugTarget fTarget;
-
- /**
- * Constructs a debug element referring to an artifact in the given
- * debug target.
- *
- * @param target debug target containing this element
- */
- public DebugElement(IDebugTarget target) {
- fTarget = target;
- }
-
- @Override
+ private IDebugTarget fTarget;
+
+ /**
+ * Constructs a debug element referring to an artifact in the given
+ * debug target.
+ *
+ * @param target debug target containing this element
+ */
+ public DebugElement(IDebugTarget target) {
+ fTarget = target;
+ }
+
+ @Override
public IDebugTarget getDebugTarget() {
- return fTarget;
- }
+ return fTarget;
+ }
- @Override
+ @Override
public ILaunch getLaunch() {
- return getDebugTarget().getLaunch();
- }
+ return getDebugTarget().getLaunch();
+ }
@SuppressWarnings("unchecked")
@Override
@@ -80,7 +80,7 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme
return (T) getLaunch().getLaunchConfiguration();
}
return super.getAdapter(adapter);
- }
+ }
/**
* Fires a debug event.
@@ -105,7 +105,7 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme
/**
* Fires a creation event for this debug element.
*/
- public void fireCreationEvent() {
+ public void fireCreationEvent() {
fireEvent(new DebugEvent(this, DebugEvent.CREATE));
}
@@ -116,7 +116,7 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme
* @param detail detail code for the resume event, such
* as <code>DebugEvent.STEP_OVER</code>
*/
- public void fireResumeEvent(int detail) {
+ public void fireResumeEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
}
@@ -127,14 +127,14 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme
* @param detail detail code for the suspend event, such
* as <code>DebugEvent.BREAKPOINT</code>
*/
- public void fireSuspendEvent(int detail) {
+ public void fireSuspendEvent(int detail) {
fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
}
/**
* Fires a terminate event for this debug element.
*/
- public void fireTerminateEvent() {
+ public void fireTerminateEvent() {
fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java
index 1ac3b6230..d207d5f3a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDropToFrame.java
@@ -24,23 +24,23 @@ import org.eclipse.debug.core.DebugException;
*/
public interface IDropToFrame {
- /**
- * Returns whether this element can currently perform a drop to frame.
- * @return whether this element can currently perform a drop to frame
- */
- boolean canDropToFrame();
+ /**
+ * Returns whether this element can currently perform a drop to frame.
+ * @return whether this element can currently perform a drop to frame
+ */
+ boolean canDropToFrame();
- /**
- * Performs a drop to frame on this element. Implementations must generate
- * events such that debug clients can update appropriately, such as corresponding
- * <code>RESUME</code> and <code>SUSPEND</code> events, or a single <code>CHANGE</code>
- * event when the drop is complete. Implementations should implement drop to frame
- * in a non-blocking fashion.
- *
- * @throws DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
- * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
- * </ul>
- */
- void dropToFrame() throws DebugException;
+ /**
+ * Performs a drop to frame on this element. Implementations must generate
+ * events such that debug clients can update appropriately, such as corresponding
+ * <code>RESUME</code> and <code>SUSPEND</code> events, or a single <code>CHANGE</code>
+ * event when the drop is complete. Implementations should implement drop to frame
+ * in a non-blocking fashion.
+ *
+ * @throws DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
+ * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
+ * </ul>
+ */
+ void dropToFrame() throws DebugException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java
index ec2b81005..35f5eb121 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy2.java
@@ -27,11 +27,11 @@ import java.io.IOException;
*/
public interface IStreamsProxy2 extends IStreamsProxy {
- /**
- * Closes the output stream connected to the standard input stream
- * of this proxy's process.
- *
- * @throws IOException if unable to close the stream
- */
- void closeInputStream() throws IOException;
+ /**
+ * Closes the output stream connected to the standard input stream
+ * of this proxy's process.
+ *
+ * @throws IOException if unable to close the stream
+ */
+ void closeInputStream() throws IOException;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
index 898a04197..18b6b4131 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java
@@ -209,9 +209,9 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
}
if (mode.equals(ILaunchManager.RUN_MODE) && configuration.supportsMode(ILaunchManager.DEBUG_MODE)) {
IBreakpoint[] breakpoints= getBreakpoints(configuration);
- if (breakpoints == null) {
- return true;
- }
+ if (breakpoints == null) {
+ return true;
+ }
for (int i = 0; i < breakpoints.length; i++) {
if (breakpoints[i].isEnabled()) {
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
@@ -262,22 +262,22 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
}
}
- /**
- * Returns the breakpoint collection that is relevant for this launch delegate.
- * By default this is all the breakpoints registered with the Debug breakpoint manager.
- *
- * @param configuration the configuration to get associated breakpoints for
- * @since 3.1
- * @return the breakpoints that are relevant for this launch delegate
- */
- protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- if (!breakpointManager.isEnabled()) {
- // no need to check breakpoints individually.
- return null;
- }
- return breakpointManager.getBreakpoints();
- }
+ /**
+ * Returns the breakpoint collection that is relevant for this launch delegate.
+ * By default this is all the breakpoints registered with the Debug breakpoint manager.
+ *
+ * @param configuration the configuration to get associated breakpoints for
+ * @since 3.1
+ * @return the breakpoints that are relevant for this launch delegate
+ */
+ protected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration) {
+ IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
+ if (!breakpointManager.isEnabled()) {
+ // no need to check breakpoints individually.
+ return null;
+ }
+ return breakpointManager.getBreakpoints();
+ }
/**
* Returns an array of projects in their suggested build order
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java
index 829ebf1eb..16c8c2148 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/MemoryByte.java
@@ -27,9 +27,9 @@ package org.eclipse.debug.core.model;
*/
public class MemoryByte {
- /**
- * Bit mask used to indicate a byte is writable.
- */
+ /**
+ * Bit mask used to indicate a byte is writable.
+ */
public static final byte WRITABLE = 0x01;
/**
@@ -88,7 +88,7 @@ public class MemoryByte {
* by default.
*/
public MemoryByte() {
- this((byte)0, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN));
+ this((byte)0, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN));
}
/**
@@ -100,7 +100,7 @@ public class MemoryByte {
*
*/
public MemoryByte(byte byteValue) {
- this(byteValue, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN));
+ this(byteValue, (byte)(WRITABLE | READABLE | ENDIANESS_KNOWN));
}
/**
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
index d34a62320..9f56edef5 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java
@@ -203,12 +203,12 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
}
Process process = getSystemProcess();
if (process != null) {
- process.destroy();
+ process.destroy();
}
int attempts = 0;
while (attempts < MAX_WAIT_FOR_DEATH_ATTEMPTS) {
try {
- process = getSystemProcess();
+ process = getSystemProcess();
if (process != null) {
fExitValue = process.exitValue(); // throws exception if process not exited
}
@@ -236,24 +236,24 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* has terminated.
*/
protected void terminated() {
- if (fStreamsProxy instanceof StreamsProxy) {
- ((StreamsProxy)fStreamsProxy).close();
- }
+ if (fStreamsProxy instanceof StreamsProxy) {
+ ((StreamsProxy)fStreamsProxy).close();
+ }
- // Avoid calling IProcess.exitValue() inside a sync section (Bug 311813).
- int exitValue = -1;
- boolean running = false;
- try {
- exitValue = fProcess.exitValue();
- } catch (IllegalThreadStateException ie) {
- running = true;
- }
+ // Avoid calling IProcess.exitValue() inside a sync section (Bug 311813).
+ int exitValue = -1;
+ boolean running = false;
+ try {
+ exitValue = fProcess.exitValue();
+ } catch (IllegalThreadStateException ie) {
+ running = true;
+ }
synchronized (this) {
fTerminated= true;
if (!running) {
- fExitValue = exitValue;
+ fExitValue = exitValue;
}
fProcess= null;
}
@@ -265,9 +265,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
*/
@Override
public IStreamsProxy getStreamsProxy() {
- if (!fCaptureOutput) {
- return null;
- }
+ if (!fCaptureOutput) {
+ return null;
+ }
return fStreamsProxy;
}
@@ -277,9 +277,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* @return streams proxy
*/
protected IStreamsProxy createStreamsProxy() {
- if (!fCaptureOutput) {
- return new NullStreamsProxy(getSystemProcess());
- }
+ if (!fCaptureOutput) {
+ return new NullStreamsProxy(getSystemProcess());
+ }
String encoding = getLaunch().getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING);
return new StreamsProxy(getSystemProcess(), encoding);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
index 332f6af9e..3612cb1ff 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java
@@ -384,7 +384,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
@Override
public void initializeFromMemento(String memento) throws CoreException {
- doInitializeFromMemento(memento, true);
+ doInitializeFromMemento(memento, true);
}
/**
@@ -398,9 +398,9 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
* @since 3.1
*/
protected void doInitializeFromMemento(String memento, boolean dispose) throws CoreException {
- if (dispose) {
- dispose();
- }
+ if (dispose) {
+ dispose();
+ }
Element rootElement = DebugPlugin.parseDocument(memento);
if (!rootElement.getNodeName().equalsIgnoreCase(DIRECTOR_ROOT_NODE)) {
abort(SourceLookupMessages.AbstractSourceLookupDirector_14, null);
@@ -547,7 +547,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
@Override
public void initializeFromMemento(String memento, ILaunchConfiguration configuration) throws CoreException {
- dispose();
+ dispose();
setLaunchConfiguration(configuration);
doInitializeFromMemento(memento, false);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java
index b8c37e660..5659f020f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupParticipant.java
@@ -37,7 +37,7 @@ public interface ISourceLookupParticipant {
/**
* Notification this participant has been added to the specified
* source lookup director.
- *
+ *
* @param director the source lookup director that this participant
* has been added to
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java
index 7777b1ec5..e44e6e227 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java
@@ -59,7 +59,7 @@ public class ArchiveSourceContainer extends AbstractSourceContainer {
fFile = archive;
fDetectRoot = detectRootPath;
if (archive.exists() && archive.getLocation() != null) {
- fDelegateContainer = new ExternalArchiveSourceContainer(archive.getLocation().toOSString(), detectRootPath);
+ fDelegateContainer = new ExternalArchiveSourceContainer(archive.getLocation().toOSString(), detectRootPath);
}
}
@@ -93,38 +93,38 @@ public class ArchiveSourceContainer extends AbstractSourceContainer {
return getName().hashCode();
}
- @Override
+ @Override
public Object[] findSourceElements(String name) throws CoreException {
- ExternalArchiveSourceContainer container = getDelegateContainer();
- if (container != null) {
- return container.findSourceElements(name);
- }
- return EMPTY;
- }
+ ExternalArchiveSourceContainer container = getDelegateContainer();
+ if (container != null) {
+ return container.findSourceElements(name);
+ }
+ return EMPTY;
+ }
- /**
- * Returns the underlying external archive source container.
- *
- * @return underlying external archive source container
- * @since 3.0.1.1
- */
- private ExternalArchiveSourceContainer getDelegateContainer() {
- return fDelegateContainer;
- }
- @Override
+ /**
+ * Returns the underlying external archive source container.
+ *
+ * @return underlying external archive source container
+ * @since 3.0.1.1
+ */
+ private ExternalArchiveSourceContainer getDelegateContainer() {
+ return fDelegateContainer;
+ }
+ @Override
public void init(ISourceLookupDirector director) {
- super.init(director);
- if (fDelegateContainer != null) {
- fDelegateContainer.init(director);
- }
- }
- @Override
+ super.init(director);
+ if (fDelegateContainer != null) {
+ fDelegateContainer.init(director);
+ }
+ }
+ @Override
public void dispose() {
- super.dispose();
- if (fDelegateContainer != null) {
- fDelegateContainer.dispose();
- }
- }
+ super.dispose();
+ if (fDelegateContainer != null) {
+ fDelegateContainer.dispose();
+ }
+ }
/**
* Returns whether root paths are automatically detected in this
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
index 6fb34cac5..0b21c4dc0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
@@ -103,20 +103,20 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
}
// bug 295828 root file may be null for an invalid linked resource
if (fRootFile != null) {
- // See bug 98090 - we need to handle relative path names
- IFileStore target = fRootFile.getFileStore(new Path(name));
- if (target.fetchInfo().exists()) {
- // We no longer have to account for bug 95832, and URIs take care
- // of canonical paths (fix to bug 95679 was removed).
- IFile[] files = fRoot.findFilesForLocationURI(target.toURI());
- if (isFindDuplicates() && files.length > 1) {
- for (int i = 0; i < files.length; i++) {
- sources.add(files[i]);
- }
- } else if (files.length > 0) {
- sources.add(files[0]);
- }
- }
+ // See bug 98090 - we need to handle relative path names
+ IFileStore target = fRootFile.getFileStore(new Path(name));
+ if (target.fetchInfo().exists()) {
+ // We no longer have to account for bug 95832, and URIs take care
+ // of canonical paths (fix to bug 95679 was removed).
+ IFile[] files = fRoot.findFilesForLocationURI(target.toURI());
+ if (isFindDuplicates() && files.length > 1) {
+ for (int i = 0; i < files.length; i++) {
+ sources.add(files[i]);
+ }
+ } else if (files.length > 0) {
+ sources.add(files[0]);
+ }
+ }
}
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index cc991ebcb..9766252cb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
@@ -336,14 +336,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
// delete any markers that are not to be restored
if (!delete.isEmpty()) {
- final IMarker[] delMarkers = delete.toArray(new IMarker[delete.size()]);
+ final IMarker[] delMarkers = delete.toArray(new IMarker[delete.size()]);
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor pm) throws CoreException {
- for (int i = 0; i < delMarkers.length; i++) {
- IMarker marker = delMarkers[i];
- marker.delete();
- }
+ for (int i = 0; i < delMarkers.length; i++) {
+ IMarker marker = delMarkers[i];
+ marker.delete();
+ }
}
};
new BreakpointManagerJob(wr).schedule();
@@ -359,20 +359,20 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
getWorkspace().removeResourceChangeListener(this);
getWorkspace().removeResourceChangeListener(fPostChangeListener);
fBreakpointListeners.clear();
- fBreakpointsListeners.clear();
- fBreakpointManagerListeners.clear();
- if(fImportParticipants != null) {
- fImportParticipants.clear();
- fImportParticipants = null;
- fDefaultParticipant = null;
- }
- if(fBreakpoints != null) {
- fBreakpoints.clear();
- fBreakpoints = null;
- }
- if(fMarkersToBreakpoints != null) {
- fMarkersToBreakpoints.clear();
- }
+ fBreakpointsListeners.clear();
+ fBreakpointManagerListeners.clear();
+ if(fImportParticipants != null) {
+ fImportParticipants.clear();
+ fImportParticipants = null;
+ fDefaultParticipant = null;
+ }
+ if(fBreakpoints != null) {
+ fBreakpoints.clear();
+ fBreakpoints = null;
+ }
+ if(fMarkersToBreakpoints != null) {
+ fMarkersToBreakpoints.clear();
+ }
}
/**
@@ -597,7 +597,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
@Override
public void addBreakpoints(IBreakpoint[] breakpoints) throws CoreException {
- addBreakpoints(breakpoints, true);
+ addBreakpoints(breakpoints, true);
}
/**
@@ -615,7 +615,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
if (!getBreakpoints0().contains(breakpoint)) {
verifyBreakpoint(breakpoint);
if (breakpoint.isRegistered()) {
- // If notify == false, the breakpoints are just being added at startup
+ // If notify == false, the breakpoints are just being added at startup
added.add(breakpoint);
getBreakpoints0().add(breakpoint);
fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
@@ -626,7 +626,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
if (notify) {
- fireUpdate(added, null, ADDED);
+ fireUpdate(added, null, ADDED);
}
if (!update.isEmpty()) {
IWorkspaceRunnable r = new IWorkspaceRunnable() {
@@ -646,7 +646,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
getWorkspace().run(r, null, 0, null);
fSuppressChange.removeAll(update);
if (notify) {
- fireUpdate(update, null, ADDED);
+ fireUpdate(update, null, ADDED);
}
}
}
@@ -760,10 +760,10 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
- IMarker[] markers = fMoved.toArray(new IMarker[fMoved.size()]);
+ IMarker[] markers = fMoved.toArray(new IMarker[fMoved.size()]);
for (int i = 0; i < markers.length; i++) {
- markers[i].delete();
- }
+ markers[i].delete();
+ }
}
};
try {
@@ -1076,7 +1076,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
for (int j = 0; j < breakpoints.length; j++) {
fBreakpoint = breakpoints[j];
fDelta = deltas[j];
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
}
fListener = null;
@@ -1151,11 +1151,11 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
@Override
public void setEnabled(final boolean enabled) {
- if (isEnabled() != enabled) {
- Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_BREAKPOINT_MANAGER_ENABLED_STATE, enabled, null);
+ if (isEnabled() != enabled) {
+ Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_BREAKPOINT_MANAGER_ENABLED_STATE, enabled, null);
touchAllBreakpoints();
- new BreakpointManagerNotifier().notify(enabled);
- }
+ new BreakpointManagerNotifier().notify(enabled);
+ }
}
@Override
@@ -1197,7 +1197,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fManagerEnabled= enabled;
for (IBreakpointManagerListener iBreakpointManagerListener : fBreakpointManagerListeners) {
fListener = iBreakpointManagerListener;
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
fListener = null;
}
@@ -1259,21 +1259,21 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
}
- @Override
+ @Override
public String getTypeName(IBreakpoint breakpoint) {
- String typeName= null;
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- try {
- IConfigurationElement element = fBreakpointExtensions.get(marker.getType());
- if (element != null) {
- typeName= element.getAttribute(IConfigurationElementConstants.NAME);
- }
- }
- catch (CoreException e) {}
- }
- return typeName;
- }
+ String typeName= null;
+ IMarker marker = breakpoint.getMarker();
+ if (marker != null) {
+ try {
+ IConfigurationElement element = fBreakpointExtensions.get(marker.getType());
+ if (element != null) {
+ typeName= element.getAttribute(IConfigurationElementConstants.NAME);
+ }
+ }
+ catch (CoreException e) {}
+ }
+ return typeName;
+ }
@Override
public IBreakpointImportParticipant[] getImportParticipants(String markertype) throws CoreException {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
index 0a9cba4e0..92f0d7ad0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/EnvironmentVariableResolver.java
@@ -40,12 +40,12 @@ public class EnvironmentVariableResolver implements IDynamicVariableResolver {
String value = map.get(argument);
if (value == null && Platform.getOS().equals(Constants.OS_WIN32)) {
// On Win32, env variables are case insensitive, so we search the map
- // for matches manually.
+ // for matches manually.
for (Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
- if (key.equalsIgnoreCase(argument)) {
- return entry.getValue();
- }
+ if (key.equalsIgnoreCase(argument)) {
+ return entry.getValue();
+ }
}
}
return value;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
index c2ad9aca0..d3a27a28d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
@@ -134,11 +134,11 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
}
}
- @Override
+ @Override
public boolean hasWatchExpressionDelegate(String id) {
- IConfigurationElement element= fWatchExpressionDelegates.get(id);
- return element != null;
- }
+ IConfigurationElement element= fWatchExpressionDelegates.get(id);
+ return element != null;
+ }
/**
* Loads any persisted watch expressions from the preferences.
@@ -568,7 +568,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fListener = iExpressionListener;
for (int j = 0; j < expressions.length; j++) {
fExpression = expressions[j];
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
}
}
@@ -647,7 +647,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fIndex = index;
for (IExpressionsListener iExpressionsListener : fExpressionsListeners) {
fListener = iExpressionsListener;
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
}
fNotifierExpressions = null;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java
index 41f34957e..b77c5c957 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java
@@ -328,23 +328,23 @@ public interface IConfigurationElementConstants {
*/
String MEMENTO = "memento"; //$NON-NLS-1$
- /**
- * The selection node name for a configuration element.
- * <p>Equal to the word: <code>selection</code></p>
- */
- String SELECTION = "selection"; //$NON-NLS-1$
-
- /**
- * The debugContext node name for a configuration element.
- * <p>Equal to the word: <code>debugContext</code></p>
- */
- String DEBUG_CONTEXT = "debugContext"; //$NON-NLS-1$
-
- /**
- * The editorInput node name for a configuration element.
- * <p>Equal to the word: <code>editorInput</code></p>
- */
- String EDITOR_INPUT = "editorInput"; //$NON-NLS-1$
+ /**
+ * The selection node name for a configuration element.
+ * <p>Equal to the word: <code>selection</code></p>
+ */
+ String SELECTION = "selection"; //$NON-NLS-1$
+
+ /**
+ * The debugContext node name for a configuration element.
+ * <p>Equal to the word: <code>debugContext</code></p>
+ */
+ String DEBUG_CONTEXT = "debugContext"; //$NON-NLS-1$
+
+ /**
+ * The editorInput node name for a configuration element.
+ * <p>Equal to the word: <code>editorInput</code></p>
+ */
+ String EDITOR_INPUT = "editorInput"; //$NON-NLS-1$
/**
* The allowPrototypes node name for a configuration element
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
index fe531aae3..d06a8346f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
@@ -124,7 +124,7 @@ public class InputStreamMonitor {
}
if (!fClosed) {
try {
- fStream.close();
+ fStream.close();
} catch (IOException e) {
DebugPlugin.log(e);
}
@@ -157,20 +157,20 @@ public class InputStreamMonitor {
}
}
- /**
- * Closes the output stream attached to the standard input stream of this
- * monitor's process.
- *
- * @exception IOException if an exception occurs closing the input stream
- */
- public void closeInputStream() throws IOException {
- if (!fClosed) {
- fClosed = true;
- fStream.close();
- } else {
- throw new IOException();
- }
-
- }
+ /**
+ * Closes the output stream attached to the standard input stream of this
+ * monitor's process.
+ *
+ * @exception IOException if an exception occurs closing the input stream
+ */
+ public void closeInputStream() throws IOException {
+ if (!fClosed) {
+ fClosed = true;
+ fStream.close();
+ } else {
+ throw new IOException();
+ }
+
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
index f017d5700..0a10cb9cb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
@@ -291,8 +291,8 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
if (object instanceof LaunchConfiguration) {
LaunchConfiguration otherConfig = (LaunchConfiguration) object;
return getName().equals(otherConfig.getName())
- && getType().equals(otherConfig.getType())
- && equalOrNull(getContainer(), otherConfig.getContainer())
+ && getType().equals(otherConfig.getType())
+ && equalOrNull(getContainer(), otherConfig.getContainer())
&& getInfo().equals(otherConfig.getInfo());
}
return false;
@@ -717,21 +717,21 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
@Override
public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException {
- return launch(mode, monitor, build, true);
+ return launch(mode, monitor, build, true);
}
- @Override
+ @Override
public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
- /* Setup progress monitor
- * - Prepare delegate (0)
- * - Pre-launch check (1)
- * - [Build before launch (7)] if build
- * - [Incremental build before launch (3)] if build
- * - Final launch validation (1)
- * - Initialize source locator (1)
- * - Launch delegate (10) */
+ /* Setup progress monitor
+ * - Prepare delegate (0)
+ * - Pre-launch check (1)
+ * - [Build before launch (7)] if build
+ * - [Incremental build before launch (3)] if build
+ * - Final launch validation (1)
+ * - Initialize source locator (1)
+ * - Launch delegate (10) */
SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.LaunchConfiguration_9, build ? 23 : 13);
- try {
+ try {
// bug 28245 - force the delegate to load in case it is interested in launch notifications
Set<String> modes = getModes();
modes.add(mode);
@@ -809,9 +809,9 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
launch.setAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP, Long.toString(System.currentTimeMillis()));
boolean captureOutput = getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
if(!captureOutput) {
- launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, "false"); //$NON-NLS-1$
+ launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, "false"); //$NON-NLS-1$
} else {
- launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
+ launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
}
launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, getLaunchManager().getEncoding(this));
if (register) {
@@ -884,13 +884,13 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
getLaunchManager().removeLaunch(launch);
}
return launch;
- }
- finally {
+ }
+ finally {
lmonitor.done();
- }
- }
+ }
+ }
- @Override
+ @Override
public void migrate() throws CoreException {
((LaunchConfigurationType)getType()).migrate(this);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index ebe43feec..d505c00e9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -124,24 +124,24 @@ import com.ibm.icu.text.MessageFormat;
*/
public class LaunchManager extends PlatformObject implements ILaunchManager, IResourceChangeListener {
- /**
- * Preferred launch delegate preference name.
- * <p>
- * Prior to 3.5 this preferred launch delegates for all launch
- * configuration types were serialized into a single XML string
- * and stored in this preference.
- * </p>
- * <p>
- * Since 3.5, the preferred launch delegates are stored in a separate
- * preference for each launch configuration type. The name of this
- * preference is composed of the prefix, followed by a slash, followed by
- * the launch configuration type id. The values contain a set of launch
- * delegates, delimited by a semicolon, and each delegate entry contains
- * the delegate ID, followed by a comma, followed by comma-delimited
- * launch modes.
- *
- * @since 3.3
- */
+ /**
+ * Preferred launch delegate preference name.
+ * <p>
+ * Prior to 3.5 this preferred launch delegates for all launch
+ * configuration types were serialized into a single XML string
+ * and stored in this preference.
+ * </p>
+ * <p>
+ * Since 3.5, the preferred launch delegates are stored in a separate
+ * preference for each launch configuration type. The name of this
+ * preference is composed of the prefix, followed by a slash, followed by
+ * the launch configuration type id. The values contain a set of launch
+ * delegates, delimited by a semicolon, and each delegate entry contains
+ * the delegate ID, followed by a comma, followed by comma-delimited
+ * launch modes.
+ *
+ * @since 3.3
+ */
protected static final String PREF_PREFERRED_DELEGATES = DebugPlugin.getUniqueIdentifier() + ".PREFERRED_DELEGATES"; //$NON-NLS-1$
/**
@@ -259,7 +259,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fRegistered = null;
for (ILaunchesListener iLaunchesListener : fLaunchesListeners) {
fListener = iLaunchesListener;
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
fNotifierLaunches = null;
fRegistered = null;
@@ -357,7 +357,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
if (project.isOpen()) {
LaunchManager.this.projectOpened(project);
} else {
- LaunchManager.this.projectClosed(project);
+ LaunchManager.this.projectClosed(project);
}
}
return false;
@@ -414,7 +414,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fType = update;
for (ILaunchListener iLaunchListener : fListeners) {
fListener = iLaunchListener;
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
fLaunch = null;
fListener = null;
@@ -656,7 +656,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
private ILaunchConfiguration fTo;
- /**
+ /**
* Map of source container type extensions. Keys are extension ids
* and values are associated configuration elements.
*/
@@ -776,7 +776,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
// pattern is [func name]=() { and we must find the '}' on its own line with no trailing ';'
try (InputStream stream = process.getInputStream();
InputStreamReader isreader = new InputStreamReader(stream);
- BufferedReader reader = new BufferedReader(isreader)) {
+ BufferedReader reader = new BufferedReader(isreader)) {
String line = reader.readLine();
String key = null;
String value = null;
@@ -1097,7 +1097,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
if(reservednames == null) {
return generateUniqueLaunchConfigurationNameFrom(basename);
}
- int index = 1;
+ int index = 1;
int length= basename.length();
String base = basename;
int copyIndex = base.lastIndexOf(" ("); //$NON-NLS-1$
@@ -1256,10 +1256,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* @return the resource delta visitor for the launch manager
*/
private LaunchManagerVisitor getDeltaVisitor() {
- if (fgVisitor == null) {
+ if (fgVisitor == null) {
fgVisitor= new LaunchManagerVisitor();
}
- return fgVisitor;
+ return fgVisitor;
}
/**
@@ -1296,35 +1296,35 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
String nativeKey = null;
for (Entry<String, String> entry : configEnv.entrySet()) {
key = entry.getKey();
- value = entry.getValue();
- // translate any string substitution variables
- if (value != null) {
- value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
- }
- boolean added= false;
+ value = entry.getValue();
+ // translate any string substitution variables
+ if (value != null) {
+ value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
+ }
+ boolean added= false;
if (win32) {
- // First, check if the key is an exact match for an existing key.
+ // First, check if the key is an exact match for an existing key.
nativeValue = env.get(key);
- if (nativeValue != null) {
- // If an exact match is found, just replace the value
- env.put(key, value);
- } else {
- // Win32 variables are case-insensitive. If an exact match isn't found, iterate to
- // check for a case-insensitive match. We maintain the key's case (see bug 86725),
- // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH").
+ if (nativeValue != null) {
+ // If an exact match is found, just replace the value
+ env.put(key, value);
+ } else {
+ // Win32 variables are case-insensitive. If an exact match isn't found, iterate to
+ // check for a case-insensitive match. We maintain the key's case (see bug 86725),
+ // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH").
for (Entry<String, String> nativeEntry : env.entrySet()) {
nativeKey = (nativeEntry).getKey();
- if (nativeKey.equalsIgnoreCase(key)) {
- nativeEntry.setValue(value);
- added = true;
- break;
- }
- }
- }
- }
- if (!added) {
- env.put(key, value);
- }
+ if (nativeKey.equalsIgnoreCase(key)) {
+ nativeEntry.setValue(value);
+ added = true;
+ break;
+ }
+ }
+ }
+ }
+ if (!added) {
+ env.put(key, value);
+ }
}
List<String> strings = new ArrayList<>(env.size());
StringBuilder buffer = null;
@@ -1643,14 +1643,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
element = (Element) nodes.item(i);
String delegateid = element.getAttribute(IConfigurationElementConstants.ID);
typeid = element.getAttribute(IConfigurationElementConstants.TYPE_ID);
- String[] modes = element.getAttribute(IConfigurationElementConstants.MODES).split(","); //$NON-NLS-1$
+ String[] modes = element.getAttribute(IConfigurationElementConstants.MODES).split(","); //$NON-NLS-1$
modeset = new HashSet<>(Arrays.asList(modes));
LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateid, modeset);
if (delegate != null) {
- //take type id, modeset, delegate and create entry
- if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(typeid) & modeset != null) {
- fPreferredDelegates.add(new PreferredDelegate(delegate, typeid, modeset));
- }
+ //take type id, modeset, delegate and create entry
+ if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(typeid) & modeset != null) {
+ fPreferredDelegates.add(new PreferredDelegate(delegate, typeid, modeset));
+ }
}
}
}
@@ -1666,7 +1666,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* @since 3.6
*/
protected void resetPreferredDelegates() {
- fPreferredDelegates = null;
+ fPreferredDelegates = null;
}
/**
@@ -1678,8 +1678,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* @since 3.3
*/
protected ILaunchDelegate getPreferredDelegate(String typeid, Set<String> modes) {
- // Retrieve preferred delegates using legacy mechanism for backward
- // compatibility.
+ // Retrieve preferred delegates using legacy mechanism for backward
+ // compatibility.
initializePreferredDelegates();
for (PreferredDelegate pd : fPreferredDelegates) {
if(pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) {
@@ -1690,23 +1690,23 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
// @since 3.5
// If the legacy mechanism didn't work, try the new preference name for
// the given launch type.
- String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), "//" + LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, IInternalDebugCoreConstants.EMPTY_STRING, null); //$NON-NLS-1$
- if (preferred != null && preferred.length() != 0) {
- StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$
- while(tokenizer.hasMoreTokens()) {
- StringTokenizer tokenizer2 = new StringTokenizer(tokenizer.nextToken(), ","); //$NON-NLS-1$
- String delegateId = tokenizer2.nextToken();
+ String preferred = Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), "//" + LaunchManager.PREF_PREFERRED_DELEGATES + '/' + typeid, IInternalDebugCoreConstants.EMPTY_STRING, null); //$NON-NLS-1$
+ if (preferred != null && preferred.length() != 0) {
+ StringTokenizer tokenizer = new StringTokenizer(preferred, ";"); //$NON-NLS-1$
+ while(tokenizer.hasMoreTokens()) {
+ StringTokenizer tokenizer2 = new StringTokenizer(tokenizer.nextToken(), ","); //$NON-NLS-1$
+ String delegateId = tokenizer2.nextToken();
HashSet<String> modeset = new HashSet<>();
- while(tokenizer2.hasMoreTokens()) {
- modeset.add(tokenizer2.nextToken());
- }
- LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateId, modeset);
- if (delegate != null && modeset.equals(modes)) {
- return delegate;
- }
- }
-
- }
+ while(tokenizer2.hasMoreTokens()) {
+ modeset.add(tokenizer2.nextToken());
+ }
+ LaunchDelegate delegate = getLaunchDelegateExtension(typeid, delegateId, modeset);
+ if (delegate != null && modeset.equals(modes)) {
+ return delegate;
+ }
+ }
+
+ }
return null;
}
@@ -1723,16 +1723,16 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* @since 3.5
*/
private LaunchDelegate getLaunchDelegateExtension(String typeId, String id, Set<String> modeset) {
- LaunchDelegate[] extensions = getLaunchDelegates(typeId);
- for(int j = 0; j < extensions.length; j++) {
- if(id.equals(extensions[j].getId())) {
+ LaunchDelegate[] extensions = getLaunchDelegates(typeId);
+ for(int j = 0; j < extensions.length; j++) {
+ if(id.equals(extensions[j].getId())) {
List<Set<String>> modesets = extensions[j].getModes();
- if(modesets.contains(modeset)) {
- return extensions[j];
- }
- }
- }
- return null;
+ if(modesets.contains(modeset)) {
+ return extensions[j];
+ }
+ }
+ }
+ return null;
}
/**
@@ -1880,14 +1880,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
/**
- * Starts listening for resource change events
- */
- private synchronized void hookResourceChangeListener() {
- if (!fListening) {
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE);
- fListening = true;
- }
- }
+ * Starts listening for resource change events
+ */
+ private synchronized void hookResourceChangeListener() {
+ if (!fListening) {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE);
+ fListening = true;
+ }
+ }
/**
* Load comparator extensions.
@@ -2267,19 +2267,19 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
if (delta != null) {
- LaunchManagerVisitor visitor = getDeltaVisitor();
- MappedResourceVisitor v = null;
- if (isDeleteConfigurations()) {
- v = getMappedResourceVisitor();
- }
- try {
- delta.accept(visitor);
- if (v != null) {
- delta.accept(v);
- }
- } catch (CoreException e) {
- DebugPlugin.log(e.getStatus());
- }
+ LaunchManagerVisitor visitor = getDeltaVisitor();
+ MappedResourceVisitor v = null;
+ if (isDeleteConfigurations()) {
+ v = getMappedResourceVisitor();
+ }
+ try {
+ delta.accept(visitor);
+ if (v != null) {
+ delta.accept(v);
+ }
+ } catch (CoreException e) {
+ DebugPlugin.log(e.getStatus());
+ }
}
}
@@ -2311,8 +2311,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
}
} catch (CoreException e) {
- DebugPlugin.log(e);
- }
+ DebugPlugin.log(e);
+ }
return list;
}
@@ -2343,15 +2343,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
launch = launches[i];
if(launch != null) {
try {
- if (launch instanceof IDisconnect) {
- IDisconnect disconnect = (IDisconnect)launch;
- if (disconnect.canDisconnect()) {
- disconnect.disconnect();
- }
- }
- if (launch.canTerminate()) {
- launch.terminate();
- }
+ if (launch instanceof IDisconnect) {
+ IDisconnect disconnect = (IDisconnect)launch;
+ if (disconnect.canDisconnect()) {
+ disconnect.disconnect();
+ }
+ }
+ if (launch.canTerminate()) {
+ launch.terminate();
+ }
} catch (DebugException e) {
DebugPlugin.log(e);
}
@@ -2370,10 +2370,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* @since 3.3
*/
public void persistPreferredLaunchDelegates() {
- ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
- for(int i = 0; i < types.length; i++) {
- persistPreferredLaunchDelegate((LaunchConfigurationType)types[i]);
- }
+ ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
+ for(int i = 0; i < types.length; i++) {
+ persistPreferredLaunchDelegate((LaunchConfigurationType)types[i]);
+ }
}
/**
@@ -2382,31 +2382,31 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*
* @since 3.6
*/
- public void persistPreferredLaunchDelegate(LaunchConfigurationType type) {
- String preferenceName = PREF_PREFERRED_DELEGATES + '/' + type.getIdentifier();
+ public void persistPreferredLaunchDelegate(LaunchConfigurationType type) {
+ String preferenceName = PREF_PREFERRED_DELEGATES + '/' + type.getIdentifier();
Map<Set<String>, ILaunchDelegate> preferred = type.getPreferredDelegates();
- if(preferred != null && preferred.size() > 0) {
- StringBuilder str = new StringBuilder();
+ if(preferred != null && preferred.size() > 0) {
+ StringBuilder str = new StringBuilder();
for (Entry<Set<String>, ILaunchDelegate> entry : preferred.entrySet()) {
Set<String> modes = entry.getKey();
ILaunchDelegate delegate = entry.getValue();
if (delegate != null) {
- str.append(delegate.getId());
- str.append(',');
+ str.append(delegate.getId());
+ str.append(',');
for (String mode : modes) {
str.append(mode).append(',');
- }
+ }
str.append(';');
- }
- }
- Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null);
- } else {
- Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName);
- }
+ }
+ }
+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), preferenceName, str.toString(), null);
+ } else {
+ Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), preferenceName);
+ }
- // Reset the legacy preference string.
- Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), PREF_PREFERRED_DELEGATES);
- }
+ // Reset the legacy preference string.
+ Preferences.setToDefault(DebugPlugin.getUniqueIdentifier(), PREF_PREFERRED_DELEGATES);
+ }
/**
* finds and terminates any running launch configurations associated with the given resource
@@ -2485,28 +2485,28 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* @param label label to process
* @return label without accelerators
*/
- public static String removeAccelerators(String label) {
- String title = label;
- if (title != null) {
- // strip out any '&' (accelerators)
- int index = title.indexOf('&');
- if (index == 0) {
- title = title.substring(1);
- } else if (index > 0) {
- //DBCS languages use "(&X)" format
- if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') {
- String first = title.substring(0, index - 1);
- String last = title.substring(index + 3);
- title = first + last;
- } else if (index < (title.length() - 1)) {
- String first = title.substring(0, index);
- String last = title.substring(index + 1);
- title = first + last;
- }
- }
- }
- return title;
- }
+ public static String removeAccelerators(String label) {
+ String title = label;
+ if (title != null) {
+ // strip out any '&' (accelerators)
+ int index = title.indexOf('&');
+ if (index == 0) {
+ title = title.substring(1);
+ } else if (index > 0) {
+ //DBCS languages use "(&X)" format
+ if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') {
+ String first = title.substring(0, index - 1);
+ String last = title.substring(index + 3);
+ title = first + last;
+ } else if (index < (title.length() - 1)) {
+ String first = title.substring(0, index);
+ String last = title.substring(index + 1);
+ title = first + last;
+ }
+ }
+ }
+ return title;
+ }
/**
* Returns the singleton step filter manager.
@@ -2615,7 +2615,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
while ((i = fis.read(buf)) != -1) {
fos.write(buf, 0, i);
}
- }
+ }
}
/**
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
index 5362c0dd4..396160866 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java
@@ -39,37 +39,37 @@ public class LogicalStructureManager {
private List<LogicalStructureType> fTypes = null;
private List<LogicalStructureProvider> fTypeProviders;
- /**
- * Map containing the user's selection for each combination of logical
- * structure types.
- * key: String - Comma-separated list of ints representing a combination of structure types.
- * These integers are indeces into the fStructureTypeIds array.
- * value: Integer - One of the ints from the combo key (the one chosen by the user) or -1 if
- * the user has chosen not to display any structures for this combination
- */
+ /**
+ * Map containing the user's selection for each combination of logical
+ * structure types.
+ * key: String - Comma-separated list of ints representing a combination of structure types.
+ * These integers are indeces into the fStructureTypeIds array.
+ * value: Integer - One of the ints from the combo key (the one chosen by the user) or -1 if
+ * the user has chosen not to display any structures for this combination
+ */
private Map<String, Integer> fStructureTypeSelections = null;
- /**
- * List of known type identifiers. An identifier's index in this list is used as
- * its ID number. This list is maintained as a space-saving measure so that the various
- * combinations of structure types can be persisted using indeces instead of storing the
- * full index strings.
- */
+ /**
+ * List of known type identifiers. An identifier's index in this list is used as
+ * its ID number. This list is maintained as a space-saving measure so that the various
+ * combinations of structure types can be persisted using indeces instead of storing the
+ * full index strings.
+ */
private List<String> fStructureTypeIds = null;
- /**
- * Preference key used for storing the user's selected structure for each combination
- * or structures. The preference value is stored in the form:
- * int,int,...,int|int,int,...int|...
- * Where int is an integer index of a structure in the array of known structures.
- */
- public static final String PREF_STRUCTURE_SELECTIONS= "selectedStructures"; //$NON-NLS-1$
- /**
- * Preference key used for storing the array of known structures. The preference
- * value is in the form:
- * string,string,string,...,string,
- * Where string is an identifier of a logical structure.
- */
- public static final String PREF_STRUCTURE_IDS= "allStructures"; //$NON-NLS-1$
+ /**
+ * Preference key used for storing the user's selected structure for each combination
+ * or structures. The preference value is stored in the form:
+ * int,int,...,int|int,int,...int|...
+ * Where int is an integer index of a structure in the array of known structures.
+ */
+ public static final String PREF_STRUCTURE_SELECTIONS= "selectedStructures"; //$NON-NLS-1$
+ /**
+ * Preference key used for storing the array of known structures. The preference
+ * value is in the form:
+ * string,string,string,...,string,
+ * Where string is an identifier of a logical structure.
+ */
+ public static final String PREF_STRUCTURE_IDS= "allStructures"; //$NON-NLS-1$
public static LogicalStructureManager getDefault() {
if (fgDefault == null) {
@@ -78,11 +78,11 @@ public class LogicalStructureManager {
return fgDefault;
}
- /**
- * Returns the logical structure types that are applicable to the given value.
- * @param value the value
- * @return the logical structure types that are applicable to the given value
- */
+ /**
+ * Returns the logical structure types that are applicable to the given value.
+ * @param value the value
+ * @return the logical structure types that are applicable to the given value
+ */
public ILogicalStructureType[] getLogicalStructureTypes(IValue value) {
initialize();
// looks in the logical structure types
@@ -102,144 +102,144 @@ public class LogicalStructureManager {
return select.toArray(new ILogicalStructureType[select.size()]);
}
- /**
- * Loads the map of structure selections from the preference store.
- */
- private void loadStructureTypeSelections() {
+ /**
+ * Loads the map of structure selections from the preference store.
+ */
+ private void loadStructureTypeSelections() {
fStructureTypeSelections = new HashMap<>();
- String selections= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, IInternalDebugCoreConstants.EMPTY_STRING, null);
- // selections are stored in the form:
- // selection|selection|...selection|
- StringTokenizer tokenizer= new StringTokenizer(selections, "|"); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String selection = tokenizer.nextToken();
- // selection string is of the form:
- // id,id,...,selectedid
- int i = selection.lastIndexOf(',');
- if (i > 0 && i < selection.length() - 1) {
- String comboKey= selection.substring(0, i + 1);
- String selected= selection.substring(i + 1, selection.length());
- fStructureTypeSelections.put(comboKey, Integer.valueOf(Integer.parseInt(selected)));
- }
- }
- }
+ String selections= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, IInternalDebugCoreConstants.EMPTY_STRING, null);
+ // selections are stored in the form:
+ // selection|selection|...selection|
+ StringTokenizer tokenizer= new StringTokenizer(selections, "|"); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ String selection = tokenizer.nextToken();
+ // selection string is of the form:
+ // id,id,...,selectedid
+ int i = selection.lastIndexOf(',');
+ if (i > 0 && i < selection.length() - 1) {
+ String comboKey= selection.substring(0, i + 1);
+ String selected= selection.substring(i + 1, selection.length());
+ fStructureTypeSelections.put(comboKey, Integer.valueOf(Integer.parseInt(selected)));
+ }
+ }
+ }
- /**
- * Stores the map of structure selections to the preference store
- */
- private void storeStructureTypeSelections() {
- StringBuilder buffer= new StringBuilder();
+ /**
+ * Stores the map of structure selections to the preference store
+ */
+ private void storeStructureTypeSelections() {
+ StringBuilder buffer= new StringBuilder();
for (Entry<String, Integer> entry : fStructureTypeSelections.entrySet()) {
buffer.append(entry.getKey());
- buffer.append(entry.getValue());
- buffer.append('|');
- }
- Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, buffer.toString(), null);
- }
+ buffer.append(entry.getValue());
+ buffer.append('|');
+ }
+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_SELECTIONS, buffer.toString(), null);
+ }
- /**
- * Loads the collection of known structures identifiers from the preference store
- */
- private void loadStructureTypeIds() {
+ /**
+ * Loads the collection of known structures identifiers from the preference store
+ */
+ private void loadStructureTypeIds() {
fStructureTypeIds = new ArrayList<>();
- // Types are stored as a comma-separated, ordered list.
- String types= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, IInternalDebugCoreConstants.EMPTY_STRING, null);
- StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String id= tokenizer.nextToken();
- if (id.length() > 0) {
- fStructureTypeIds.add(id);
- }
- }
- }
+ // Types are stored as a comma-separated, ordered list.
+ String types= Platform.getPreferencesService().getString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, IInternalDebugCoreConstants.EMPTY_STRING, null);
+ StringTokenizer tokenizer= new StringTokenizer(types, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ String id= tokenizer.nextToken();
+ if (id.length() > 0) {
+ fStructureTypeIds.add(id);
+ }
+ }
+ }
- /**
- * Stores the collection of known structure identifiers to the preference store
- */
- private void storeStructureTypeIds() {
- StringBuilder buffer= new StringBuilder();
+ /**
+ * Stores the collection of known structure identifiers to the preference store
+ */
+ private void storeStructureTypeIds() {
+ StringBuilder buffer= new StringBuilder();
for (String id : fStructureTypeIds) {
buffer.append(id).append(',');
- }
- Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, buffer.toString(), null);
- }
+ }
+ Preferences.setString(DebugPlugin.getUniqueIdentifier(), PREF_STRUCTURE_IDS, buffer.toString(), null);
+ }
- /**
- * Returns the structure that the user has chosen from among the given
- * collection of structures or <code>null</code> if the user has chosen
- * to display none.
- * @param structureTypes the collection of structures available
- * @return the structure that the user has chosen from among the given collection
- * or <code>null</code> if the user has chosen to display none
- */
- public ILogicalStructureType getSelectedStructureType(ILogicalStructureType[] structureTypes) {
- if (structureTypes.length == 0) {
- return null;
- }
- String combo= getComboString(structureTypes);
- // Lookup the combo
- Integer index = fStructureTypeSelections.get(combo);
- if (index == null) {
- // If the user hasn't explicitly chosen anything for this
- // combo yet, just return the first type.
- return structureTypes[0];
- } else if (index.intValue() == -1) {
- // An index of -1 means the user has deselected all structures for this combo
- return null;
- }
- // If an index is stored for this combo, retrieve the id at the index
- String id= fStructureTypeIds.get(index.intValue());
- for (int i = 0; i < structureTypes.length; i++) {
- // Return the type with the retrieved id
- ILogicalStructureType type = structureTypes[i];
- if (type.getId().equals(id)) {
- return type;
- }
- }
- return structureTypes[0];
- }
+ /**
+ * Returns the structure that the user has chosen from among the given
+ * collection of structures or <code>null</code> if the user has chosen
+ * to display none.
+ * @param structureTypes the collection of structures available
+ * @return the structure that the user has chosen from among the given collection
+ * or <code>null</code> if the user has chosen to display none
+ */
+ public ILogicalStructureType getSelectedStructureType(ILogicalStructureType[] structureTypes) {
+ if (structureTypes.length == 0) {
+ return null;
+ }
+ String combo= getComboString(structureTypes);
+ // Lookup the combo
+ Integer index = fStructureTypeSelections.get(combo);
+ if (index == null) {
+ // If the user hasn't explicitly chosen anything for this
+ // combo yet, just return the first type.
+ return structureTypes[0];
+ } else if (index.intValue() == -1) {
+ // An index of -1 means the user has deselected all structures for this combo
+ return null;
+ }
+ // If an index is stored for this combo, retrieve the id at the index
+ String id= fStructureTypeIds.get(index.intValue());
+ for (int i = 0; i < structureTypes.length; i++) {
+ // Return the type with the retrieved id
+ ILogicalStructureType type = structureTypes[i];
+ if (type.getId().equals(id)) {
+ return type;
+ }
+ }
+ return structureTypes[0];
+ }
- /**
- *
- * @param types the array of types
- * @param selected the type that is selected for the given combo or <code>null</code>
- * if the user has de-selected any structure for the given combo
- */
- public void setEnabledType(ILogicalStructureType[] types, ILogicalStructureType selected) {
- String combo= getComboString(types);
- int index= -1; // Initialize to "none selected"
- if (selected != null) {
- index= fStructureTypeIds.indexOf(selected.getId());
- }
- Integer integer= Integer.valueOf(index);
- fStructureTypeSelections.put(combo, integer);
- storeStructureTypeSelections();
- storeStructureTypeIds();
- }
+ /**
+ *
+ * @param types the array of types
+ * @param selected the type that is selected for the given combo or <code>null</code>
+ * if the user has de-selected any structure for the given combo
+ */
+ public void setEnabledType(ILogicalStructureType[] types, ILogicalStructureType selected) {
+ String combo= getComboString(types);
+ int index= -1; // Initialize to "none selected"
+ if (selected != null) {
+ index= fStructureTypeIds.indexOf(selected.getId());
+ }
+ Integer integer= Integer.valueOf(index);
+ fStructureTypeSelections.put(combo, integer);
+ storeStructureTypeSelections();
+ storeStructureTypeIds();
+ }
- /**
- * Returns the string representing the given combination of logical
- * structure types. This string will be a series of comma-separated
- * indices representing the various types. If any of the given types
- * don't have indices associated with them, this method will create
- * the appropriate index.
- * @param types the logical structure types
- * @return the string representing the given combination of logical
- * structure types
- */
- protected String getComboString(ILogicalStructureType[] types) {
- StringBuilder comboKey= new StringBuilder();
- for (int i = 0; i < types.length; i++) {
- ILogicalStructureType type = types[i];
- int typeIndex = fStructureTypeIds.indexOf(type.getId());
- if (typeIndex == -1) {
- typeIndex= fStructureTypeIds.size();
- fStructureTypeIds.add(type.getId());
- }
- comboKey.append(typeIndex).append(',');
- }
- return comboKey.toString();
- }
+ /**
+ * Returns the string representing the given combination of logical
+ * structure types. This string will be a series of comma-separated
+ * indices representing the various types. If any of the given types
+ * don't have indices associated with them, this method will create
+ * the appropriate index.
+ * @param types the logical structure types
+ * @return the string representing the given combination of logical
+ * structure types
+ */
+ protected String getComboString(ILogicalStructureType[] types) {
+ StringBuilder comboKey= new StringBuilder();
+ for (int i = 0; i < types.length; i++) {
+ ILogicalStructureType type = types[i];
+ int typeIndex = fStructureTypeIds.indexOf(type.getId());
+ if (typeIndex == -1) {
+ typeIndex= fStructureTypeIds.size();
+ fStructureTypeIds.add(type.getId());
+ }
+ comboKey.append(typeIndex).append(',');
+ }
+ return comboKey.toString();
+ }
private synchronized void initialize() {
if (fTypes == null) {
@@ -269,11 +269,11 @@ public class LogicalStructureManager {
}
}
}
- if (fStructureTypeSelections == null) {
- loadStructureTypeSelections();
- }
- if (fStructureTypeIds == null) {
- loadStructureTypeIds();
- }
+ if (fStructureTypeSelections == null) {
+ loadStructureTypeSelections();
+ }
+ if (fStructureTypeIds == null) {
+ loadStructureTypeIds();
+ }
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java
index 0d801a2b0..470438bbe 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java
@@ -131,16 +131,16 @@ public class LogicalStructureType implements ILogicalStructureType {
return d2.getDescription(value);
}
if (!fVerifiedDescription) {
- fVerifiedDescription = true;
- try {
- verifyAttributeExists(IConfigurationElementConstants.DESCRIPTION);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
+ fVerifiedDescription = true;
+ try {
+ verifyAttributeExists(IConfigurationElementConstants.DESCRIPTION);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
}
String description = getDescription();
if (description == null) {
- return DebugCoreMessages.LogicalStructureType_0;
+ return DebugCoreMessages.LogicalStructureType_0;
}
return description;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java
index e787aab35..65d9d71aa 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java
@@ -87,7 +87,7 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi
for (int i= 0; i < copiedListeners.length; i++) {
fListener = (IMemoryBlockListener)copiedListeners[i];
fMemoryBlocks = memBlocks;
- SafeRunner.run(this);
+ SafeRunner.run(this);
}
}
fListener = null;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
index 5abe88d65..9a399e27d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java
@@ -21,41 +21,41 @@ import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.core.model.IStreamsProxy2;
public class NullStreamsProxy implements IStreamsProxy2 {
- private NullStreamMonitor outputStreamMonitor;
- private NullStreamMonitor errorStreamMonitor;
+ private NullStreamMonitor outputStreamMonitor;
+ private NullStreamMonitor errorStreamMonitor;
- public NullStreamsProxy(Process process) {
- outputStreamMonitor = new NullStreamMonitor(process.getInputStream());
- errorStreamMonitor = new NullStreamMonitor(process.getErrorStream());
- }
+ public NullStreamsProxy(Process process) {
+ outputStreamMonitor = new NullStreamMonitor(process.getInputStream());
+ errorStreamMonitor = new NullStreamMonitor(process.getErrorStream());
+ }
- @Override
+ @Override
public void closeInputStream() throws IOException {
- }
+ }
- @Override
+ @Override
public IStreamMonitor getErrorStreamMonitor() {
- return errorStreamMonitor;
- }
+ return errorStreamMonitor;
+ }
- @Override
+ @Override
public IStreamMonitor getOutputStreamMonitor() {
- return outputStreamMonitor;
- }
+ return outputStreamMonitor;
+ }
- @Override
+ @Override
public void write(String input) throws IOException {
- }
+ }
- private class NullStreamMonitor implements IStreamMonitor {
- private InputStream fStream;
+ private class NullStreamMonitor implements IStreamMonitor {
+ private InputStream fStream;
- public NullStreamMonitor(InputStream stream) {
- fStream = stream;
- startReaderThread();
- }
+ public NullStreamMonitor(InputStream stream) {
+ fStream = stream;
+ startReaderThread();
+ }
- private void startReaderThread() {
+ private void startReaderThread() {
Thread thread = new Thread((Runnable) () -> {
byte[] bytes = new byte[1024];
try {
@@ -65,22 +65,22 @@ public class NullStreamsProxy implements IStreamsProxy2 {
} catch (IOException e) {
}
}, DebugCoreMessages.NullStreamsProxy_0);
- thread.setDaemon(true);
- thread.start();
+ thread.setDaemon(true);
+ thread.start();
- }
+ }
- @Override
+ @Override
public void addListener(IStreamListener listener) {
- }
+ }
- @Override
+ @Override
public String getContents() {
- return ""; //$NON-NLS-1$
- }
+ return ""; //$NON-NLS-1$
+ }
- @Override
+ @Override
public void removeListener(IStreamListener listener) {
- }
- }
+ }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java
index f5c536ee1..c7dfd261b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java
@@ -52,7 +52,7 @@ public class PreferredDelegateModifyListener extends PreferenceModifyListener {
// force VMs to be initialized before we import the new VMs
node.accept(new Visitor());
} catch (BackingStoreException e) {
- DebugPlugin.log(e);
+ DebugPlugin.log(e);
}
return node;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java
index 9830a8179..5bb348746 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ResourceFactory.java
@@ -27,36 +27,36 @@ import org.eclipse.core.runtime.Path;
*/
public class ResourceFactory {
- // These persistence constants are stored in XML. Do not
- // change them.
- public static final String TAG_PATH = "path";//$NON-NLS-1$
+ // These persistence constants are stored in XML. Do not
+ // change them.
+ public static final String TAG_PATH = "path";//$NON-NLS-1$
- public static final String TAG_TYPE = "type";//$NON-NLS-1$
+ public static final String TAG_TYPE = "type";//$NON-NLS-1$
- /**
- * Creates and returns an element based on the given memento
- *
- * @param memento element memento
- * @return associated element
- */
- public static IAdaptable createElement(XMLMemento memento) {
- // Get the file name.
- String fileName = memento.getString(TAG_PATH);
- if (fileName == null) {
+ /**
+ * Creates and returns an element based on the given memento
+ *
+ * @param memento element memento
+ * @return associated element
+ */
+ public static IAdaptable createElement(XMLMemento memento) {
+ // Get the file name.
+ String fileName = memento.getString(TAG_PATH);
+ if (fileName == null) {
return null;
}
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- String type = memento.getString(TAG_TYPE);
- IResource res = null;
- if (type == null) {
- // Old format memento. Create an IResource using findMember.
- // Will return null for resources in closed projects.
- res = root.findMember(new Path(fileName));
- } else {
- int resourceType = Integer.parseInt(type);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ String type = memento.getString(TAG_TYPE);
+ IResource res = null;
+ if (type == null) {
+ // Old format memento. Create an IResource using findMember.
+ // Will return null for resources in closed projects.
+ res = root.findMember(new Path(fileName));
+ } else {
+ int resourceType = Integer.parseInt(type);
- if (resourceType == IResource.ROOT) {
+ if (resourceType == IResource.ROOT) {
res = root;
} else if (resourceType == IResource.PROJECT) {
res = root.getProject(fileName);
@@ -65,12 +65,12 @@ public class ResourceFactory {
} else if (resourceType == IResource.FILE) {
res = root.getFile(new Path(fileName));
}
- }
- return res;
- }
+ }
+ return res;
+ }
- public static void saveState(XMLMemento memento, IResource res) {
- memento.putString(TAG_PATH, res.getFullPath().toString());
- memento.putString(TAG_TYPE, Integer.toString(res.getType()));
- }
+ public static void saveState(XMLMemento memento, IResource res) {
+ memento.putString(TAG_PATH, res.getFullPath().toString());
+ memento.putString(TAG_TYPE, Integer.toString(res.getType()));
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
index c3fab169f..616e79674 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
@@ -86,11 +86,11 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 {
* @return Returns whether the stream proxy was already closed.
*/
private synchronized boolean isClosed(boolean setClosed) {
- boolean closed = fClosed;
- if (setClosed) {
- fClosed = true;
- }
- return closed;
+ boolean closed = fClosed;
+ if (setClosed) {
+ fClosed = true;
+ }
+ return closed;
}
/**
@@ -100,9 +100,9 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 {
* Data remaining in the streams is lost.
*/
public void kill() {
- synchronized (this) {
- fClosed= true;
- }
+ synchronized (this) {
+ fClosed= true;
+ }
fOutputMonitor.kill();
fErrorMonitor.kill();
fInputMonitor.close();
@@ -127,14 +127,14 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 {
}
}
- @Override
+ @Override
public void closeInputStream() throws IOException {
- if (!isClosed(false)) {
- fInputMonitor.closeInputStream();
- } else {
- throw new IOException();
- }
+ if (!isClosed(false)) {
+ fInputMonitor.closeInputStream();
+ } else {
+ throw new IOException();
+ }
- }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
index 3e66c8483..9a942eb6e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java
@@ -213,7 +213,7 @@ public class WatchExpression implements IWatchExpression {
public ILaunch getLaunch() {
IDebugTarget debugTarget = getDebugTarget();
if (debugTarget != null) {
- return debugTarget.getLaunch();
+ return debugTarget.getLaunch();
}
return null;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java
index c2c59ad0e..d8b6fe817 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java
@@ -39,227 +39,227 @@ import org.xml.sax.SAXException;
* An XML memento. Copied from workspace plug-in.
*/
public final class XMLMemento {
- private Document factory;
-
- private Element element;
-
- /**
- * Creates a <code>Document</code> from the <code>Reader</code>
- * and returns a memento on the first <code>Element</code> for reading
- * the document.
- * <p>
- * Same as calling createReadRoot(reader, null)
- * </p>
- *
- * @param reader the <code>Reader</code> used to create the memento's document
- * @return a memento on the first <code>Element</code> for reading the document
- * @throws Exception if IO problems, invalid format, or no element.
- */
- public static XMLMemento createReadRoot(Reader reader)
- throws Exception {
- return createReadRoot(reader, null);
- }
-
- /**
- * Creates a <code>Document</code> from the <code>Reader</code>
- * and returns a memento on the first <code>Element</code> for reading
- * the document.
- *
- * @param reader the <code>Reader</code> used to create the memento's document
- * @param baseDir the directory used to resolve relative file names
- * in the XML document. This directory must exist and include the
- * trailing separator. The directory format, including the separators,
- * must be valid for the platform. Can be <code>null</code> if not
- * needed.
- * @return a memento on the first <code>Element</code> for reading the document
- * @throws Exception if IO problems, invalid format, or no element.
- */
- public static XMLMemento createReadRoot(Reader reader, String baseDir)
- throws Exception {
- String errorMessage = null;
- Exception exception = null;
-
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory
- .newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- InputSource source = new InputSource(reader);
- if (baseDir != null) {
+ private Document factory;
+
+ private Element element;
+
+ /**
+ * Creates a <code>Document</code> from the <code>Reader</code>
+ * and returns a memento on the first <code>Element</code> for reading
+ * the document.
+ * <p>
+ * Same as calling createReadRoot(reader, null)
+ * </p>
+ *
+ * @param reader the <code>Reader</code> used to create the memento's document
+ * @return a memento on the first <code>Element</code> for reading the document
+ * @throws Exception if IO problems, invalid format, or no element.
+ */
+ public static XMLMemento createReadRoot(Reader reader)
+ throws Exception {
+ return createReadRoot(reader, null);
+ }
+
+ /**
+ * Creates a <code>Document</code> from the <code>Reader</code>
+ * and returns a memento on the first <code>Element</code> for reading
+ * the document.
+ *
+ * @param reader the <code>Reader</code> used to create the memento's document
+ * @param baseDir the directory used to resolve relative file names
+ * in the XML document. This directory must exist and include the
+ * trailing separator. The directory format, including the separators,
+ * must be valid for the platform. Can be <code>null</code> if not
+ * needed.
+ * @return a memento on the first <code>Element</code> for reading the document
+ * @throws Exception if IO problems, invalid format, or no element.
+ */
+ public static XMLMemento createReadRoot(Reader reader, String baseDir)
+ throws Exception {
+ String errorMessage = null;
+ Exception exception = null;
+
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder parser = factory.newDocumentBuilder();
+ InputSource source = new InputSource(reader);
+ if (baseDir != null) {
source.setSystemId(baseDir);
}
- Document document = parser.parse(source);
- NodeList list = document.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- if (node instanceof Element) {
+ Document document = parser.parse(source);
+ NodeList list = document.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ if (node instanceof Element) {
return new XMLMemento(document, (Element) node);
}
- }
- } catch (ParserConfigurationException e) {
- exception = e;
- // errorMessage = WorkbenchMessages.XMLMemento_parserConfigError;
- } catch (IOException e) {
- exception = e;
- // errorMessage = WorkbenchMessages.XMLMemento_ioError;
- } catch (SAXException e) {
- exception = e;
- // errorMessage = WorkbenchMessages.XMLMemento_formatError;
- }
-
- String problemText = null;
- if (exception != null) {
+ }
+ } catch (ParserConfigurationException e) {
+ exception = e;
+ // errorMessage = WorkbenchMessages.XMLMemento_parserConfigError;
+ } catch (IOException e) {
+ exception = e;
+ // errorMessage = WorkbenchMessages.XMLMemento_ioError;
+ } catch (SAXException e) {
+ exception = e;
+ // errorMessage = WorkbenchMessages.XMLMemento_formatError;
+ }
+
+ String problemText = null;
+ if (exception != null) {
problemText = exception.getMessage();
}
- if (problemText == null || problemText.length() == 0) {
+ if (problemText == null || problemText.length() == 0) {
problemText = errorMessage != null ? errorMessage
- :"ERROR"; //;WorkbenchMessages.XMLMemento_noElement; //$NON-NLS-1$
- }
- throw new Exception(problemText, exception);
- }
-
- /**
- * Returns a root memento for writing a document.
- *
- * @param type the element node type to create on the document
- * @return the root memento for writing a document
- */
- public static XMLMemento createWriteRoot(String type) {
- Document document;
- try {
- document = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder().newDocument();
- Element element = document.createElement(type);
- document.appendChild(element);
- return new XMLMemento(document, element);
- } catch (ParserConfigurationException e) {
+ :"ERROR"; //;WorkbenchMessages.XMLMemento_noElement; //$NON-NLS-1$
+ }
+ throw new Exception(problemText, exception);
+ }
+
+ /**
+ * Returns a root memento for writing a document.
+ *
+ * @param type the element node type to create on the document
+ * @return the root memento for writing a document
+ */
+ public static XMLMemento createWriteRoot(String type) {
+ Document document;
+ try {
+ document = DocumentBuilderFactory.newInstance()
+ .newDocumentBuilder().newDocument();
+ Element element = document.createElement(type);
+ document.appendChild(element);
+ return new XMLMemento(document, element);
+ } catch (ParserConfigurationException e) {
// throw new Error(e);
- throw new Error(e.getMessage());
- }
- }
-
- /**
- * Creates a memento for the specified document and element.
- * <p>
- * Clients should use <code>createReadRoot</code> and
- * <code>createWriteRoot</code> to create the initial
- * memento on a document.
- * </p>
- *
- * @param document the document for the memento
- * @param element the element node for the memento
- */
- public XMLMemento(Document document, Element element) {
- super();
- this.factory = document;
- this.element = element;
- }
+ throw new Error(e.getMessage());
+ }
+ }
+
+ /**
+ * Creates a memento for the specified document and element.
+ * <p>
+ * Clients should use <code>createReadRoot</code> and
+ * <code>createWriteRoot</code> to create the initial
+ * memento on a document.
+ * </p>
+ *
+ * @param document the document for the memento
+ * @param element the element node for the memento
+ */
+ public XMLMemento(Document document, Element element) {
+ super();
+ this.factory = document;
+ this.element = element;
+ }
/*
* Method declared in XMLMemento.
*/
- public XMLMemento createChild(String type) {
- Element child = factory.createElement(type);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
+ public XMLMemento createChild(String type) {
+ Element child = factory.createElement(type);
+ element.appendChild(child);
+ return new XMLMemento(factory, child);
+ }
/*
* Method declared in XMLMemento.
*/
- public XMLMemento createChild(String type, String id) {
- Element child = factory.createElement(type);
- child.setAttribute(IMementoConstants.TAG_ID, id == null ? "" : id); //$NON-NLS-1$
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
+ public XMLMemento createChild(String type, String id) {
+ Element child = factory.createElement(type);
+ child.setAttribute(IMementoConstants.TAG_ID, id == null ? "" : id); //$NON-NLS-1$
+ element.appendChild(child);
+ return new XMLMemento(factory, child);
+ }
/*
* Method declared in XMLMemento.
*/
- public XMLMemento copyChild(XMLMemento child) {
- Element childElement = child.element;
- Element newElement = (Element) factory.importNode(childElement, true);
- element.appendChild(newElement);
- return new XMLMemento(factory, newElement);
- }
+ public XMLMemento copyChild(XMLMemento child) {
+ Element childElement = child.element;
+ Element newElement = (Element) factory.importNode(childElement, true);
+ element.appendChild(newElement);
+ return new XMLMemento(factory, newElement);
+ }
/*
* Method declared in XMLMemento.
*/
- public XMLMemento getChild(String type) {
+ public XMLMemento getChild(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0) {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0) {
return null;
}
- // Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element1 = (Element) node;
- if (element1.getNodeName().equals(type)) {
+ // Find the first node which is a child of this node.
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Element) {
+ Element element1 = (Element) node;
+ if (element1.getNodeName().equals(type)) {
return new XMLMemento(factory, element1);
}
- }
- }
+ }
+ }
- // A child was not found.
- return null;
- }
+ // A child was not found.
+ return null;
+ }
/*
* Method declared in XMLMemento.
*/
- public XMLMemento[] getChildren(String type) {
+ public XMLMemento[] getChildren(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0) {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0) {
return new XMLMemento[0];
}
- // Extract each node with given type.
+ // Extract each node with given type.
ArrayList<Element> list = new ArrayList<>(size);
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element1 = (Element) node;
- if (element1.getNodeName().equals(type)) {
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Element) {
+ Element element1 = (Element) node;
+ if (element1.getNodeName().equals(type)) {
list.add(element1);
}
- }
- }
-
- // Create a memento for each node.
- size = list.size();
- XMLMemento[] results = new XMLMemento[size];
- for (int x = 0; x < size; x++) {
- results[x] = new XMLMemento(factory, list.get(x));
- }
- return results;
- }
+ }
+ }
+
+ // Create a memento for each node.
+ size = list.size();
+ XMLMemento[] results = new XMLMemento[size];
+ for (int x = 0; x < size; x++) {
+ results[x] = new XMLMemento(factory, list.get(x));
+ }
+ return results;
+ }
/*
* Method declared in XMLMemento.
*/
- public Float getFloat(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ public Float getFloat(String key) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
+ return null;
+ }
+ String strValue = attr.getValue();
+ try {
+ return Float.valueOf(strValue);
+ } catch (NumberFormatException e) {
+ DebugPlugin.logMessage("Memento problem - Invalid float for key: " //$NON-NLS-1$
+ + key + " value: " + strValue, e); //$NON-NLS-1$
return null;
}
- String strValue = attr.getValue();
- try {
- return Float.valueOf(strValue);
- } catch (NumberFormatException e) {
- DebugPlugin.logMessage("Memento problem - Invalid float for key: " //$NON-NLS-1$
- + key + " value: " + strValue, e); //$NON-NLS-1$
- return null;
- }
- }
+ }
public String getType() {
return element.getNodeName();
@@ -268,58 +268,58 @@ public final class XMLMemento {
/*
* Method declared in XMLMemento.
*/
- public String getID() {
- return element.getAttribute(IMementoConstants.TAG_ID);
- }
+ public String getID() {
+ return element.getAttribute(IMementoConstants.TAG_ID);
+ }
/*
* Method declared in XMLMemento.
*/
- public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ public Integer getInteger(String key) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
return null;
}
- String strValue = attr.getValue();
- try {
- return Integer.valueOf(strValue);
- } catch (NumberFormatException e) {
- DebugPlugin
- .logMessage("Memento problem - invalid integer for key: " + key //$NON-NLS-1$
- + " value: " + strValue, e); //$NON-NLS-1$
- return null;
- }
- }
+ String strValue = attr.getValue();
+ try {
+ return Integer.valueOf(strValue);
+ } catch (NumberFormatException e) {
+ DebugPlugin
+ .logMessage("Memento problem - invalid integer for key: " + key //$NON-NLS-1$
+ + " value: " + strValue, e); //$NON-NLS-1$
+ return null;
+ }
+ }
/*
* Method declared in XMLMemento.
*/
- public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ public String getString(String key) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
return null;
}
- return attr.getValue();
- }
+ return attr.getValue();
+ }
public Boolean getBoolean(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
return null;
}
- return Boolean.valueOf(attr.getValue());
+ return Boolean.valueOf(attr.getValue());
}
/*
* Method declared in XMLMemento.
*/
- public String getTextData() {
- Text textNode = getTextNode();
- if (textNode != null) {
- return textNode.getData();
- }
- return null;
- }
+ public String getTextData() {
+ Text textNode = getTextNode();
+ if (textNode != null) {
+ return textNode.getData();
+ }
+ return null;
+ }
public String[] getAttributeKeys() {
NamedNodeMap map = element.getAttributes();
@@ -332,92 +332,92 @@ public final class XMLMemento {
return attributes;
}
- /**
- * Returns the Text node of the memento. Each memento is allowed only
- * one Text node.
- *
- * @return the Text node of the memento, or <code>null</code> if
- * the memento has no Text node.
- */
- private Text getTextNode() {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0) {
+ /**
+ * Returns the Text node of the memento. Each memento is allowed only
+ * one Text node.
+ *
+ * @return the Text node of the memento, or <code>null</code> if
+ * the memento has no Text node.
+ */
+ private Text getTextNode() {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0) {
return null;
}
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Text) {
- return (Text) node;
- }
- }
- // a Text node was not found
- return null;
- }
-
- /**
- * Places the element's attributes into the document.
- * @param element1 the element
- * @param copyText true if the first text node should be copied
- */
- private void putElement(Element element1, boolean copyText) {
- NamedNodeMap nodeMap = element1.getAttributes();
- int size = nodeMap.getLength();
- for (int i = 0; i < size; i++) {
- Attr attr = (Attr) nodeMap.item(i);
- putString(attr.getName(), attr.getValue());
- }
-
- NodeList nodes = element1.getChildNodes();
- size = nodes.getLength();
- // Copy first text node (fixes bug 113659).
- // Note that text data will be added as the first child (see putTextData)
- boolean needToCopyText = copyText;
- for (int i = 0; i < size; i++) {
- Node node = nodes.item(i);
- if (node instanceof Element) {
- XMLMemento child = createChild(node.getNodeName());
- child.putElement((Element) node, true);
- } else if (node instanceof Text && needToCopyText) {
- putTextData(((Text) node).getData());
- needToCopyText = false;
- }
- }
- }
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Text) {
+ return (Text) node;
+ }
+ }
+ // a Text node was not found
+ return null;
+ }
+
+ /**
+ * Places the element's attributes into the document.
+ * @param element1 the element
+ * @param copyText true if the first text node should be copied
+ */
+ private void putElement(Element element1, boolean copyText) {
+ NamedNodeMap nodeMap = element1.getAttributes();
+ int size = nodeMap.getLength();
+ for (int i = 0; i < size; i++) {
+ Attr attr = (Attr) nodeMap.item(i);
+ putString(attr.getName(), attr.getValue());
+ }
+
+ NodeList nodes = element1.getChildNodes();
+ size = nodes.getLength();
+ // Copy first text node (fixes bug 113659).
+ // Note that text data will be added as the first child (see putTextData)
+ boolean needToCopyText = copyText;
+ for (int i = 0; i < size; i++) {
+ Node node = nodes.item(i);
+ if (node instanceof Element) {
+ XMLMemento child = createChild(node.getNodeName());
+ child.putElement((Element) node, true);
+ } else if (node instanceof Text && needToCopyText) {
+ putTextData(((Text) node).getData());
+ needToCopyText = false;
+ }
+ }
+ }
/*
* Method declared in XMLMemento.
*/
- public void putFloat(String key, float f) {
- element.setAttribute(key, String.valueOf(f));
- }
+ public void putFloat(String key, float f) {
+ element.setAttribute(key, String.valueOf(f));
+ }
/*
* Method declared in XMLMemento.
*/
- public void putInteger(String key, int n) {
- element.setAttribute(key, String.valueOf(n));
- }
+ public void putInteger(String key, int n) {
+ element.setAttribute(key, String.valueOf(n));
+ }
/*
* Method declared in XMLMemento.
*/
- public void putMemento(XMLMemento memento) {
- // Do not copy the element's top level text node (this would overwrite the existing text).
- // Text nodes of children are copied.
- putElement(memento.element, false);
- }
+ public void putMemento(XMLMemento memento) {
+ // Do not copy the element's top level text node (this would overwrite the existing text).
+ // Text nodes of children are copied.
+ putElement(memento.element, false);
+ }
/*
* Method declared in XMLMemento.
*/
- public void putString(String key, String value) {
- if (value == null) {
+ public void putString(String key, String value) {
+ if (value == null) {
return;
}
- element.setAttribute(key, value);
- }
+ element.setAttribute(key, value);
+ }
/**
* @param key the attribute key
@@ -431,162 +431,162 @@ public final class XMLMemento {
/*
* Method declared in XMLMemento.
*/
- public void putTextData(String data) {
- Text textNode = getTextNode();
- if (textNode == null) {
- textNode = factory.createTextNode(data);
+ public void putTextData(String data) {
+ Text textNode = getTextNode();
+ if (textNode == null) {
+ textNode = factory.createTextNode(data);
// Always add the text node as the first child (fixes bug 93718)
element.insertBefore(textNode, element.getFirstChild());
- } else {
- textNode.setData(data);
- }
- }
-
- /**
- * Saves this memento's document current values to the
- * specified writer.
- *
- * @param writer the writer used to save the memento's document
- * @throws IOException if there is a problem serializing the document to the stream.
- */
- public void save(Writer writer) throws IOException {
+ } else {
+ textNode.setData(data);
+ }
+ }
+
+ /**
+ * Saves this memento's document current values to the
+ * specified writer.
+ *
+ * @param writer the writer used to save the memento's document
+ * @throws IOException if there is a problem serializing the document to the stream.
+ */
+ public void save(Writer writer) throws IOException {
try (DOMWriter out = new DOMWriter(writer)) {
- out.print(element);
+ out.print(element);
}
}
/**
- * A simple XML writer. Using this instead of the javax.xml.transform classes allows
- * compilation against JCL Foundation (bug 80053).
- */
- private static final class DOMWriter extends PrintWriter {
+ * A simple XML writer. Using this instead of the javax.xml.transform classes allows
+ * compilation against JCL Foundation (bug 80053).
+ */
+ private static final class DOMWriter extends PrintWriter {
// private int tab;
- /* constants */
- private static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
+ /* constants */
+ private static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
- /**
- * Creates a new DOM writer on the given output writer.
- *
- * @param output the output writer
- */
- public DOMWriter(Writer output) {
- super(output);
+ /**
+ * Creates a new DOM writer on the given output writer.
+ *
+ * @param output the output writer
+ */
+ public DOMWriter(Writer output) {
+ super(output);
// tab = 0;
- println(XML_VERSION);
- }
-
- /**
- * Prints the given element.
- *
- * @param element the element to print
- */
- public void print(Element element) {
- // Ensure extra whitespace is not emitted next to a Text node,
- // as that will result in a situation where the restored text data is not the
- // same as the saved text data.
- boolean hasChildren = element.hasChildNodes();
- startTag(element, hasChildren);
- if (hasChildren) {
+ println(XML_VERSION);
+ }
+
+ /**
+ * Prints the given element.
+ *
+ * @param element the element to print
+ */
+ public void print(Element element) {
+ // Ensure extra whitespace is not emitted next to a Text node,
+ // as that will result in a situation where the restored text data is not the
+ // same as the saved text data.
+ boolean hasChildren = element.hasChildNodes();
+ startTag(element, hasChildren);
+ if (hasChildren) {
// tab++;
- boolean prevWasText = false;
- NodeList children = element.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node node = children.item(i);
- if (node instanceof Element) {
- if (!prevWasText) {
- println();
- printTabulation();
- }
- print((Element) children.item(i));
- prevWasText = false;
- }
- else if (node instanceof Text) {
- print(getEscaped(node.getNodeValue()));
- prevWasText = true;
- }
- }
+ boolean prevWasText = false;
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof Element) {
+ if (!prevWasText) {
+ println();
+ printTabulation();
+ }
+ print((Element) children.item(i));
+ prevWasText = false;
+ }
+ else if (node instanceof Text) {
+ print(getEscaped(node.getNodeValue()));
+ prevWasText = true;
+ }
+ }
// tab--;
- if (!prevWasText) {
- println();
- printTabulation();
- }
- endTag(element);
- }
- }
-
- private void printTabulation() {
- // Indenting is disabled, as it can affect the result of getTextData().
- // In 3.0, elements were separated by a newline but not indented.
- // This causes getTextData() to return "\n" even if no text data had explicitly been set.
- // The code here emulates that behaviour.
+ if (!prevWasText) {
+ println();
+ printTabulation();
+ }
+ endTag(element);
+ }
+ }
+
+ private void printTabulation() {
+ // Indenting is disabled, as it can affect the result of getTextData().
+ // In 3.0, elements were separated by a newline but not indented.
+ // This causes getTextData() to return "\n" even if no text data had explicitly been set.
+ // The code here emulates that behaviour.
// for (int i = 0; i < tab; i++)
// super.print("\t"); //$NON-NLS-1$
- }
-
- private void startTag(Element element, boolean hasChildren) {
- StringBuilder sb = new StringBuilder();
- sb.append("<"); //$NON-NLS-1$
- sb.append(element.getTagName());
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++) {
- Attr attribute = (Attr)attributes.item(i);
+ }
+
+ private void startTag(Element element, boolean hasChildren) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<"); //$NON-NLS-1$
+ sb.append(element.getTagName());
+ NamedNodeMap attributes = element.getAttributes();
+ for (int i = 0; i < attributes.getLength(); i++) {
+ Attr attribute = (Attr)attributes.item(i);
sb.append(" "); //$NON-NLS-1$
sb.append(attribute.getName());
sb.append("=\""); //$NON-NLS-1$
sb.append(getEscaped(String.valueOf(attribute.getValue())));
sb.append("\""); //$NON-NLS-1$
- }
- sb.append(hasChildren ? ">" : "/>"); //$NON-NLS-1$ //$NON-NLS-2$
- print(sb.toString());
- }
-
- private void endTag(Element element) {
- StringBuilder sb = new StringBuilder();
- sb.append("</"); //$NON-NLS-1$
- sb.append(element.getNodeName());
- sb.append(">"); //$NON-NLS-1$
- print(sb.toString());
- }
-
- private static void appendEscapedChar(StringBuilder buffer, char c) {
- String replacement = getReplacement(c);
- if (replacement != null) {
- buffer.append('&');
- buffer.append(replacement);
- buffer.append(';');
- } else if (c==9 || c==10 || c==13 || c>=32){
- buffer.append(c);
- }
- }
-
- private static String getEscaped(String s) {
- StringBuilder result = new StringBuilder(s.length() + 10);
- for (int i = 0; i < s.length(); ++i) {
+ }
+ sb.append(hasChildren ? ">" : "/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ print(sb.toString());
+ }
+
+ private void endTag(Element element) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("</"); //$NON-NLS-1$
+ sb.append(element.getNodeName());
+ sb.append(">"); //$NON-NLS-1$
+ print(sb.toString());
+ }
+
+ private static void appendEscapedChar(StringBuilder buffer, char c) {
+ String replacement = getReplacement(c);
+ if (replacement != null) {
+ buffer.append('&');
+ buffer.append(replacement);
+ buffer.append(';');
+ } else if (c==9 || c==10 || c==13 || c>=32){
+ buffer.append(c);
+ }
+ }
+
+ private static String getEscaped(String s) {
+ StringBuilder result = new StringBuilder(s.length() + 10);
+ for (int i = 0; i < s.length(); ++i) {
appendEscapedChar(result, s.charAt(i));
}
- return result.toString();
- }
+ return result.toString();
+ }
- private static String getReplacement(char c) {
- // Encode special XML characters into the equivalent character references.
+ private static String getReplacement(char c) {
+ // Encode special XML characters into the equivalent character references.
// The first five are defined by default for all XML documents.
// The next three (#xD, #xA, #x9) are encoded to avoid them
// being converted to spaces on deserialization
// (fixes bug 93720)
- switch (c) {
- case '<' :
- return "lt"; //$NON-NLS-1$
- case '>' :
- return "gt"; //$NON-NLS-1$
- case '"' :
- return "quot"; //$NON-NLS-1$
- case '\'' :
- return "apos"; //$NON-NLS-1$
- case '&' :
- return "amp"; //$NON-NLS-1$
+ switch (c) {
+ case '<' :
+ return "lt"; //$NON-NLS-1$
+ case '>' :
+ return "gt"; //$NON-NLS-1$
+ case '"' :
+ return "quot"; //$NON-NLS-1$
+ case '\'' :
+ return "apos"; //$NON-NLS-1$
+ case '&' :
+ return "amp"; //$NON-NLS-1$
case '\r':
return "#x0D"; //$NON-NLS-1$
case '\n':
@@ -595,8 +595,8 @@ public final class XMLMemento {
return "#x09"; //$NON-NLS-1$
default:
break;
- }
- return null;
- }
- }
+ }
+ return null;
+ }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java
index 1db82aa0a..7ac3e1cea 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java
@@ -48,10 +48,10 @@ public class StepFiltersCommand extends ForEachCommand implements IStepFiltersHa
}
return filters;
}
- return null;
+ return null;
}
- private IDebugTarget[] getDebugTargets(Object element) {
+ private IDebugTarget[] getDebugTargets(Object element) {
if (element instanceof IDebugElement) {
IDebugElement debugElement = (IDebugElement) element;
return new IDebugTarget[] { debugElement.getDebugTarget() };
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java
index e1d29bbb3..c20aad296 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/ProcessObserver.java
@@ -25,33 +25,33 @@ import org.eclipse.debug.core.model.IProcess;
* a {@linkplain CountDownLatch synchronization object} when the process terminates.
*/
public final class ProcessObserver implements Callable<Integer> {
- private final IProcess p;
- private final IProgressMonitor pMonitor;
- private final CountDownLatch countDownLatch;
+ private final IProcess p;
+ private final IProgressMonitor pMonitor;
+ private final CountDownLatch countDownLatch;
- public ProcessObserver(IProgressMonitor monitor, IProcess p, CountDownLatch countDownLatch) {
- this.p = p;
- this.pMonitor = monitor;
- this.countDownLatch = countDownLatch;
- }
+ public ProcessObserver(IProgressMonitor monitor, IProcess p, CountDownLatch countDownLatch) {
+ this.p = p;
+ this.pMonitor = monitor;
+ this.countDownLatch = countDownLatch;
+ }
- @Override
- public Integer call() throws Exception {
- try {
- while (!p.isTerminated() && !pMonitor.isCanceled()) {
- TimeUnit.MILLISECONDS.sleep(250);
+ @Override
+ public Integer call() throws Exception {
+ try {
+ while (!p.isTerminated() && !pMonitor.isCanceled()) {
+ TimeUnit.MILLISECONDS.sleep(250);
- if (countDownLatch.getCount() == 0) {
- break;
- }
- }
- // check if terminated or timeout
- if (p.isTerminated()) {
- return p.getExitValue();
- }
- return 0;
- } finally {
- countDownLatch.countDown();
- }
- }
+ if (countDownLatch.getCount() == 0) {
+ break;
+ }
+ }
+ // check if terminated or timeout
+ if (p.isTerminated()) {
+ return p.getExitValue();
+ }
+ return 0;
+ } finally {
+ countDownLatch.countDown();
+ }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java
index 9e1a227f0..f7c08c78c 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/observer/StreamObserver.java
@@ -29,48 +29,48 @@ import org.eclipse.debug.core.model.IStreamsProxy;
* output.
*/
public class StreamObserver implements Runnable {
- private final String stringPattern;
- private final IProcess process;
- private final CountDownLatch countDownLatch;
- private final IProgressMonitor pMonitor;
+ private final String stringPattern;
+ private final IProcess process;
+ private final CountDownLatch countDownLatch;
+ private final IProgressMonitor pMonitor;
- public StreamObserver(IProgressMonitor monitor, IProcess process, String pattern,
- CountDownLatch countDownLatch) {
- this.process = process;
- this.pMonitor = monitor;
- this.stringPattern = pattern;
- this.countDownLatch = countDownLatch;
- }
+ public StreamObserver(IProgressMonitor monitor, IProcess process, String pattern,
+ CountDownLatch countDownLatch) {
+ this.process = process;
+ this.pMonitor = monitor;
+ this.stringPattern = pattern;
+ this.countDownLatch = countDownLatch;
+ }
- @Override
- public void run() {
- // append wild card if not provided
- StringBuilder patternBuilder = new StringBuilder();
- if (!stringPattern.startsWith(".*")) { //$NON-NLS-1$
- patternBuilder.append(".*"); //$NON-NLS-1$
- }
- patternBuilder.append(stringPattern);
- if (!stringPattern.endsWith(".*")) { //$NON-NLS-1$
- patternBuilder.append(".*"); //$NON-NLS-1$
- }
- // create pattern and start listening to the output
- final Pattern pattern = Pattern.compile(patternBuilder.toString(), Pattern.MULTILINE);
- final IStreamMonitor outputStreamMonitor = process.getStreamsProxy()
- .getOutputStreamMonitor();
- outputStreamMonitor.addListener(new IStreamListener() {
- @Override
- public void streamAppended(String text, IStreamMonitor monitor) {
- if (countDownLatch.getCount() == 0) {
- outputStreamMonitor.removeListener(this);
- return;
- }
+ @Override
+ public void run() {
+ // append wild card if not provided
+ StringBuilder patternBuilder = new StringBuilder();
+ if (!stringPattern.startsWith(".*")) { //$NON-NLS-1$
+ patternBuilder.append(".*"); //$NON-NLS-1$
+ }
+ patternBuilder.append(stringPattern);
+ if (!stringPattern.endsWith(".*")) { //$NON-NLS-1$
+ patternBuilder.append(".*"); //$NON-NLS-1$
+ }
+ // create pattern and start listening to the output
+ final Pattern pattern = Pattern.compile(patternBuilder.toString(), Pattern.MULTILINE);
+ final IStreamMonitor outputStreamMonitor = process.getStreamsProxy()
+ .getOutputStreamMonitor();
+ outputStreamMonitor.addListener(new IStreamListener() {
+ @Override
+ public void streamAppended(String text, IStreamMonitor monitor) {
+ if (countDownLatch.getCount() == 0) {
+ outputStreamMonitor.removeListener(this);
+ return;
+ }
- Matcher matcher = pattern.matcher(text);
- if (!matcher.find() && !pMonitor.isCanceled()) {
- return;
- }
- countDownLatch.countDown();
- }
- });
- }
+ Matcher matcher = pattern.matcher(text);
+ if (!matcher.find() && !pMonitor.isCanceled()) {
+ return;
+ }
+ countDownLatch.countDown();
+ }
+ });
+ }
}
diff --git a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
index f0b3659b2..226aa6015 100644
--- a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
+++ b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
@@ -45,416 +45,416 @@ import java.util.regex.Pattern;
public class PDAVirtualMachine {
static class Stack extends LinkedList<Object> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- @Override
+ @Override
public Object pop() {
- return isEmpty() ? Integer.valueOf(0) : remove(size() - 1);
- }
+ return isEmpty() ? Integer.valueOf(0) : remove(size() - 1);
+ }
- @Override
+ @Override
public void push(Object value) {
- add(value);
- }
- }
-
- static class Register {
- Register(String name) {
- fName = name;
- }
- String fName;
- String fGroup = "<no_group>"; //$NON-NLS-1$
- boolean fIsWriteable = true;
+ add(value);
+ }
+ }
+
+ static class Register {
+ Register(String name) {
+ fName = name;
+ }
+ String fName;
+ String fGroup = "<no_group>"; //$NON-NLS-1$
+ boolean fIsWriteable = true;
Map<String, BitField> fBitFields = new LinkedHashMap<>(0);
- int fValue;
- }
-
- static class BitField {
- BitField(String name) {
- fName = name;
- }
- String fName;
- int fBitOffset;
- int fBitCount;
+ int fValue;
+ }
+
+ static class BitField {
+ BitField(String name) {
+ fName = name;
+ }
+ String fName;
+ int fBitOffset;
+ int fBitCount;
Map<String, Integer> fMnemonics = new LinkedHashMap<>(0);
- }
+ }
Map<String, Register> fRegisters = new LinkedHashMap<>(0);
- class Args {
- final String[] fArgs;
-
- int next = 0;
-
- Args(String[] args) {
- fArgs = args;
- }
-
- boolean hasNextArg() {
- return fArgs.length > next;
- }
-
- String getNextStringArg() {
- if (fArgs.length > next) {
- return fArgs[next++];
- }
- return ""; //$NON-NLS-1$
- }
-
- int getNextIntArg() {
- String arg = getNextStringArg();
- try {
- return Integer.parseInt(arg);
- } catch (NumberFormatException e) {
- }
- return 0;
- }
-
- boolean getNextBooleanArg() {
- String arg = getNextStringArg();
- try {
- return Boolean.getBoolean(arg);
- } catch (NumberFormatException e) {
- }
- return false;
- }
-
- Object getNextIntOrStringArg() {
- String arg = getNextStringArg();
- try {
- return Integer.valueOf(arg);
- } catch (NumberFormatException e) {
- }
- return arg;
- }
-
- PDAThread getThreadArg() {
- int id = getNextIntArg();
- return fThreads.get( Integer.valueOf(id) );
- }
- }
-
- class PDAThread {
- final int fID;
-
- /** The push down automata data stack (the data stack). */
- final Stack fStack = new Stack();
-
- /**
- * PDAThread copy of the code. It can differ from the program if
- * performing an evaluation.
- */
- String[] fThreadCode;
-
- /** PDAThread copy of the labels. */
+ class Args {
+ final String[] fArgs;
+
+ int next = 0;
+
+ Args(String[] args) {
+ fArgs = args;
+ }
+
+ boolean hasNextArg() {
+ return fArgs.length > next;
+ }
+
+ String getNextStringArg() {
+ if (fArgs.length > next) {
+ return fArgs[next++];
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ int getNextIntArg() {
+ String arg = getNextStringArg();
+ try {
+ return Integer.parseInt(arg);
+ } catch (NumberFormatException e) {
+ }
+ return 0;
+ }
+
+ boolean getNextBooleanArg() {
+ String arg = getNextStringArg();
+ try {
+ return Boolean.getBoolean(arg);
+ } catch (NumberFormatException e) {
+ }
+ return false;
+ }
+
+ Object getNextIntOrStringArg() {
+ String arg = getNextStringArg();
+ try {
+ return Integer.valueOf(arg);
+ } catch (NumberFormatException e) {
+ }
+ return arg;
+ }
+
+ PDAThread getThreadArg() {
+ int id = getNextIntArg();
+ return fThreads.get( Integer.valueOf(id) );
+ }
+ }
+
+ class PDAThread {
+ final int fID;
+
+ /** The push down automata data stack (the data stack). */
+ final Stack fStack = new Stack();
+
+ /**
+ * PDAThread copy of the code. It can differ from the program if
+ * performing an evaluation.
+ */
+ String[] fThreadCode;
+
+ /** PDAThread copy of the labels. */
Map<String, Integer> fThreadLabels;
- /** The stack of stack frames (the control stack) */
+ /** The stack of stack frames (the control stack) */
final List<Frame> fFrames = new LinkedList<>();
- /** Current stack frame (not includced in fFrames) */
- Frame fCurrentFrame;
+ /** Current stack frame (not includced in fFrames) */
+ Frame fCurrentFrame;
- /**
- * The run flag is true if the thread is running. If the run flag is
- * false, the thread exits the next time the main instruction loop runs.
- */
- boolean fRun = true;
+ /**
+ * The run flag is true if the thread is running. If the run flag is
+ * false, the thread exits the next time the main instruction loop runs.
+ */
+ boolean fRun = true;
- String fSuspend = null;
+ String fSuspend = null;
- boolean fStep = false;
+ boolean fStep = false;
- boolean fStepReturn = false;
+ boolean fStepReturn = false;
- int fSavedPC;
+ int fSavedPC;
- boolean fPerformingEval = false;
+ boolean fPerformingEval = false;
- PDAThread(int id, String function, int pc) {
- fID = id;
- fCurrentFrame = new Frame(function, pc);
- fThreadCode = fCode;
- fThreadLabels = fLabels;
- }
- }
+ PDAThread(int id, String function, int pc) {
+ fID = id;
+ fCurrentFrame = new Frame(function, pc);
+ fThreadCode = fCode;
+ fThreadLabels = fLabels;
+ }
+ }
final Map<Integer, PDAThread> fThreads = new LinkedHashMap<>();
- int fNextThreadId = 1;
+ int fNextThreadId = 1;
- boolean fStarted = true;
- /**
- * The code is stored as an array of strings, each line of the source file
- * being one entry in the array.
- */
- final String[] fCode;
+ boolean fStarted = true;
+ /**
+ * The code is stored as an array of strings, each line of the source file
+ * being one entry in the array.
+ */
+ final String[] fCode;
- /** A mapping of labels to indicies in the code array */
+ /** A mapping of labels to indicies in the code array */
final Map<String, Integer> fLabels;
- /** Each stack frame is a mapping of variable names to values. */
- class Frame {
+ /** Each stack frame is a mapping of variable names to values. */
+ class Frame {
final Map<String, Object> fLocalVariables = new LinkedHashMap<>();
- /**
- * The name of the function in this frame
- */
- final String fFunction;
-
- /**
- * The current program counter in the frame the pc points to the next
- * instruction to be executed
- */
- int fPC;
-
- Frame(String function, int pc) {
- fFunction = function;
- fPC = pc;
- }
-
- void set(String name, Object value) {
- if (name.startsWith("$")) { //$NON-NLS-1$
- setRegisterValue(name, value);
- } else {
- fLocalVariables.put(name, value);
- }
- }
-
- Object get(String name) {
- if (name.startsWith("$")) { //$NON-NLS-1$
- return getRegisterValue(name);
- } else {
- return fLocalVariables.get(name);
- }
- }
- }
-
- void setRegisterValue(String name, Object value) {
- Register reg = fRegisters.get(getRegisterPartOfName(name));
- if (reg == null) {
+ /**
+ * The name of the function in this frame
+ */
+ final String fFunction;
+
+ /**
+ * The current program counter in the frame the pc points to the next
+ * instruction to be executed
+ */
+ int fPC;
+
+ Frame(String function, int pc) {
+ fFunction = function;
+ fPC = pc;
+ }
+
+ void set(String name, Object value) {
+ if (name.startsWith("$")) { //$NON-NLS-1$
+ setRegisterValue(name, value);
+ } else {
+ fLocalVariables.put(name, value);
+ }
+ }
+
+ Object get(String name) {
+ if (name.startsWith("$")) { //$NON-NLS-1$
+ return getRegisterValue(name);
+ } else {
+ return fLocalVariables.get(name);
+ }
+ }
+ }
+
+ void setRegisterValue(String name, Object value) {
+ Register reg = fRegisters.get(getRegisterPartOfName(name));
+ if (reg == null) {
return;
}
- String bitFieldName = getBitFieldPartOfName(name);
- if (bitFieldName != null) {
- BitField bitField = reg.fBitFields.get(bitFieldName);
- if (bitField == null) {
+ String bitFieldName = getBitFieldPartOfName(name);
+ if (bitFieldName != null) {
+ BitField bitField = reg.fBitFields.get(bitFieldName);
+ if (bitField == null) {
return;
}
- Integer intValue = null;
- if (value instanceof Integer) {
- intValue = (Integer)value;
- } else if (value instanceof String) {
- intValue = bitField.fMnemonics.get(value);
- }
- if (intValue != null) {
- int bitFieldMask = 2^(bitField.fBitCount - 1);
- int registerMask = ~(bitFieldMask << bitField.fBitOffset);
- int bitFieldValue = intValue.intValue() & bitFieldMask;
- reg.fValue = (reg.fValue & registerMask) | (bitFieldValue << bitField.fBitOffset);
- }
- } else if (value instanceof Integer) {
- reg.fValue = ((Integer)value).intValue();
- }
- }
-
- Object getRegisterValue(String name) {
- Register reg = fRegisters.get(getRegisterPartOfName(name));
- if (reg == null) {
+ Integer intValue = null;
+ if (value instanceof Integer) {
+ intValue = (Integer)value;
+ } else if (value instanceof String) {
+ intValue = bitField.fMnemonics.get(value);
+ }
+ if (intValue != null) {
+ int bitFieldMask = 2^(bitField.fBitCount - 1);
+ int registerMask = ~(bitFieldMask << bitField.fBitOffset);
+ int bitFieldValue = intValue.intValue() & bitFieldMask;
+ reg.fValue = (reg.fValue & registerMask) | (bitFieldValue << bitField.fBitOffset);
+ }
+ } else if (value instanceof Integer) {
+ reg.fValue = ((Integer)value).intValue();
+ }
+ }
+
+ Object getRegisterValue(String name) {
+ Register reg = fRegisters.get(getRegisterPartOfName(name));
+ if (reg == null) {
return null;
}
- String bitFieldName = getBitFieldPartOfName(name);
- if (bitFieldName != null) {
- BitField bitField = reg.fBitFields.get(bitFieldName);
- if (bitField == null) {
+ String bitFieldName = getBitFieldPartOfName(name);
+ if (bitFieldName != null) {
+ BitField bitField = reg.fBitFields.get(bitFieldName);
+ if (bitField == null) {
return null;
}
- int bitFieldMask = 2^(bitField.fBitCount - 1);
- int registerMask = bitFieldMask << bitField.fBitOffset;
- return Integer.valueOf( (reg.fValue & registerMask) >> bitField.fBitOffset );
- } else {
- return Integer.valueOf(reg.fValue);
- }
- }
-
- /**
- * Breakpoints are stored per each each line of code. The boolean indicates
- * whether the whole VM should suspend or just the triggering thread.
- */
+ int bitFieldMask = 2^(bitField.fBitCount - 1);
+ int registerMask = bitFieldMask << bitField.fBitOffset;
+ return Integer.valueOf( (reg.fValue & registerMask) >> bitField.fBitOffset );
+ } else {
+ return Integer.valueOf(reg.fValue);
+ }
+ }
+
+ /**
+ * Breakpoints are stored per each each line of code. The boolean indicates
+ * whether the whole VM should suspend or just the triggering thread.
+ */
final Map<Integer, Boolean> fBreakpoints = new HashMap<>();
- /**
- * The suspend flag is true if the VM should suspend running the program and
- * just listen for debug commands.
- */
- String fSuspendVM;
+ /**
+ * The suspend flag is true if the VM should suspend running the program and
+ * just listen for debug commands.
+ */
+ String fSuspendVM;
- /** Flag indicating whether the debugger is performing a step. */
- boolean fStepVM = false;
+ /** Flag indicating whether the debugger is performing a step. */
+ boolean fStepVM = false;
- /** Flag indicating whether the debugger is performing a step return */
- boolean fStepReturnVM = false;
+ /** Flag indicating whether the debugger is performing a step return */
+ boolean fStepReturnVM = false;
- int fSteppingThread = 0;
+ int fSteppingThread = 0;
- /** Name of the pda program being debugged */
- final String fFilename;
+ /** Name of the pda program being debugged */
+ final String fFilename;
- /** The command line argument to start a debug session. */
- final boolean fDebug;
+ /** The command line argument to start a debug session. */
+ final boolean fDebug;
- /** The port to listen for debug commands on */
- final int fCommandPort;
+ /** The port to listen for debug commands on */
+ final int fCommandPort;
- /**
- * Command socket for receiving debug commands and sending command responses
- */
- Socket fCommandSocket;
+ /**
+ * Command socket for receiving debug commands and sending command responses
+ */
+ Socket fCommandSocket;
- /** Command socket reader */
- BufferedReader fCommandReceiveStream;
+ /** Command socket reader */
+ BufferedReader fCommandReceiveStream;
- /** Command socket write stream. */
- OutputStream fCommandResponseStream;
+ /** Command socket write stream. */
+ OutputStream fCommandResponseStream;
- /** The port to send debug events to */
- final int fEventPort;
+ /** The port to send debug events to */
+ final int fEventPort;
- /** Event socket */
- Socket fEventSocket;
+ /** Event socket */
+ Socket fEventSocket;
- /** Event socket and write stream. */
- OutputStream fEventStream;
+ /** Event socket and write stream. */
+ OutputStream fEventStream;
- /** The eventstops table holds which events cause suspends and which do not. */
+ /** The eventstops table holds which events cause suspends and which do not. */
final Map<String, Boolean> fEventStops = new HashMap<>();
- {
- fEventStops.put("unimpinstr", Boolean.FALSE); //$NON-NLS-1$
- fEventStops.put("nosuchlabel", Boolean.FALSE); //$NON-NLS-1$
- }
-
- /**
- * The watchpoints table holds watchpoint information.
- * <p/>
- * variablename_stackframedepth => N
- * <ul>
- * <li>N = 0 is no watch</li>
- * <li>N = 1 is read watch</li>
- * <li>N = 2 is write watch</li>
- * <li>N = 3 is both, etc.</li>
- */
+ {
+ fEventStops.put("unimpinstr", Boolean.FALSE); //$NON-NLS-1$
+ fEventStops.put("nosuchlabel", Boolean.FALSE); //$NON-NLS-1$
+ }
+
+ /**
+ * The watchpoints table holds watchpoint information.
+ * <p/>
+ * variablename_stackframedepth => N
+ * <ul>
+ * <li>N = 0 is no watch</li>
+ * <li>N = 1 is read watch</li>
+ * <li>N = 2 is write watch</li>
+ * <li>N = 3 is both, etc.</li>
+ */
final Map<String, Integer> fWatchpoints = new HashMap<>();
- public static void main(String[] args) {
- String programFile = args.length >= 1 ? args[0] : null;
- if (programFile == null) {
- System.err.println("Error: No program specified"); //$NON-NLS-1$
- return;
- }
-
- String debugFlag = args.length >= 2 ? args[1] : ""; //$NON-NLS-1$
- boolean debug = "-debug".equals(debugFlag); //$NON-NLS-1$
- int commandPort = 0;
- int eventPort = 0;
-
- if (debug) {
- String commandPortStr = args.length >= 3 ? args[2] : ""; //$NON-NLS-1$
- try {
- commandPort = Integer.parseInt(commandPortStr);
- } catch (NumberFormatException e) {
- System.err.println("Error: Invalid command port"); //$NON-NLS-1$
- return;
- }
-
- String eventPortStr = args.length >= 4 ? args[3] : ""; //$NON-NLS-1$
- try {
- eventPort = Integer.parseInt(eventPortStr);
- } catch (NumberFormatException e) {
- System.err.println("Error: Invalid event port"); //$NON-NLS-1$
- return;
- }
- }
-
- PDAVirtualMachine pdaVM = null;
- try {
- pdaVM = new PDAVirtualMachine(programFile, debug, commandPort, eventPort);
- pdaVM.startDebugger();
- } catch (IOException e) {
- System.err.println("Error: " + e.toString()); //$NON-NLS-1$
- return;
- }
- pdaVM.run();
- }
-
- PDAVirtualMachine(String inputFile, boolean debug, int commandPort, int eventPort) throws IOException {
- fFilename = inputFile;
-
- // Load all the code into memory
- StringWriter stringWriter = new StringWriter();
+ public static void main(String[] args) {
+ String programFile = args.length >= 1 ? args[0] : null;
+ if (programFile == null) {
+ System.err.println("Error: No program specified"); //$NON-NLS-1$
+ return;
+ }
+
+ String debugFlag = args.length >= 2 ? args[1] : ""; //$NON-NLS-1$
+ boolean debug = "-debug".equals(debugFlag); //$NON-NLS-1$
+ int commandPort = 0;
+ int eventPort = 0;
+
+ if (debug) {
+ String commandPortStr = args.length >= 3 ? args[2] : ""; //$NON-NLS-1$
+ try {
+ commandPort = Integer.parseInt(commandPortStr);
+ } catch (NumberFormatException e) {
+ System.err.println("Error: Invalid command port"); //$NON-NLS-1$
+ return;
+ }
+
+ String eventPortStr = args.length >= 4 ? args[3] : ""; //$NON-NLS-1$
+ try {
+ eventPort = Integer.parseInt(eventPortStr);
+ } catch (NumberFormatException e) {
+ System.err.println("Error: Invalid event port"); //$NON-NLS-1$
+ return;
+ }
+ }
+
+ PDAVirtualMachine pdaVM = null;
+ try {
+ pdaVM = new PDAVirtualMachine(programFile, debug, commandPort, eventPort);
+ pdaVM.startDebugger();
+ } catch (IOException e) {
+ System.err.println("Error: " + e.toString()); //$NON-NLS-1$
+ return;
+ }
+ pdaVM.run();
+ }
+
+ PDAVirtualMachine(String inputFile, boolean debug, int commandPort, int eventPort) throws IOException {
+ fFilename = inputFile;
+
+ // Load all the code into memory
+ StringWriter stringWriter = new StringWriter();
List<String> code = new LinkedList<>();
try (FileReader fileReader = new FileReader(inputFile)) {
- int c = fileReader.read();
- while (c != -1) {
- if (c == '\n') {
- code.add(stringWriter.toString().trim());
- stringWriter = new StringWriter();
- } else {
- stringWriter.write(c);
- }
- c = fileReader.read();
- }
- }
-
- code.add(stringWriter.toString().trim());
- fCode = code.toArray(new String[code.size()]);
-
- fLabels = mapLabels(fCode);
-
- fDebug = debug;
- fCommandPort = commandPort;
- fEventPort = eventPort;
- }
-
- /**
- * Initializes the labels map
- */
+ int c = fileReader.read();
+ while (c != -1) {
+ if (c == '\n') {
+ code.add(stringWriter.toString().trim());
+ stringWriter = new StringWriter();
+ } else {
+ stringWriter.write(c);
+ }
+ c = fileReader.read();
+ }
+ }
+
+ code.add(stringWriter.toString().trim());
+ fCode = code.toArray(new String[code.size()]);
+
+ fLabels = mapLabels(fCode);
+
+ fDebug = debug;
+ fCommandPort = commandPort;
+ fEventPort = eventPort;
+ }
+
+ /**
+ * Initializes the labels map
+ */
Map<String, Integer> mapLabels(String[] code) {
Map<String, Integer> labels = new HashMap<>();
- for (int i = 0; i < code.length; i++) {
- if (code[i].length() != 0 && code[i].charAt(0) == ':') {
- labels.put(code[i].substring(1), Integer.valueOf(i));
- }
- }
- return labels;
- }
-
- void sendCommandResponse(String response) {
- try {
- fCommandResponseStream.write(response.getBytes());
- fCommandResponseStream.flush();
- } catch (IOException e) {
- }
- }
-
- void sendDebugEvent(String event, boolean error) {
- if (fDebug) {
- try {
- fEventStream.write(event.getBytes());
- fEventStream.write('\n');
- fEventStream.flush();
- } catch (IOException e) {
- System.err.println("Error: " + e); //$NON-NLS-1$
- System.exit(1);
- }
- } else if (error) {
- System.err.println("Error: " + event); //$NON-NLS-1$
- }
- }
-
- void startDebugger() throws IOException {
- if (fDebug) {
- System.out.println("-debug " + fCommandPort + " " + fEventPort); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ for (int i = 0; i < code.length; i++) {
+ if (code[i].length() != 0 && code[i].charAt(0) == ':') {
+ labels.put(code[i].substring(1), Integer.valueOf(i));
+ }
+ }
+ return labels;
+ }
+
+ void sendCommandResponse(String response) {
+ try {
+ fCommandResponseStream.write(response.getBytes());
+ fCommandResponseStream.flush();
+ } catch (IOException e) {
+ }
+ }
+
+ void sendDebugEvent(String event, boolean error) {
+ if (fDebug) {
+ try {
+ fEventStream.write(event.getBytes());
+ fEventStream.write('\n');
+ fEventStream.flush();
+ } catch (IOException e) {
+ System.err.println("Error: " + e); //$NON-NLS-1$
+ System.exit(1);
+ }
+ } else if (error) {
+ System.err.println("Error: " + event); //$NON-NLS-1$
+ }
+ }
+
+ void startDebugger() throws IOException {
+ if (fDebug) {
+ System.out.println("-debug " + fCommandPort + " " + fEventPort); //$NON-NLS-1$ //$NON-NLS-2$
+ }
try (ServerSocket commandServerSocket = new ServerSocket(fCommandPort)) {
fCommandSocket = commandServerSocket.accept();
@@ -463,104 +463,104 @@ public class PDAVirtualMachine {
}
try (ServerSocket eventServerSocket = new ServerSocket(fEventPort)) {
- fEventSocket = eventServerSocket.accept();
- fEventStream = new PrintStream(fEventSocket.getOutputStream());
- }
-
- System.out.println("debug connection accepted"); //$NON-NLS-1$
-
- fSuspendVM = "client"; //$NON-NLS-1$
- }
-
- void run() {
- int id = fNextThreadId++;
- sendDebugEvent("vmstarted", false); //$NON-NLS-1$
- fThreads.put(Integer.valueOf(id), new PDAThread(id, "main", 0)); //$NON-NLS-1$
- if (fDebug) {
- sendDebugEvent("started " + id, false); //$NON-NLS-1$
- }
-
- boolean allThreadsSuspended = false;
- while (!fThreads.isEmpty()) {
- checkForBreakpoint();
-
- if (fSuspendVM != null) {
- debugUI();
- } else {
- yieldToDebug(allThreadsSuspended);
- if (fSuspendVM != null) {
- // Received a command to suspend VM, skip executing threads.
- continue;
- }
- }
-
- PDAThread[] threadsCopy = fThreads.values().toArray(new PDAThread[fThreads.size()]);
- allThreadsSuspended = true;
- for (int i = 0; i < threadsCopy.length; i++) {
- PDAThread thread = threadsCopy[i];
- if (thread.fSuspend == null) {
- allThreadsSuspended = false;
-
- String instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
- thread.fCurrentFrame.fPC++;
- doOneInstruction(thread, instruction);
- if (thread.fCurrentFrame.fPC >= thread.fThreadCode.length) {
- // Thread reached end of code, exit from the thread.
- thread.fRun = false;
- } else if (thread.fStepReturn) {
- // If this thread is in a step-return operation, check
- // if we've returned from a call.
- instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
- if ("return".equals(instruction)) { //$NON-NLS-1$
- // Note: this will only be triggered if the current
- // thread also has the fStepReturn flag set.
- if (fStepReturnVM) {
- fSuspendVM = thread.fID + " step"; //$NON-NLS-1$
- } else {
- thread.fSuspend = "step"; //$NON-NLS-1$
- }
- }
- }
- if (!thread.fRun) {
- sendDebugEvent("exited " + thread.fID, false); //$NON-NLS-1$
- fThreads.remove(Integer.valueOf(thread.fID));
- } else if (thread.fSuspend != null) {
- sendDebugEvent("suspended " + thread.fID + " " + thread.fSuspend, false); //$NON-NLS-1$ //$NON-NLS-2$
- thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
- }
- }
- }
-
- // Force thread context switch to avoid starving out other
- // processes in the system.
- Thread.yield();
- }
-
- sendDebugEvent("vmterminated", false); //$NON-NLS-1$
- if (fDebug) {
- try {
- fCommandReceiveStream.close();
- fCommandResponseStream.close();
- fCommandSocket.close();
- fEventStream.close();
- fEventSocket.close();
- } catch (IOException e) {
- System.out.println("Error: " + e); //$NON-NLS-1$
- }
- }
-
- }
-
- void doOneInstruction(PDAThread thread, String instr) {
- StringTokenizer tokenizer = new StringTokenizer(instr);
- String op = tokenizer.nextToken();
+ fEventSocket = eventServerSocket.accept();
+ fEventStream = new PrintStream(fEventSocket.getOutputStream());
+ }
+
+ System.out.println("debug connection accepted"); //$NON-NLS-1$
+
+ fSuspendVM = "client"; //$NON-NLS-1$
+ }
+
+ void run() {
+ int id = fNextThreadId++;
+ sendDebugEvent("vmstarted", false); //$NON-NLS-1$
+ fThreads.put(Integer.valueOf(id), new PDAThread(id, "main", 0)); //$NON-NLS-1$
+ if (fDebug) {
+ sendDebugEvent("started " + id, false); //$NON-NLS-1$
+ }
+
+ boolean allThreadsSuspended = false;
+ while (!fThreads.isEmpty()) {
+ checkForBreakpoint();
+
+ if (fSuspendVM != null) {
+ debugUI();
+ } else {
+ yieldToDebug(allThreadsSuspended);
+ if (fSuspendVM != null) {
+ // Received a command to suspend VM, skip executing threads.
+ continue;
+ }
+ }
+
+ PDAThread[] threadsCopy = fThreads.values().toArray(new PDAThread[fThreads.size()]);
+ allThreadsSuspended = true;
+ for (int i = 0; i < threadsCopy.length; i++) {
+ PDAThread thread = threadsCopy[i];
+ if (thread.fSuspend == null) {
+ allThreadsSuspended = false;
+
+ String instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
+ thread.fCurrentFrame.fPC++;
+ doOneInstruction(thread, instruction);
+ if (thread.fCurrentFrame.fPC >= thread.fThreadCode.length) {
+ // Thread reached end of code, exit from the thread.
+ thread.fRun = false;
+ } else if (thread.fStepReturn) {
+ // If this thread is in a step-return operation, check
+ // if we've returned from a call.
+ instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
+ if ("return".equals(instruction)) { //$NON-NLS-1$
+ // Note: this will only be triggered if the current
+ // thread also has the fStepReturn flag set.
+ if (fStepReturnVM) {
+ fSuspendVM = thread.fID + " step"; //$NON-NLS-1$
+ } else {
+ thread.fSuspend = "step"; //$NON-NLS-1$
+ }
+ }
+ }
+ if (!thread.fRun) {
+ sendDebugEvent("exited " + thread.fID, false); //$NON-NLS-1$
+ fThreads.remove(Integer.valueOf(thread.fID));
+ } else if (thread.fSuspend != null) {
+ sendDebugEvent("suspended " + thread.fID + " " + thread.fSuspend, false); //$NON-NLS-1$ //$NON-NLS-2$
+ thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
+ }
+ }
+ }
+
+ // Force thread context switch to avoid starving out other
+ // processes in the system.
+ Thread.yield();
+ }
+
+ sendDebugEvent("vmterminated", false); //$NON-NLS-1$
+ if (fDebug) {
+ try {
+ fCommandReceiveStream.close();
+ fCommandResponseStream.close();
+ fCommandSocket.close();
+ fEventStream.close();
+ fEventSocket.close();
+ } catch (IOException e) {
+ System.out.println("Error: " + e); //$NON-NLS-1$
+ }
+ }
+
+ }
+
+ void doOneInstruction(PDAThread thread, String instr) {
+ StringTokenizer tokenizer = new StringTokenizer(instr);
+ String op = tokenizer.nextToken();
List<String> tokens = new LinkedList<>();
- while (tokenizer.hasMoreTokens()) {
- tokens.add(tokenizer.nextToken());
- }
- Args args = new Args( tokens.toArray(new String[tokens.size()]) );
+ while (tokenizer.hasMoreTokens()) {
+ tokens.add(tokenizer.nextToken());
+ }
+ Args args = new Args( tokens.toArray(new String[tokens.size()]) );
- boolean opValid = true;
+ boolean opValid = true;
if (op.equals("add")) { //$NON-NLS-1$
iAdd(thread, args);
} else if (op.equals("branch_not_zero")) { //$NON-NLS-1$
@@ -590,122 +590,122 @@ public class PDAVirtualMachine {
} else if (op.equals("xyzzy")) { //$NON-NLS-1$
iInternalEndEval(thread, args);
} else if (op.startsWith(":")) {} // label //$NON-NLS-1$
- else if (op.startsWith("#")) {} // comment //$NON-NLS-1$
- else {
- opValid = false;
- }
-
- if (!opValid) {
- sendDebugEvent("unimplemented instruction " + op, true); //$NON-NLS-1$
- if ( fEventStops.get("unimpinstr").booleanValue() ) { //$NON-NLS-1$
- fSuspendVM = thread.fID + " event unimpinstr"; //$NON-NLS-1$
- thread.fCurrentFrame.fPC--;
- }
- } else if (thread.fStep) {
- if (fStepVM) {
- fSuspendVM = thread.fID + " step"; //$NON-NLS-1$
- fStepVM = false;
- } else {
- thread.fSuspend = "step"; //$NON-NLS-1$
- }
- thread.fStep = false;
- }
- }
-
- void checkForBreakpoint() {
- if (fDebug) {
+ else if (op.startsWith("#")) {} // comment //$NON-NLS-1$
+ else {
+ opValid = false;
+ }
+
+ if (!opValid) {
+ sendDebugEvent("unimplemented instruction " + op, true); //$NON-NLS-1$
+ if ( fEventStops.get("unimpinstr").booleanValue() ) { //$NON-NLS-1$
+ fSuspendVM = thread.fID + " event unimpinstr"; //$NON-NLS-1$
+ thread.fCurrentFrame.fPC--;
+ }
+ } else if (thread.fStep) {
+ if (fStepVM) {
+ fSuspendVM = thread.fID + " step"; //$NON-NLS-1$
+ fStepVM = false;
+ } else {
+ thread.fSuspend = "step"; //$NON-NLS-1$
+ }
+ thread.fStep = false;
+ }
+ }
+
+ void checkForBreakpoint() {
+ if (fDebug) {
for (Iterator<PDAThread> itr = fThreads.values().iterator(); itr.hasNext();) {
- PDAThread thread = itr.next();
- Integer pc = Integer.valueOf(thread.fCurrentFrame.fPC);
- // Suspend for breakpoint if:
- // - the VM is not yet set to suspend, for e.g. as a result of step end,
- // - the thread is not yet suspended and is not performing an evaluation
- // - the breakpoints table contains a breakpoint for the given line.
- if (fSuspendVM == null &&
- thread.fSuspend == null && !thread.fPerformingEval &&
- fBreakpoints.containsKey(pc))
- {
- if ( fBreakpoints.get(pc).booleanValue() ) {
- fSuspendVM = thread.fID + " breakpoint " + pc; //$NON-NLS-1$
- } else {
- thread.fSuspend = "breakpoint " + pc; //$NON-NLS-1$
- thread.fStep = thread.fStepReturn = false;
- sendDebugEvent("suspended " + thread.fID + " " + thread.fSuspend, false); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- }
- }
-
- /**
- * After each instruction, we check the debug command channel for control input. If
- * there are commands, process them.
- */
- void yieldToDebug(boolean allThreadsSuspended) {
- if (fDebug) {
- String line = ""; //$NON-NLS-1$
- try {
- if (allThreadsSuspended || fCommandReceiveStream.ready()) {
- line = fCommandReceiveStream.readLine();
- processDebugCommand(line);
- }
- } catch (IOException e) {
- System.err.println("Error: " + e); //$NON-NLS-1$
- System.exit(1);
- }
- }
- }
-
- /**
- * Service the debugger commands while the VM is suspended
- */
- void debugUI() {
- if (!fStarted) {
- sendDebugEvent("vmsuspended " + fSuspendVM, false); //$NON-NLS-1$
- } else {
- fStarted = false;
- }
-
- // Clear all stepping flags. In case the VM suspended while
- // a step operation was being performed for the VM or some thread.
- fStepVM = fStepReturnVM = false;
+ PDAThread thread = itr.next();
+ Integer pc = Integer.valueOf(thread.fCurrentFrame.fPC);
+ // Suspend for breakpoint if:
+ // - the VM is not yet set to suspend, for e.g. as a result of step end,
+ // - the thread is not yet suspended and is not performing an evaluation
+ // - the breakpoints table contains a breakpoint for the given line.
+ if (fSuspendVM == null &&
+ thread.fSuspend == null && !thread.fPerformingEval &&
+ fBreakpoints.containsKey(pc))
+ {
+ if ( fBreakpoints.get(pc).booleanValue() ) {
+ fSuspendVM = thread.fID + " breakpoint " + pc; //$NON-NLS-1$
+ } else {
+ thread.fSuspend = "breakpoint " + pc; //$NON-NLS-1$
+ thread.fStep = thread.fStepReturn = false;
+ sendDebugEvent("suspended " + thread.fID + " " + thread.fSuspend, false); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * After each instruction, we check the debug command channel for control input. If
+ * there are commands, process them.
+ */
+ void yieldToDebug(boolean allThreadsSuspended) {
+ if (fDebug) {
+ String line = ""; //$NON-NLS-1$
+ try {
+ if (allThreadsSuspended || fCommandReceiveStream.ready()) {
+ line = fCommandReceiveStream.readLine();
+ processDebugCommand(line);
+ }
+ } catch (IOException e) {
+ System.err.println("Error: " + e); //$NON-NLS-1$
+ System.exit(1);
+ }
+ }
+ }
+
+ /**
+ * Service the debugger commands while the VM is suspended
+ */
+ void debugUI() {
+ if (!fStarted) {
+ sendDebugEvent("vmsuspended " + fSuspendVM, false); //$NON-NLS-1$
+ } else {
+ fStarted = false;
+ }
+
+ // Clear all stepping flags. In case the VM suspended while
+ // a step operation was being performed for the VM or some thread.
+ fStepVM = fStepReturnVM = false;
for (Iterator<PDAThread> itr = fThreads.values().iterator(); itr.hasNext();) {
- PDAThread thread = itr.next();
- thread.fSuspend = null;
- thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
- }
-
- while (fSuspendVM != null) {
- String line = ""; //$NON-NLS-1$
- try {
- line = fCommandReceiveStream.readLine();
- } catch (IOException e) {
- System.err.println("Error: " + e); //$NON-NLS-1$
- System.exit(1);
- return;
- }
- processDebugCommand(line);
- }
-
- if (fStepVM || fStepReturnVM) {
- sendDebugEvent("vmresumed step", false); //$NON-NLS-1$
- } else {
- sendDebugEvent("vmresumed client", false); //$NON-NLS-1$
- }
- }
-
- void processDebugCommand(String line) {
- StringTokenizer tokenizer = new StringTokenizer(line.trim());
- if (line.length() == 0) {
- return;
- }
-
- String command = tokenizer.nextToken();
+ PDAThread thread = itr.next();
+ thread.fSuspend = null;
+ thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
+ }
+
+ while (fSuspendVM != null) {
+ String line = ""; //$NON-NLS-1$
+ try {
+ line = fCommandReceiveStream.readLine();
+ } catch (IOException e) {
+ System.err.println("Error: " + e); //$NON-NLS-1$
+ System.exit(1);
+ return;
+ }
+ processDebugCommand(line);
+ }
+
+ if (fStepVM || fStepReturnVM) {
+ sendDebugEvent("vmresumed step", false); //$NON-NLS-1$
+ } else {
+ sendDebugEvent("vmresumed client", false); //$NON-NLS-1$
+ }
+ }
+
+ void processDebugCommand(String line) {
+ StringTokenizer tokenizer = new StringTokenizer(line.trim());
+ if (line.length() == 0) {
+ return;
+ }
+
+ String command = tokenizer.nextToken();
List<String> tokens = new LinkedList<>();
- while (tokenizer.hasMoreTokens()) {
- tokens.add(tokenizer.nextToken());
- }
- Args args = new Args( tokens.toArray(new String[tokens.size()]));
+ while (tokenizer.hasMoreTokens()) {
+ tokens.add(tokenizer.nextToken());
+ }
+ Args args = new Args( tokens.toArray(new String[tokens.size()]));
if ("children".equals(command)) { //$NON-NLS-1$
debugChildren(args);
@@ -764,770 +764,770 @@ public class PDAVirtualMachine {
} else if ("watch".equals(command)) { //$NON-NLS-1$
debugWatch(args);
} else {
- sendCommandResponse("error: invalid command\n"); //$NON-NLS-1$
- }
- }
+ sendCommandResponse("error: invalid command\n"); //$NON-NLS-1$
+ }
+ }
- void debugChildren(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
+ void debugChildren(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
- int sfnumber = args.getNextIntArg();
- String var = args.getNextStringArg();
+ int sfnumber = args.getNextIntArg();
+ String var = args.getNextStringArg();
- Frame frame = sfnumber >= thread.fFrames.size()
- ? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
+ Frame frame = sfnumber >= thread.fFrames.size()
+ ? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
- String varDot = var + "."; //$NON-NLS-1$
+ String varDot = var + "."; //$NON-NLS-1$
List<String> children = new ArrayList<>();
for (Iterator<String> itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
- String localVar = itr.next();
- if (localVar.startsWith(varDot) && localVar.indexOf('.', varDot.length() + 1) == -1) {
- children.add(localVar);
- }
- }
+ String localVar = itr.next();
+ if (localVar.startsWith(varDot) && localVar.indexOf('.', varDot.length() + 1) == -1) {
+ children.add(localVar);
+ }
+ }
- StringBuilder result = new StringBuilder();
+ StringBuilder result = new StringBuilder();
for (Iterator<String> itr = children.iterator(); itr.hasNext();) {
- result.append(itr.next());
- result.append('|');
- }
- result.append('\n');
+ result.append(itr.next());
+ result.append('|');
+ }
+ result.append('\n');
- sendCommandResponse(result.toString());
- }
+ sendCommandResponse(result.toString());
+ }
- void debugClearBreakpoint(Args args) {
- int line = args.getNextIntArg();
+ void debugClearBreakpoint(Args args) {
+ int line = args.getNextIntArg();
- fBreakpoints.remove( Integer.valueOf(line) );
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
+ fBreakpoints.remove( Integer.valueOf(line) );
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
- private static Pattern fPackPattern = Pattern.compile("%([a-fA-F0-9][a-fA-F0-9])"); //$NON-NLS-1$
+ private static Pattern fPackPattern = Pattern.compile("%([a-fA-F0-9][a-fA-F0-9])"); //$NON-NLS-1$
- void debugData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
+ void debugData(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
- StringBuilder result = new StringBuilder();
+ StringBuilder result = new StringBuilder();
for (Iterator<?> itr = thread.fStack.iterator(); itr.hasNext();) {
- result.append(itr.next());
- result.append('|');
- }
- result.append('\n');
- sendCommandResponse(result.toString());
- }
-
- void debugDropFrame(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- if (!thread.fFrames.isEmpty()) {
- thread.fCurrentFrame = thread.fFrames.remove(thread.fFrames.size() - 1);
- }
- thread.fCurrentFrame.fPC--;
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- if (fSuspendVM != null) {
- sendDebugEvent("vmresumed drop", false); //$NON-NLS-1$
- sendDebugEvent("vmsuspended " + thread.fID + " drop", false); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- sendDebugEvent("resumed " + thread.fID + " drop", false); //$NON-NLS-1$ //$NON-NLS-2$
- sendDebugEvent("suspended " + thread.fID + " drop", false); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- void debugEval(Args args) {
- if (fSuspendVM != null) {
- sendCommandResponse("error: cannot evaluate while vm is suspended\n"); //$NON-NLS-1$
- return;
- }
-
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread running\n"); //$NON-NLS-1$
- return;
- }
-
- StringTokenizer tokenizer = new StringTokenizer(args.getNextStringArg(), "|"); //$NON-NLS-1$
- tokenizer.countTokens();
-
- int numEvalLines = tokenizer.countTokens();
- thread.fThreadCode = new String[fCode.length + numEvalLines + 1];
- System.arraycopy(fCode, 0, thread.fThreadCode, 0, fCode.length);
- for (int i = 0; i < numEvalLines; i++) {
- String line = tokenizer.nextToken();
- StringBuilder lineBuf = new StringBuilder(line.length());
- Matcher matcher = fPackPattern.matcher(line);
- int lastMatchEnd = 0;
- while (matcher.find()) {
- lineBuf.append(line.substring(lastMatchEnd, matcher.start()));
- String charCode = line.substring(matcher.start() + 1, matcher.start() + 3);
- try {
- lineBuf.append((char) Integer.parseInt(charCode, 16));
- } catch (NumberFormatException e) {
- }
- lastMatchEnd = matcher.end();
- }
- if (lastMatchEnd < line.length()) {
- lineBuf.append(line.substring(lastMatchEnd));
- }
- thread.fThreadCode[fCode.length + i] = lineBuf.toString();
- }
- thread.fThreadCode[fCode.length + numEvalLines] = "xyzzy"; //$NON-NLS-1$
- thread.fThreadLabels = mapLabels(fCode);
-
- thread.fSavedPC = thread.fCurrentFrame.fPC;
- thread.fCurrentFrame.fPC = fCode.length;
- thread.fPerformingEval = true;
-
- thread.fSuspend = null;
-
- sendCommandResponse("ok\n"); //$NON-NLS-1$
-
- sendDebugEvent("resumed " + thread.fID + " eval", false); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- void debugEventStop(Args args) {
- String event = args.getNextStringArg();
- int stop = args.getNextIntArg();
- fEventStops.put(event, Boolean.valueOf(stop > 0));
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugTerminate() {
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- sendDebugEvent("vmterminated", false); //$NON-NLS-1$
- System.exit(0);
- }
-
- void debugFrame(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- int sfnumber = args.getNextIntArg();
- Frame frame = null;
- if (sfnumber >= thread.fFrames.size()) {
- frame = thread.fCurrentFrame;
- } else {
- frame = thread.fFrames.get(sfnumber);
- }
- sendCommandResponse(printFrame(frame) + "\n"); //$NON-NLS-1$
- }
-
- /**
- * @param args
- */
- void debugGroups(Args args) {
+ result.append(itr.next());
+ result.append('|');
+ }
+ result.append('\n');
+ sendCommandResponse(result.toString());
+ }
+
+ void debugDropFrame(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ if (!thread.fFrames.isEmpty()) {
+ thread.fCurrentFrame = thread.fFrames.remove(thread.fFrames.size() - 1);
+ }
+ thread.fCurrentFrame.fPC--;
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ if (fSuspendVM != null) {
+ sendDebugEvent("vmresumed drop", false); //$NON-NLS-1$
+ sendDebugEvent("vmsuspended " + thread.fID + " drop", false); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ sendDebugEvent("resumed " + thread.fID + " drop", false); //$NON-NLS-1$ //$NON-NLS-2$
+ sendDebugEvent("suspended " + thread.fID + " drop", false); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ void debugEval(Args args) {
+ if (fSuspendVM != null) {
+ sendCommandResponse("error: cannot evaluate while vm is suspended\n"); //$NON-NLS-1$
+ return;
+ }
+
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ if (thread.fSuspend == null) {
+ sendCommandResponse("error: thread running\n"); //$NON-NLS-1$
+ return;
+ }
+
+ StringTokenizer tokenizer = new StringTokenizer(args.getNextStringArg(), "|"); //$NON-NLS-1$
+ tokenizer.countTokens();
+
+ int numEvalLines = tokenizer.countTokens();
+ thread.fThreadCode = new String[fCode.length + numEvalLines + 1];
+ System.arraycopy(fCode, 0, thread.fThreadCode, 0, fCode.length);
+ for (int i = 0; i < numEvalLines; i++) {
+ String line = tokenizer.nextToken();
+ StringBuilder lineBuf = new StringBuilder(line.length());
+ Matcher matcher = fPackPattern.matcher(line);
+ int lastMatchEnd = 0;
+ while (matcher.find()) {
+ lineBuf.append(line.substring(lastMatchEnd, matcher.start()));
+ String charCode = line.substring(matcher.start() + 1, matcher.start() + 3);
+ try {
+ lineBuf.append((char) Integer.parseInt(charCode, 16));
+ } catch (NumberFormatException e) {
+ }
+ lastMatchEnd = matcher.end();
+ }
+ if (lastMatchEnd < line.length()) {
+ lineBuf.append(line.substring(lastMatchEnd));
+ }
+ thread.fThreadCode[fCode.length + i] = lineBuf.toString();
+ }
+ thread.fThreadCode[fCode.length + numEvalLines] = "xyzzy"; //$NON-NLS-1$
+ thread.fThreadLabels = mapLabels(fCode);
+
+ thread.fSavedPC = thread.fCurrentFrame.fPC;
+ thread.fCurrentFrame.fPC = fCode.length;
+ thread.fPerformingEval = true;
+
+ thread.fSuspend = null;
+
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+
+ sendDebugEvent("resumed " + thread.fID + " eval", false); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ void debugEventStop(Args args) {
+ String event = args.getNextStringArg();
+ int stop = args.getNextIntArg();
+ fEventStops.put(event, Boolean.valueOf(stop > 0));
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugTerminate() {
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ sendDebugEvent("vmterminated", false); //$NON-NLS-1$
+ System.exit(0);
+ }
+
+ void debugFrame(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ int sfnumber = args.getNextIntArg();
+ Frame frame = null;
+ if (sfnumber >= thread.fFrames.size()) {
+ frame = thread.fCurrentFrame;
+ } else {
+ frame = thread.fFrames.get(sfnumber);
+ }
+ sendCommandResponse(printFrame(frame) + "\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * @param args
+ */
+ void debugGroups(Args args) {
TreeSet<String> groups = new TreeSet<>();
for (Iterator<Register> itr = fRegisters.values().iterator(); itr.hasNext();) {
- Register reg = itr.next();
- groups.add(reg.fGroup);
- }
- StringBuilder response = new StringBuilder();
+ Register reg = itr.next();
+ groups.add(reg.fGroup);
+ }
+ StringBuilder response = new StringBuilder();
for (Iterator<String> itr = groups.iterator(); itr.hasNext();) {
- response.append(itr.next());
- response.append('|');
- }
- response.append('\n');
- sendCommandResponse(response.toString());
- }
-
- void debugPopData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- thread.fStack.pop();
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugPushData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- Object val = args.getNextIntOrStringArg();
- thread.fStack.push(val);
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugRegisters(Args args) {
- String group = args.getNextStringArg();
-
- StringBuilder response = new StringBuilder();
+ response.append(itr.next());
+ response.append('|');
+ }
+ response.append('\n');
+ sendCommandResponse(response.toString());
+ }
+
+ void debugPopData(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ thread.fStack.pop();
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugPushData(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ Object val = args.getNextIntOrStringArg();
+ thread.fStack.push(val);
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugRegisters(Args args) {
+ String group = args.getNextStringArg();
+
+ StringBuilder response = new StringBuilder();
for (Iterator<Register> itr = fRegisters.values().iterator(); itr.hasNext();) {
- Register reg = itr.next();
- if (group.equals(reg.fGroup)) {
- response.append(reg.fName);
- response.append(' ');
- response.append(reg.fIsWriteable);
+ Register reg = itr.next();
+ if (group.equals(reg.fGroup)) {
+ response.append(reg.fName);
+ response.append(' ');
+ response.append(reg.fIsWriteable);
for (Iterator<BitField> itr2 = reg.fBitFields.values().iterator(); itr2.hasNext();) {
- BitField bitField = itr2.next();
- response.append('|');
- response.append(bitField.fName);
- response.append(' ');
- response.append(bitField.fBitOffset);
- response.append(' ');
- response.append(bitField.fBitCount);
- response.append(' ');
+ BitField bitField = itr2.next();
+ response.append('|');
+ response.append(bitField.fName);
+ response.append(' ');
+ response.append(bitField.fBitOffset);
+ response.append(' ');
+ response.append(bitField.fBitCount);
+ response.append(' ');
for (Iterator<Entry<String, Integer>> itr3 = bitField.fMnemonics.entrySet().iterator(); itr3.hasNext();) {
Entry<String, Integer> mnemonicEntry = itr3.next();
- response.append(mnemonicEntry.getKey());
- response.append(' ');
- response.append(mnemonicEntry.getValue());
- response.append(' ');
- }
- }
-
- response.append('#');
- }
- }
- response.append('\n');
- sendCommandResponse(response.toString());
- }
-
- /**
- * @param args
- */
- void debugRestart(Args args) {
- fSuspendVM = "restart"; //$NON-NLS-1$
+ response.append(mnemonicEntry.getKey());
+ response.append(' ');
+ response.append(mnemonicEntry.getValue());
+ response.append(' ');
+ }
+ }
+
+ response.append('#');
+ }
+ }
+ response.append('\n');
+ sendCommandResponse(response.toString());
+ }
+
+ /**
+ * @param args
+ */
+ void debugRestart(Args args) {
+ fSuspendVM = "restart"; //$NON-NLS-1$
for (Iterator<Integer> itr = fThreads.keySet().iterator(); itr.hasNext();) {
- Integer id = itr.next();
- sendDebugEvent("exited " + id, false); //$NON-NLS-1$
- }
- fThreads.clear();
-
- int id = fNextThreadId++;
- fThreads.put(Integer.valueOf(id), new PDAThread(id, "main", 0)); //$NON-NLS-1$
- sendDebugEvent("started " + id, false); //$NON-NLS-1$
-
- fRegisters.clear();
-
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugResume(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
- if (fSuspendVM != null) {
- sendCommandResponse("error: cannot resume thread when vm is suspended\n"); //$NON-NLS-1$
- return;
- }
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread already running\n"); //$NON-NLS-1$
- return;
- }
-
- thread.fSuspend = null;
- sendDebugEvent("resumed " + thread.fID + " client", false); //$NON-NLS-1$ //$NON-NLS-2$
-
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugSetBreakpoint(Args args) {
- int line = args.getNextIntArg();
- int stopVM = args.getNextIntArg();
-
- fBreakpoints.put(Integer.valueOf(line), Boolean.valueOf(stopVM != 0));
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugSetData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- int offset = args.getNextIntArg();
- Object val = args.getNextIntOrStringArg();
-
- if (offset < thread.fStack.size()) {
- thread.fStack.set(offset, val);
- } else {
- thread.fStack.add(0, val);
- }
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugSetVariable(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- int sfnumber = args.getNextIntArg();
- String var = args.getNextStringArg();
- Object val = args.getNextIntOrStringArg();
- while (args.hasNextArg()) {
- val = val.toString() + " " + args.getNextStringArg(); //$NON-NLS-1$
- }
-
- if (sfnumber >= thread.fFrames.size()) {
- thread.fCurrentFrame.set(var, val);
- } else {
- thread.fFrames.get(sfnumber).set(var, val);
- }
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugStack(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- StringBuilder result = new StringBuilder();
+ Integer id = itr.next();
+ sendDebugEvent("exited " + id, false); //$NON-NLS-1$
+ }
+ fThreads.clear();
+
+ int id = fNextThreadId++;
+ fThreads.put(Integer.valueOf(id), new PDAThread(id, "main", 0)); //$NON-NLS-1$
+ sendDebugEvent("started " + id, false); //$NON-NLS-1$
+
+ fRegisters.clear();
+
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugResume(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+ if (fSuspendVM != null) {
+ sendCommandResponse("error: cannot resume thread when vm is suspended\n"); //$NON-NLS-1$
+ return;
+ }
+ if (thread.fSuspend == null) {
+ sendCommandResponse("error: thread already running\n"); //$NON-NLS-1$
+ return;
+ }
+
+ thread.fSuspend = null;
+ sendDebugEvent("resumed " + thread.fID + " client", false); //$NON-NLS-1$ //$NON-NLS-2$
+
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugSetBreakpoint(Args args) {
+ int line = args.getNextIntArg();
+ int stopVM = args.getNextIntArg();
+
+ fBreakpoints.put(Integer.valueOf(line), Boolean.valueOf(stopVM != 0));
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugSetData(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ int offset = args.getNextIntArg();
+ Object val = args.getNextIntOrStringArg();
+
+ if (offset < thread.fStack.size()) {
+ thread.fStack.set(offset, val);
+ } else {
+ thread.fStack.add(0, val);
+ }
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugSetVariable(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ int sfnumber = args.getNextIntArg();
+ String var = args.getNextStringArg();
+ Object val = args.getNextIntOrStringArg();
+ while (args.hasNextArg()) {
+ val = val.toString() + " " + args.getNextStringArg(); //$NON-NLS-1$
+ }
+
+ if (sfnumber >= thread.fFrames.size()) {
+ thread.fCurrentFrame.set(var, val);
+ } else {
+ thread.fFrames.get(sfnumber).set(var, val);
+ }
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugStack(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ StringBuilder result = new StringBuilder();
for (Iterator<Frame> itr = thread.fFrames.iterator(); itr.hasNext();) {
- Frame frame = itr.next();
- result.append(printFrame(frame));
- result.append('#');
- }
- result.append(printFrame(thread.fCurrentFrame));
- result.append('\n');
- sendCommandResponse(result.toString());
- }
-
- void debugStackDepth(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
- sendCommandResponse( Integer.toString(thread.fFrames.size() + 1) + "\n" ); //$NON-NLS-1$
- }
-
-
- /**
- * The stack frame output is: frame # frame # frame ... where each frame is:
- * filename | line number | function name | var | var | var | var ...
- */
- private String printFrame(Frame frame) {
- StringBuilder buf = new StringBuilder();
- buf.append(fFilename);
- buf.append('|');
- buf.append(frame.fPC);
- buf.append('|');
- buf.append(frame.fFunction);
+ Frame frame = itr.next();
+ result.append(printFrame(frame));
+ result.append('#');
+ }
+ result.append(printFrame(thread.fCurrentFrame));
+ result.append('\n');
+ sendCommandResponse(result.toString());
+ }
+
+ void debugStackDepth(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+ sendCommandResponse( Integer.toString(thread.fFrames.size() + 1) + "\n" ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * The stack frame output is: frame # frame # frame ... where each frame is:
+ * filename | line number | function name | var | var | var | var ...
+ */
+ private String printFrame(Frame frame) {
+ StringBuilder buf = new StringBuilder();
+ buf.append(fFilename);
+ buf.append('|');
+ buf.append(frame.fPC);
+ buf.append('|');
+ buf.append(frame.fFunction);
for (Iterator<String> itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
- String var = itr.next();
- if (var.indexOf('.') == -1) {
- buf.append('|');
- buf.append(var);
- }
- }
- return buf.toString();
- }
-
- void debugState(Args args) {
- PDAThread thread = args.getThreadArg();
- String response = null;
- if (thread == null) {
- response = fSuspendVM == null ? "running" : fSuspendVM; //$NON-NLS-1$
- } else if (fSuspendVM != null) {
- response = "vm"; //$NON-NLS-1$
- } else {
- response = thread.fSuspend == null ? "running" : thread.fSuspend; //$NON-NLS-1$
- }
- sendCommandResponse(response + "\n"); //$NON-NLS-1$
- }
-
- void debugStep(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- // Set suspend to null to allow the debug loop to exit back to the
- // instruction loop and thus run an instruction. However, we want to
- // come back to the debug loop right away, so the step flag is set to
- // true which will cause the suspend flag to get set to true when we
- // get to the next instruction.
- if (fSuspendVM != null) {
- // All threads are suspended, so suspend all threads again when
- // step completes.
- fSuspendVM = null;
- fStepVM = true;
- // Also mark the thread that initiated the step to mark it as
- // the triggering thread when suspending.
- thread.fStep = true;
- } else {
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread already running\n"); //$NON-NLS-1$
- return;
- }
- thread.fSuspend = null;
- thread.fStep = true;
- sendDebugEvent("resumed " + thread.fID + " step", false); //$NON-NLS-1$ //$NON-NLS-2$
- }
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugStepReturn(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- if (fSuspendVM != null) {
- fSuspendVM = null;
- fStepReturnVM = true;
- thread.fStepReturn = true;
- } else {
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread running\n"); //$NON-NLS-1$
- return;
- }
- thread.fSuspend = null;
- thread.fStepReturn = true;
- sendDebugEvent("resumed " + thread.fID + " step", false); //$NON-NLS-1$ //$NON-NLS-2$
- }
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugSuspend(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
- if (fSuspendVM != null) {
- sendCommandResponse("error: vm already suspended\n"); //$NON-NLS-1$
- return;
- }
- if (thread.fSuspend != null) {
- sendCommandResponse("error: thread already suspended\n"); //$NON-NLS-1$
- return;
- }
-
- thread.fSuspend = "client"; //$NON-NLS-1$
- sendDebugEvent("suspended " + thread.fID + " client", false); //$NON-NLS-1$ //$NON-NLS-2$
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugThreads() {
- StringBuilder response = new StringBuilder();
+ String var = itr.next();
+ if (var.indexOf('.') == -1) {
+ buf.append('|');
+ buf.append(var);
+ }
+ }
+ return buf.toString();
+ }
+
+ void debugState(Args args) {
+ PDAThread thread = args.getThreadArg();
+ String response = null;
+ if (thread == null) {
+ response = fSuspendVM == null ? "running" : fSuspendVM; //$NON-NLS-1$
+ } else if (fSuspendVM != null) {
+ response = "vm"; //$NON-NLS-1$
+ } else {
+ response = thread.fSuspend == null ? "running" : thread.fSuspend; //$NON-NLS-1$
+ }
+ sendCommandResponse(response + "\n"); //$NON-NLS-1$
+ }
+
+ void debugStep(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ // Set suspend to null to allow the debug loop to exit back to the
+ // instruction loop and thus run an instruction. However, we want to
+ // come back to the debug loop right away, so the step flag is set to
+ // true which will cause the suspend flag to get set to true when we
+ // get to the next instruction.
+ if (fSuspendVM != null) {
+ // All threads are suspended, so suspend all threads again when
+ // step completes.
+ fSuspendVM = null;
+ fStepVM = true;
+ // Also mark the thread that initiated the step to mark it as
+ // the triggering thread when suspending.
+ thread.fStep = true;
+ } else {
+ if (thread.fSuspend == null) {
+ sendCommandResponse("error: thread already running\n"); //$NON-NLS-1$
+ return;
+ }
+ thread.fSuspend = null;
+ thread.fStep = true;
+ sendDebugEvent("resumed " + thread.fID + " step", false); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugStepReturn(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ if (fSuspendVM != null) {
+ fSuspendVM = null;
+ fStepReturnVM = true;
+ thread.fStepReturn = true;
+ } else {
+ if (thread.fSuspend == null) {
+ sendCommandResponse("error: thread running\n"); //$NON-NLS-1$
+ return;
+ }
+ thread.fSuspend = null;
+ thread.fStepReturn = true;
+ sendDebugEvent("resumed " + thread.fID + " step", false); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugSuspend(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+ if (fSuspendVM != null) {
+ sendCommandResponse("error: vm already suspended\n"); //$NON-NLS-1$
+ return;
+ }
+ if (thread.fSuspend != null) {
+ sendCommandResponse("error: thread already suspended\n"); //$NON-NLS-1$
+ return;
+ }
+
+ thread.fSuspend = "client"; //$NON-NLS-1$
+ sendDebugEvent("suspended " + thread.fID + " client", false); //$NON-NLS-1$ //$NON-NLS-2$
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugThreads() {
+ StringBuilder response = new StringBuilder();
for (Iterator<Integer> itr = fThreads.keySet().iterator(); itr.hasNext();) {
- response.append(itr.next());
- response.append(' ');
- }
- sendCommandResponse(response.toString().trim() + "\n"); //$NON-NLS-1$
- }
-
- void debugVar(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
- return;
- }
-
- int sfnumber = args.getNextIntArg();
- String var = args.getNextStringArg();
-
- Frame frame = sfnumber >= thread.fFrames.size()
- ? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
-
- Object val = frame.get(var);
- if (val == null) {
- sendCommandResponse("error: variable undefined\n"); //$NON-NLS-1$
- } else {
- sendCommandResponse(val.toString() + "\n"); //$NON-NLS-1$
- }
- }
-
- void debugVMResume() {
- if (fSuspendVM == null) {
- sendCommandResponse("error: vm already running\n"); //$NON-NLS-1$
- return;
- }
-
- fSuspendVM = null;
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugVMSuspend() {
- if (fSuspendVM != null) {
- sendCommandResponse("error: vm already suspended\n"); //$NON-NLS-1$
- return;
- }
-
- fSuspendVM = "client"; //$NON-NLS-1$
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- void debugWatch(Args args) {
- String funcAndVar = args.getNextStringArg();
- int flags = args.getNextIntArg();
- fWatchpoints.put(funcAndVar, Integer.valueOf(flags));
- sendCommandResponse("ok\n"); //$NON-NLS-1$
- }
-
- /**
- * @param thread
- * @param args
- */
- void iAdd(PDAThread thread, Args args) {
- Object val1 = thread.fStack.pop();
- Object val2 = thread.fStack.pop();
- if (val1 instanceof Integer && val2 instanceof Integer) {
- int intVal1 = ((Integer) val1).intValue();
- int intVal2 = ((Integer) val2).intValue();
- thread.fStack.push( Integer.valueOf(intVal1 + intVal2) );
- } else {
- thread.fStack.push( Integer.valueOf(-1) );
- }
- }
-
- void iBranchNotZero(PDAThread thread, Args args) {
- Object val = thread.fStack.pop();
- if (val instanceof Integer && ((Integer) val).intValue() != 0) {
- String label = args.getNextStringArg();
- if (thread.fThreadLabels.containsKey(label)) {
- thread.fCurrentFrame.fPC = thread.fThreadLabels.get(label).intValue();
- } else {
- sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
- if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
- fSuspendVM = thread.fID + " event nosuchlabel"; //$NON-NLS-1$
- thread.fStack.push(val);
- thread.fCurrentFrame.fPC--;
- }
- }
- }
- }
-
- void iCall(PDAThread thread, Args args) {
- String label = args.getNextStringArg();
- if (thread.fThreadLabels.containsKey(label)) {
- thread.fFrames.add(thread.fCurrentFrame);
- thread.fCurrentFrame = new Frame(label, thread.fThreadLabels.get(label).intValue());
- } else {
- sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
- if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
- fSuspendVM = thread.fID + " event nosuchlabel"; //$NON-NLS-1$
- thread.fCurrentFrame.fPC--;
- }
- }
- }
-
- /**
- * @param thread
- * @param args
- */
- void iDec(PDAThread thread, Args args) {
- Object val = thread.fStack.pop();
- if (val instanceof Integer) {
- val = Integer.valueOf(((Integer) val).intValue() - 1);
- }
- thread.fStack.push(val);
- }
-
- /**
- * @param thread
- * @param args
- */
- void iDef(PDAThread thread, Args args) {
- String type = args.getNextStringArg();
-
- String name = args.getNextStringArg();
- String regName = getRegisterPartOfName(name);
- String bitFieldName = getBitFieldPartOfName(name);
-
- if ("register".equals(type)) { //$NON-NLS-1$
- Register reg = new Register(regName);
- reg.fGroup = args.getNextStringArg();
- fRegisters.put(regName, reg);
- reg.fIsWriteable = args.getNextBooleanArg();
- } else if ("bitfield".equals(type)) { //$NON-NLS-1$
- Register reg = fRegisters.get(regName);
- if (reg == null) {
+ response.append(itr.next());
+ response.append(' ');
+ }
+ sendCommandResponse(response.toString().trim() + "\n"); //$NON-NLS-1$
+ }
+
+ void debugVar(Args args) {
+ PDAThread thread = args.getThreadArg();
+ if (thread == null) {
+ sendCommandResponse("error: invalid thread\n"); //$NON-NLS-1$
+ return;
+ }
+
+ int sfnumber = args.getNextIntArg();
+ String var = args.getNextStringArg();
+
+ Frame frame = sfnumber >= thread.fFrames.size()
+ ? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
+
+ Object val = frame.get(var);
+ if (val == null) {
+ sendCommandResponse("error: variable undefined\n"); //$NON-NLS-1$
+ } else {
+ sendCommandResponse(val.toString() + "\n"); //$NON-NLS-1$
+ }
+ }
+
+ void debugVMResume() {
+ if (fSuspendVM == null) {
+ sendCommandResponse("error: vm already running\n"); //$NON-NLS-1$
+ return;
+ }
+
+ fSuspendVM = null;
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugVMSuspend() {
+ if (fSuspendVM != null) {
+ sendCommandResponse("error: vm already suspended\n"); //$NON-NLS-1$
+ return;
+ }
+
+ fSuspendVM = "client"; //$NON-NLS-1$
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ void debugWatch(Args args) {
+ String funcAndVar = args.getNextStringArg();
+ int flags = args.getNextIntArg();
+ fWatchpoints.put(funcAndVar, Integer.valueOf(flags));
+ sendCommandResponse("ok\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iAdd(PDAThread thread, Args args) {
+ Object val1 = thread.fStack.pop();
+ Object val2 = thread.fStack.pop();
+ if (val1 instanceof Integer && val2 instanceof Integer) {
+ int intVal1 = ((Integer) val1).intValue();
+ int intVal2 = ((Integer) val2).intValue();
+ thread.fStack.push( Integer.valueOf(intVal1 + intVal2) );
+ } else {
+ thread.fStack.push( Integer.valueOf(-1) );
+ }
+ }
+
+ void iBranchNotZero(PDAThread thread, Args args) {
+ Object val = thread.fStack.pop();
+ if (val instanceof Integer && ((Integer) val).intValue() != 0) {
+ String label = args.getNextStringArg();
+ if (thread.fThreadLabels.containsKey(label)) {
+ thread.fCurrentFrame.fPC = thread.fThreadLabels.get(label).intValue();
+ } else {
+ sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
+ if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
+ fSuspendVM = thread.fID + " event nosuchlabel"; //$NON-NLS-1$
+ thread.fStack.push(val);
+ thread.fCurrentFrame.fPC--;
+ }
+ }
+ }
+ }
+
+ void iCall(PDAThread thread, Args args) {
+ String label = args.getNextStringArg();
+ if (thread.fThreadLabels.containsKey(label)) {
+ thread.fFrames.add(thread.fCurrentFrame);
+ thread.fCurrentFrame = new Frame(label, thread.fThreadLabels.get(label).intValue());
+ } else {
+ sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
+ if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
+ fSuspendVM = thread.fID + " event nosuchlabel"; //$NON-NLS-1$
+ thread.fCurrentFrame.fPC--;
+ }
+ }
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iDec(PDAThread thread, Args args) {
+ Object val = thread.fStack.pop();
+ if (val instanceof Integer) {
+ val = Integer.valueOf(((Integer) val).intValue() - 1);
+ }
+ thread.fStack.push(val);
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iDef(PDAThread thread, Args args) {
+ String type = args.getNextStringArg();
+
+ String name = args.getNextStringArg();
+ String regName = getRegisterPartOfName(name);
+ String bitFieldName = getBitFieldPartOfName(name);
+
+ if ("register".equals(type)) { //$NON-NLS-1$
+ Register reg = new Register(regName);
+ reg.fGroup = args.getNextStringArg();
+ fRegisters.put(regName, reg);
+ reg.fIsWriteable = args.getNextBooleanArg();
+ } else if ("bitfield".equals(type)) { //$NON-NLS-1$
+ Register reg = fRegisters.get(regName);
+ if (reg == null) {
return;
}
- BitField bitField = new BitField(bitFieldName);
- bitField.fBitOffset = args.getNextIntArg();
- bitField.fBitCount = args.getNextIntArg();
- reg.fBitFields.put(bitFieldName, bitField);
- } else if ("mnemonic".equals(type)) { //$NON-NLS-1$
- Register reg = fRegisters.get(regName);
- if (reg == null) {
+ BitField bitField = new BitField(bitFieldName);
+ bitField.fBitOffset = args.getNextIntArg();
+ bitField.fBitCount = args.getNextIntArg();
+ reg.fBitFields.put(bitFieldName, bitField);
+ } else if ("mnemonic".equals(type)) { //$NON-NLS-1$
+ Register reg = fRegisters.get(regName);
+ if (reg == null) {
return;
}
- BitField bitField = reg.fBitFields.get(bitFieldName);
- if (bitField == null) {
+ BitField bitField = reg.fBitFields.get(bitFieldName);
+ if (bitField == null) {
return;
}
- bitField.fMnemonics.put(args.getNextStringArg(), Integer.valueOf(args.getNextIntArg()));
- }
- sendDebugEvent("registers", false); //$NON-NLS-1$
- }
-
- private String getRegisterPartOfName(String name) {
- if (name.startsWith("$")) { //$NON-NLS-1$
- int end = name.indexOf('.');
- end = end != -1 ? end : name.length();
- return name.substring(1, end);
- }
- return null;
- }
-
- private String getBitFieldPartOfName(String name) {
- int start = name.indexOf('.');
- if (name.startsWith("$") && start != -1) { //$NON-NLS-1$
- return name.substring(start + 1, name.length());
- }
- return null;
- }
-
- /**
- * @param thread
- * @param args
- */
- void iDup(PDAThread thread, Args args) {
- Object val = thread.fStack.pop();
- thread.fStack.push(val);
- thread.fStack.push(val);
- }
-
- void iExec(PDAThread thread, Args args) {
- String label = args.getNextStringArg();
- if (fLabels.containsKey(label)) {
- int id = fNextThreadId++;
- fThreads.put( Integer.valueOf(id), new PDAThread(id, label, fLabels.get(label).intValue()) );
- sendDebugEvent("started " + id, false); //$NON-NLS-1$
- } else {
- sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
- if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
- thread.fSuspend = "event nosuchlabel"; //$NON-NLS-1$
- thread.fCurrentFrame.fPC--;
- }
- }
- }
-
- /**
- * @param thread
- * @param args
- */
- void iHalt(PDAThread thread, Args args) {
- thread.fRun = false;
- }
-
- /**
- * @param thread
- * @param args
- */
- void iOutput(PDAThread thread, Args args) {
- System.out.println(thread.fStack.pop());
- }
-
- void iPop(PDAThread thread, Args args) {
- String arg = args.getNextStringArg();
- if (arg.startsWith("$")) { //$NON-NLS-1$
- String var = arg.substring(1);
- thread.fCurrentFrame.set(var, thread.fStack.pop());
- String key = thread.fCurrentFrame.fFunction + "::" + var; //$NON-NLS-1$
- if ( fWatchpoints.containsKey(key) && (fWatchpoints.get(key).intValue() & 2) != 0 ) {
- fSuspendVM = thread.fID + " watch write " + key; //$NON-NLS-1$
- }
- } else {
- thread.fStack.pop();
- }
- }
-
- void iPush(PDAThread thread, Args args) {
- String arg = args.getNextStringArg();
- while (arg.length() != 0) {
- if (arg.startsWith("$")) { //$NON-NLS-1$
- String var = arg.substring(1);
- Object val = thread.fCurrentFrame.get(var);
- if (val == null)
+ bitField.fMnemonics.put(args.getNextStringArg(), Integer.valueOf(args.getNextIntArg()));
+ }
+ sendDebugEvent("registers", false); //$NON-NLS-1$
+ }
+
+ private String getRegisterPartOfName(String name) {
+ if (name.startsWith("$")) { //$NON-NLS-1$
+ int end = name.indexOf('.');
+ end = end != -1 ? end : name.length();
+ return name.substring(1, end);
+ }
+ return null;
+ }
+
+ private String getBitFieldPartOfName(String name) {
+ int start = name.indexOf('.');
+ if (name.startsWith("$") && start != -1) { //$NON-NLS-1$
+ return name.substring(start + 1, name.length());
+ }
+ return null;
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iDup(PDAThread thread, Args args) {
+ Object val = thread.fStack.pop();
+ thread.fStack.push(val);
+ thread.fStack.push(val);
+ }
+
+ void iExec(PDAThread thread, Args args) {
+ String label = args.getNextStringArg();
+ if (fLabels.containsKey(label)) {
+ int id = fNextThreadId++;
+ fThreads.put( Integer.valueOf(id), new PDAThread(id, label, fLabels.get(label).intValue()) );
+ sendDebugEvent("started " + id, false); //$NON-NLS-1$
+ } else {
+ sendDebugEvent("no such label " + label, true); //$NON-NLS-1$
+ if ( fEventStops.get("nosuchlabel").booleanValue() ) { //$NON-NLS-1$
+ thread.fSuspend = "event nosuchlabel"; //$NON-NLS-1$
+ thread.fCurrentFrame.fPC--;
+ }
+ }
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iHalt(PDAThread thread, Args args) {
+ thread.fRun = false;
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iOutput(PDAThread thread, Args args) {
+ System.out.println(thread.fStack.pop());
+ }
+
+ void iPop(PDAThread thread, Args args) {
+ String arg = args.getNextStringArg();
+ if (arg.startsWith("$")) { //$NON-NLS-1$
+ String var = arg.substring(1);
+ thread.fCurrentFrame.set(var, thread.fStack.pop());
+ String key = thread.fCurrentFrame.fFunction + "::" + var; //$NON-NLS-1$
+ if ( fWatchpoints.containsKey(key) && (fWatchpoints.get(key).intValue() & 2) != 0 ) {
+ fSuspendVM = thread.fID + " watch write " + key; //$NON-NLS-1$
+ }
+ } else {
+ thread.fStack.pop();
+ }
+ }
+
+ void iPush(PDAThread thread, Args args) {
+ String arg = args.getNextStringArg();
+ while (arg.length() != 0) {
+ if (arg.startsWith("$")) { //$NON-NLS-1$
+ String var = arg.substring(1);
+ Object val = thread.fCurrentFrame.get(var);
+ if (val == null)
{
val = "<undefined>"; //$NON-NLS-1$
}
- thread.fStack.push(val);
- String key = thread.fCurrentFrame.fFunction + "::" + var; //$NON-NLS-1$
- if (fWatchpoints.containsKey(key) && (fWatchpoints.get(key).intValue() & 1) != 0) {
- fSuspendVM = thread.fID + " watch read " + key; //$NON-NLS-1$
- }
- } else {
- Object val = arg;
- if (args.hasNextArg()) {
- while (args.hasNextArg()) {
- val = val.toString() + " " + args.getNextStringArg(); //$NON-NLS-1$
- }
- } else {
- try {
- val = Integer.valueOf(arg);
- } catch (NumberFormatException e) {
- }
- }
- thread.fStack.push(val);
- }
-
- arg = args.getNextStringArg();
- }
- }
-
- /**
- * @param thread
- * @param args
- */
- void iReturn(PDAThread thread, Args args) {
- if (!thread.fFrames.isEmpty()) {
- thread.fCurrentFrame = thread.fFrames.remove(thread.fFrames.size() - 1);
- } else {
- // Execution returned from the top frame, which means this thread
- // should exit.
- thread.fRun = false;
- }
- }
-
- void iVar(PDAThread thread, Args args) {
- String var = args.getNextStringArg();
- thread.fCurrentFrame.set(var, Integer.valueOf(0));
- }
-
- /**
- * @param thread
- * @param args
- */
- void iInternalEndEval(PDAThread thread, Args args) {
- Object result = thread.fStack.pop();
- thread.fThreadCode = fCode;
- thread.fThreadLabels = fLabels;
- thread.fCurrentFrame.fPC = thread.fSavedPC;
- sendDebugEvent("evalresult " + result, false); //$NON-NLS-1$
- thread.fSuspend = "eval"; //$NON-NLS-1$
- thread.fPerformingEval = false;
- }
+ thread.fStack.push(val);
+ String key = thread.fCurrentFrame.fFunction + "::" + var; //$NON-NLS-1$
+ if (fWatchpoints.containsKey(key) && (fWatchpoints.get(key).intValue() & 1) != 0) {
+ fSuspendVM = thread.fID + " watch read " + key; //$NON-NLS-1$
+ }
+ } else {
+ Object val = arg;
+ if (args.hasNextArg()) {
+ while (args.hasNextArg()) {
+ val = val.toString() + " " + args.getNextStringArg(); //$NON-NLS-1$
+ }
+ } else {
+ try {
+ val = Integer.valueOf(arg);
+ } catch (NumberFormatException e) {
+ }
+ }
+ thread.fStack.push(val);
+ }
+
+ arg = args.getNextStringArg();
+ }
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iReturn(PDAThread thread, Args args) {
+ if (!thread.fFrames.isEmpty()) {
+ thread.fCurrentFrame = thread.fFrames.remove(thread.fFrames.size() - 1);
+ } else {
+ // Execution returned from the top frame, which means this thread
+ // should exit.
+ thread.fRun = false;
+ }
+ }
+
+ void iVar(PDAThread thread, Args args) {
+ String var = args.getNextStringArg();
+ thread.fCurrentFrame.set(var, Integer.valueOf(0));
+ }
+
+ /**
+ * @param thread
+ * @param args
+ */
+ void iInternalEndEval(PDAThread thread, Args args) {
+ Object result = thread.fStack.pop();
+ thread.fThreadCode = fCode;
+ thread.fThreadLabels = fLabels;
+ thread.fCurrentFrame.fPC = thread.fSavedPC;
+ sendDebugEvent("evalresult " + result, false); //$NON-NLS-1$
+ thread.fSuspend = "eval"; //$NON-NLS-1$
+ thread.fPerformingEval = false;
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java
index 2469f6fdb..c1a21a99b 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java
@@ -90,85 +90,85 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen
return false;
}
- /**
- * Installs this breakpoint in the given interprettor.
- * Registeres this breakpoint as an event listener in the
- * given target and creates the breakpoint specific request.
- *
- * @param target PDA interprettor
- * @throws CoreException if installation fails
- */
- public void install(PDADebugTarget target) throws CoreException {
- fTarget = target;
- target.addEventListener(this);
- createRequest(target);
- }
-
- /**
- * Create the breakpoint specific request in the target. Subclasses
- * should override.
- *
- * @param target PDA interprettor
- * @throws CoreException if request creation fails
- */
- protected void createRequest(PDADebugTarget target) throws CoreException {
+ /**
+ * Installs this breakpoint in the given interprettor.
+ * Registeres this breakpoint as an event listener in the
+ * given target and creates the breakpoint specific request.
+ *
+ * @param target PDA interprettor
+ * @throws CoreException if installation fails
+ */
+ public void install(PDADebugTarget target) throws CoreException {
+ fTarget = target;
+ target.addEventListener(this);
+ createRequest(target);
+ }
+
+ /**
+ * Create the breakpoint specific request in the target. Subclasses
+ * should override.
+ *
+ * @param target PDA interprettor
+ * @throws CoreException if request creation fails
+ */
+ protected void createRequest(PDADebugTarget target) throws CoreException {
//#ifdef ex3
//# // TODO: Exercise 3 - create breakpoint request in interpreter
//#else
- target.sendCommand(new PDASetBreakpointCommand((getLineNumber() - 1), false));
+ target.sendCommand(new PDASetBreakpointCommand((getLineNumber() - 1), false));
//#endif
- }
-
- /**
- * Removes this breakpoint's event request from the target. Subclasses
- * should override.
- *
- * @param target PDA interprettor
- * @throws CoreException if clearing the request fails
- */
- protected void clearRequest(PDADebugTarget target) throws CoreException {
+ }
+
+ /**
+ * Removes this breakpoint's event request from the target. Subclasses
+ * should override.
+ *
+ * @param target PDA interprettor
+ * @throws CoreException if clearing the request fails
+ */
+ protected void clearRequest(PDADebugTarget target) throws CoreException {
//#ifdef ex3
//# // TODO: Exercise 3 - clear breakpoint request in interpreter
//#else
- target.sendCommand(new PDAClearBreakpointCommand((getLineNumber() - 1)));
+ target.sendCommand(new PDAClearBreakpointCommand((getLineNumber() - 1)));
//#endif
- }
-
- /**
- * Removes this breakpoint from the given interprettor.
- * Removes this breakpoint as an event listener and clears
- * the request for the interprettor.
- *
- * @param target PDA interprettor
- * @throws CoreException if removal fails
- */
- public void remove(PDADebugTarget target) throws CoreException {
- target.removeEventListener(this);
- clearRequest(target);
- fTarget = null;
-
- }
-
- /**
- * Returns the target this breakpoint is installed in or <code>null</code>.
- *
- * @return the target this breakpoint is installed in or <code>null</code>
- */
- protected PDADebugTarget getDebugTarget() {
- return fTarget;
- }
-
- /**
- * Notify's the PDA interprettor that this breakpoint has been hit.
- */
- protected void notifyThread(int threadId) {
- if (fTarget != null) {
+ }
+
+ /**
+ * Removes this breakpoint from the given interprettor.
+ * Removes this breakpoint as an event listener and clears
+ * the request for the interprettor.
+ *
+ * @param target PDA interprettor
+ * @throws CoreException if removal fails
+ */
+ public void remove(PDADebugTarget target) throws CoreException {
+ target.removeEventListener(this);
+ clearRequest(target);
+ fTarget = null;
+
+ }
+
+ /**
+ * Returns the target this breakpoint is installed in or <code>null</code>.
+ *
+ * @return the target this breakpoint is installed in or <code>null</code>
+ */
+ protected PDADebugTarget getDebugTarget() {
+ return fTarget;
+ }
+
+ /**
+ * Notify's the PDA interprettor that this breakpoint has been hit.
+ */
+ protected void notifyThread(int threadId) {
+ if (fTarget != null) {
PDAThread thread = fTarget.getThread(threadId);
if (thread != null) {
- thread.suspendedBy(this);
- }
- }
- }
+ thread.suspendedBy(this);
+ }
+ }
+ }
/*
* Subclasses should override to handle their breakpoint specific event.
@@ -176,31 +176,31 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen
@Override
public void handleEvent(PDAEvent event) {
if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
- PDARunControlEvent rcEvent = (PDARunControlEvent)event;
- if (rcEvent.fReason.equals("breakpoint")) { //$NON-NLS-1$
- handleHit(rcEvent);
- }
+ PDARunControlEvent rcEvent = (PDARunControlEvent)event;
+ if (rcEvent.fReason.equals("breakpoint")) { //$NON-NLS-1$
+ handleHit(rcEvent);
+ }
}
}
/**
- * Determines if this breakpoint was hit and notifies the thread.
- *
- * @param event breakpoint event
- */
- private void handleHit(PDARunControlEvent event) {
- int lastSpace = event.fMessage.lastIndexOf(' ');
- if (lastSpace > 0) {
- String line = event.fMessage.substring(lastSpace + 1);
- int lineNumber = Integer.parseInt(line);
- // breakpoints event line numbers are 0 based, model objects are 1 based
- lineNumber++;
- try {
+ * Determines if this breakpoint was hit and notifies the thread.
+ *
+ * @param event breakpoint event
+ */
+ private void handleHit(PDARunControlEvent event) {
+ int lastSpace = event.fMessage.lastIndexOf(' ');
+ if (lastSpace > 0) {
+ String line = event.fMessage.substring(lastSpace + 1);
+ int lineNumber = Integer.parseInt(line);
+ // breakpoints event line numbers are 0 based, model objects are 1 based
+ lineNumber++;
+ try {
if (getLineNumber() == lineNumber) {
notifyThread(event.fThreadId);
}
- } catch (CoreException e) {
- }
- }
- }
+ } catch (CoreException e) {
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
index 41b0ae901..b126728b0 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
@@ -34,14 +34,14 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAWatchCommand;
*/
public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
- // 'read' or 'write' depending on what caused the last suspend for this watchpoint
- private String fLastSuspendType;
+ // 'read' or 'write' depending on what caused the last suspend for this watchpoint
+ private String fLastSuspendType;
- // marker attributes
- public static final String ACCESS = "ACCESS"; //$NON-NLS-1$
- public static final String MODIFICATION = "MODIFICATION"; //$NON-NLS-1$
- public static final String FUNCTION_NAME = "FUNCTION_NAME"; //$NON-NLS-1$
- public static final String VAR_NAME = "VAR_NAME"; //$NON-NLS-1$
+ // marker attributes
+ public static final String ACCESS = "ACCESS"; //$NON-NLS-1$
+ public static final String MODIFICATION = "MODIFICATION"; //$NON-NLS-1$
+ public static final String FUNCTION_NAME = "FUNCTION_NAME"; //$NON-NLS-1$
+ public static final String VAR_NAME = "VAR_NAME"; //$NON-NLS-1$
/**
* Default constructor is required for the breakpoint manager
@@ -49,7 +49,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
* the <code>setMarker(...)</code> method is called to restore
* this breakpoint's attributes.
*/
- public PDAWatchpoint() {
+ public PDAWatchpoint() {
}
/**
* Constructs a line breakpoint on the given resource at the given
@@ -80,134 +80,134 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
run(getMarkerRule(resource), runnable);
}
- @Override
+ @Override
public boolean isAccess() throws CoreException {
- return getMarker().getAttribute(ACCESS, true);
- }
+ return getMarker().getAttribute(ACCESS, true);
+ }
- @Override
+ @Override
public void setAccess(boolean access) throws CoreException {
- setAttribute(ACCESS, access);
- }
+ setAttribute(ACCESS, access);
+ }
- @Override
+ @Override
public boolean isModification() throws CoreException {
- return getMarker().getAttribute(MODIFICATION, true);
- }
+ return getMarker().getAttribute(MODIFICATION, true);
+ }
- @Override
+ @Override
public void setModification(boolean modification) throws CoreException {
- setAttribute(MODIFICATION, modification);
- }
+ setAttribute(MODIFICATION, modification);
+ }
- @Override
+ @Override
public boolean supportsAccess() {
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public boolean supportsModification() {
- return true;
- }
-
- /**
- * Sets the variable and function names the watchpoint is set on.
- *
- * @param functionName function name
- * @param variableName variable name
- * @throws CoreException if an exception occurrs setting marker attribtues
- */
- protected void setVariable(String functionName, String variableName) throws CoreException {
- setAttribute(VAR_NAME, variableName);
- setAttribute(FUNCTION_NAME, functionName);
- }
-
- /**
- * Returns the name of the variable this watchpoint is set on.
- *
- * @return the name of the variable this watchpoint is set on
- * @throws CoreException if unable to access the attribute
- */
- public String getVariableName() throws CoreException {
- return getMarker().getAttribute(VAR_NAME, (String)null);
- }
-
- /**
- * Returns the name of the function the variable associted with this watchpoint is defined in.
- *
- * @return the name of the function the variable associted with this watchpoint is defined in
- * @throws CoreException if unable to access the attribute
- */
- public String getFunctionName() throws CoreException {
- return getMarker().getAttribute(FUNCTION_NAME, (String)null);
- }
-
- /**
- * Sets the type of event that causes the last suspend event.
- *
- * @param description one of 'read' or 'write'
- */
- public void setSuspendType(String description) {
- fLastSuspendType = description;
- }
-
- /**
- * Returns the type of event that caused the last suspend.
- *
- * @return 'read', 'write', or <code>null</code> if undefined
- */
- public String getSuspendType() {
- return fLastSuspendType;
- }
+ return true;
+ }
+
+ /**
+ * Sets the variable and function names the watchpoint is set on.
+ *
+ * @param functionName function name
+ * @param variableName variable name
+ * @throws CoreException if an exception occurrs setting marker attribtues
+ */
+ protected void setVariable(String functionName, String variableName) throws CoreException {
+ setAttribute(VAR_NAME, variableName);
+ setAttribute(FUNCTION_NAME, functionName);
+ }
+
+ /**
+ * Returns the name of the variable this watchpoint is set on.
+ *
+ * @return the name of the variable this watchpoint is set on
+ * @throws CoreException if unable to access the attribute
+ */
+ public String getVariableName() throws CoreException {
+ return getMarker().getAttribute(VAR_NAME, (String)null);
+ }
+
+ /**
+ * Returns the name of the function the variable associted with this watchpoint is defined in.
+ *
+ * @return the name of the function the variable associted with this watchpoint is defined in
+ * @throws CoreException if unable to access the attribute
+ */
+ public String getFunctionName() throws CoreException {
+ return getMarker().getAttribute(FUNCTION_NAME, (String)null);
+ }
+
+ /**
+ * Sets the type of event that causes the last suspend event.
+ *
+ * @param description one of 'read' or 'write'
+ */
+ public void setSuspendType(String description) {
+ fLastSuspendType = description;
+ }
+
+ /**
+ * Returns the type of event that caused the last suspend.
+ *
+ * @return 'read', 'write', or <code>null</code> if undefined
+ */
+ public String getSuspendType() {
+ return fLastSuspendType;
+ }
@Override
protected void createRequest(PDADebugTarget target) throws CoreException {
- int flag = 0;
- if (isAccess()) {
- flag = flag | 1;
- }
- if (isModification()) {
- flag = flag | 2;
- }
+ int flag = 0;
+ if (isAccess()) {
+ flag = flag | 1;
+ }
+ if (isModification()) {
+ flag = flag | 2;
+ }
target.sendCommand(new PDAWatchCommand(getFunctionName(), getVariableName(), flag));
}
@Override
protected void clearRequest(PDADebugTarget target) throws CoreException {
- target.sendCommand(new PDAWatchCommand(getFunctionName(), getVariableName(), 0));
+ target.sendCommand(new PDAWatchCommand(getFunctionName(), getVariableName(), 0));
}
@Override
public void handleEvent(PDAEvent event) {
- if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
- PDARunControlEvent rcEvent = (PDARunControlEvent)event;
- if (rcEvent.fReason.equals("watch")) { //$NON-NLS-1$
- handleHit(rcEvent);
- }
- }
+ if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
+ PDARunControlEvent rcEvent = (PDARunControlEvent)event;
+ if (rcEvent.fReason.equals("watch")) { //$NON-NLS-1$
+ handleHit(rcEvent);
+ }
+ }
}
/**
- * Determines if this breakpoint was hit and notifies the thread.
- *
- * @param event breakpoint event
- */
- private void handleHit(PDARunControlEvent event) {
- String[] strings = event.fMessage.split(" "); //$NON-NLS-1$
- if (strings.length == 4) {
- String fv = strings[3];
- int j = fv.indexOf("::"); //$NON-NLS-1$
- if (j > 0) {
- String fcn = fv.substring(0, j);
- String var = fv.substring(j + 2);
+ * Determines if this breakpoint was hit and notifies the thread.
+ *
+ * @param event breakpoint event
+ */
+ private void handleHit(PDARunControlEvent event) {
+ String[] strings = event.fMessage.split(" "); //$NON-NLS-1$
+ if (strings.length == 4) {
+ String fv = strings[3];
+ int j = fv.indexOf("::"); //$NON-NLS-1$
+ if (j > 0) {
+ String fcn = fv.substring(0, j);
+ String var = fv.substring(j + 2);
try {
if (getVariableName().equals(var) && getFunctionName().equals(fcn)) {
setSuspendType(strings[2]);
- notifyThread(event.fThreadId);
+ notifyThread(event.fThreadId);
}
} catch (CoreException e) {
}
- }
- }
- }
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
index 7a37de287..cb5a4223d 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
@@ -55,22 +55,22 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
List<String> commandList = new ArrayList<>();
- // Get Java VM path
- String javaVMHome = System.getProperty("java.home"); //$NON-NLS-1$
- String javaVMExec = javaVMHome + File.separatorChar + "bin" + File.separatorChar + "java"; //$NON-NLS-1$ //$NON-NLS-2$
- if (File.separatorChar == '\\') {
- javaVMExec += ".exe"; //$NON-NLS-1$
- }
- File exe = new File(javaVMExec);
- if (!exe.exists()) {
- abort(MessageFormat.format("Specified java VM executable {0} does not exist.", new Object[]{javaVMExec}), null); //$NON-NLS-1$
- }
- commandList.add(javaVMExec);
-
- commandList.add("-cp"); //$NON-NLS-1$
- commandList.add(File.pathSeparator + DebugCorePlugin.getFileInPlugin(new Path("bin"))); //$NON-NLS-1$
-
- commandList.add("org.eclipse.debug.examples.pdavm.PDAVirtualMachine"); //$NON-NLS-1$
+ // Get Java VM path
+ String javaVMHome = System.getProperty("java.home"); //$NON-NLS-1$
+ String javaVMExec = javaVMHome + File.separatorChar + "bin" + File.separatorChar + "java"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (File.separatorChar == '\\') {
+ javaVMExec += ".exe"; //$NON-NLS-1$
+ }
+ File exe = new File(javaVMExec);
+ if (!exe.exists()) {
+ abort(MessageFormat.format("Specified java VM executable {0} does not exist.", new Object[]{javaVMExec}), null); //$NON-NLS-1$
+ }
+ commandList.add(javaVMExec);
+
+ commandList.add("-cp"); //$NON-NLS-1$
+ commandList.add(File.pathSeparator + DebugCorePlugin.getFileInPlugin(new Path("bin"))); //$NON-NLS-1$
+
+ commandList.add("org.eclipse.debug.examples.pdavm.PDAVirtualMachine"); //$NON-NLS-1$
// program name
String program = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
index 37fbc949d..338de32e8 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
@@ -45,50 +45,50 @@ public class PDADebugElement extends DebugElement {
}
/**
- * Sends a request to the PDA interpreter, waits for and returns the reply.
- *
- * @param request command
- * @return reply
- * @throws DebugException if the request fails
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDATerminateCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMResumeCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASuspendCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAResumeCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStepCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDADropFrameCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetBreakpointCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAClearBreakpointCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAWatchCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDADataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetDataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAPopDataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAPushDataCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAEvalCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAEventStopCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackDepthCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAFrameCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetVarCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVarCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAChildrenCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAGroupsCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDARegistersCommand
- *
- * @since 3.5
- */
+ * Sends a request to the PDA interpreter, waits for and returns the reply.
+ *
+ * @param request command
+ * @return reply
+ * @throws DebugException if the request fails
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDATerminateCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMResumeCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASuspendCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAResumeCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAStepCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDADropFrameCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASetBreakpointCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAClearBreakpointCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAWatchCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDADataCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASetDataCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAPopDataCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAPushDataCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAEvalCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAEventStopCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackDepthCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAFrameCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDASetVarCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAVarCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAChildrenCommand
+ *
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDAGroupsCommand
+ * @see org.eclipse.debug.examples.core.pda.protocol.PDARegistersCommand
+ *
+ * @since 3.5
+ */
public PDACommandResult sendCommand(PDACommand command) throws DebugException {
- return getPDADebugTarget().sendCommand(command);
- }
+ return getPDADebugTarget().sendCommand(command);
+ }
/**
* Returns the debug target as a PDA target.
@@ -96,15 +96,15 @@ public class PDADebugElement extends DebugElement {
* @return PDA debug target
*/
protected PDADebugTarget getPDADebugTarget() {
- return (PDADebugTarget) getDebugTarget();
+ return (PDADebugTarget) getDebugTarget();
}
/**
* Returns the breakpoint manager
*
- * @return the breakpoint manager
- */
- protected IBreakpointManager getBreakpointManager() {
- return DebugPlugin.getDefault().getBreakpointManager();
- }
+ * @return the breakpoint manager
+ */
+ protected IBreakpointManager getBreakpointManager() {
+ return DebugPlugin.getDefault().getBreakpointManager();
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
index daf2a0709..9685b6f6e 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
@@ -117,15 +117,15 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
try {
message = fEventReader.readLine();
if (message != null) {
- PDAEvent event = null;
- try {
- event = PDAEvent.parseEvent(message);
- }
- catch (IllegalArgumentException e) {
- DebugCorePlugin.getDefault().getLog().log(
- new Status (IStatus.ERROR, "org.eclipse.debug.examples.core", "Error parsing PDA event", e)); //$NON-NLS-1$ //$NON-NLS-2$
- continue;
- }
+ PDAEvent event = null;
+ try {
+ event = PDAEvent.parseEvent(message);
+ }
+ catch (IllegalArgumentException e) {
+ DebugCorePlugin.getDefault().getLog().log(
+ new Status (IStatus.ERROR, "org.eclipse.debug.examples.core", "Error parsing PDA event", e)); //$NON-NLS-1$ //$NON-NLS-2$
+ continue;
+ }
Object[] listeners = fEventListeners.toArray();
for (int i = 0; i < listeners.length; i++) {
((IPDAEventListener)listeners[i]).handleEvent(event);
@@ -148,11 +148,11 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* @param listener event listener
*/
public void addEventListener(IPDAEventListener listener) {
- synchronized(fEventListeners) {
- if (!fEventListeners.contains(listener)) {
- fEventListeners.add(listener);
- }
- }
+ synchronized(fEventListeners) {
+ if (!fEventListeners.contains(listener)) {
+ fEventListeners.add(listener);
+ }
+ }
}
/**
@@ -204,12 +204,12 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
fEventDispatch = new EventDispatchJob();
fEventDispatch.schedule();
IBreakpointManager breakpointManager = getBreakpointManager();
- breakpointManager.addBreakpointListener(this);
+ breakpointManager.addBreakpointListener(this);
breakpointManager.addBreakpointManagerListener(this);
// initialize error hanlding to suspend on 'unimplemented instructions'
// and 'no such label' errors
sendCommand(new PDAEventStopCommand(PDAEventStopCommand.UNIMPINSTR, true));
- sendCommand(new PDAEventStopCommand(PDAEventStopCommand.NOSUCHLABEL, true));
+ sendCommand(new PDAEventStopCommand(PDAEventStopCommand.NOSUCHLABEL, true));
}
@Override
@@ -218,9 +218,9 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
}
@Override
public IThread[] getThreads() throws DebugException {
- synchronized (fThreads) {
- return fThreads.values().toArray(new IThread[fThreads.size()]);
- }
+ synchronized (fThreads) {
+ return fThreads.values().toArray(new IThread[fThreads.size()]);
+ }
}
@Override
public boolean hasThreads() throws DebugException {
@@ -282,7 +282,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
//#ifdef ex2
//# // TODO: Exercise 2 - send termination request to interpreter
//#else
- sendCommand(new PDATerminateCommand());
+ sendCommand(new PDATerminateCommand());
//#endif
}
@@ -303,12 +303,12 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
@Override
public void resume() throws DebugException {
- sendCommand(new PDAVMResumeCommand());
+ sendCommand(new PDAVMResumeCommand());
}
@Override
public void suspend() throws DebugException {
- sendCommand(new PDAVMSuspendCommand());
+ sendCommand(new PDAVMSuspendCommand());
}
@Override
@@ -317,7 +317,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
try {
if ((breakpoint.isEnabled() && getBreakpointManager().isEnabled()) || !breakpoint.isRegistered()) {
PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
- pdaBreakpoint.install(this);
+ pdaBreakpoint.install(this);
}
} catch (CoreException e) {
}
@@ -328,7 +328,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
if (supportsBreakpoint(breakpoint)) {
try {
- PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
+ PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
pdaBreakpoint.remove(this);
} catch (CoreException e) {
}
@@ -405,58 +405,58 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
setTerminated(true);
fThreads.clear();
IBreakpointManager breakpointManager = getBreakpointManager();
- breakpointManager.removeBreakpointListener(this);
+ breakpointManager.removeBreakpointListener(this);
breakpointManager.removeBreakpointManagerListener(this);
fireTerminateEvent();
removeEventListener(this);
}
private void vmResumed(PDAVMResumedEvent event) {
- setVMSuspended(false);
- fireResumeEvent(calcDetail(event.fReason));
+ setVMSuspended(false);
+ fireResumeEvent(calcDetail(event.fReason));
}
private void vmSuspended(PDAVMSuspendedEvent event) {
- setVMSuspended(true);
- fireSuspendEvent(calcDetail(event.fReason));
+ setVMSuspended(true);
+ fireSuspendEvent(calcDetail(event.fReason));
}
private int calcDetail(String reason) {
- if (reason.equals("breakpoint") || reason.equals("watch")) { //$NON-NLS-1$ //$NON-NLS-2$
- return DebugEvent.BREAKPOINT;
- } else if (reason.equals("step")) { //$NON-NLS-1$
- return DebugEvent.STEP_OVER;
- } else if (reason.equals("drop")) { //$NON-NLS-1$
- return DebugEvent.STEP_RETURN;
- } else if (reason.equals("client")) { //$NON-NLS-1$
- return DebugEvent.CLIENT_REQUEST;
- } else if (reason.equals("event")) { //$NON-NLS-1$
- return DebugEvent.BREAKPOINT;
- } else {
- return DebugEvent.UNSPECIFIED;
- }
+ if (reason.equals("breakpoint") || reason.equals("watch")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return DebugEvent.BREAKPOINT;
+ } else if (reason.equals("step")) { //$NON-NLS-1$
+ return DebugEvent.STEP_OVER;
+ } else if (reason.equals("drop")) { //$NON-NLS-1$
+ return DebugEvent.STEP_RETURN;
+ } else if (reason.equals("client")) { //$NON-NLS-1$
+ return DebugEvent.CLIENT_REQUEST;
+ } else if (reason.equals("event")) { //$NON-NLS-1$
+ return DebugEvent.BREAKPOINT;
+ } else {
+ return DebugEvent.UNSPECIFIED;
+ }
}
private void started(PDAStartedEvent event) {
- PDAThread newThread = new PDAThread(this, event.fThreadId);
- fThreads.put(Integer.valueOf(event.fThreadId), newThread);
- newThread.start();
+ PDAThread newThread = new PDAThread(this, event.fThreadId);
+ fThreads.put(Integer.valueOf(event.fThreadId), newThread);
+ newThread.start();
}
private void exited(PDAExitedEvent event) {
- PDAThread thread = fThreads.remove(Integer.valueOf(event.fThreadId));
- if (thread != null) {
- thread.exit();
- }
+ PDAThread thread = fThreads.remove(Integer.valueOf(event.fThreadId));
+ if (thread != null) {
+ thread.exit();
+ }
}
private synchronized void setVMSuspended(boolean suspended) {
- fVMSuspended = suspended;
+ fVMSuspended = suspended;
}
- private synchronized void setTerminated(boolean terminated) {
- fTerminated = terminated;
- }
+ private synchronized void setTerminated(boolean terminated) {
+ fTerminated = terminated;
+ }
private String sendRequest(String request) throws DebugException {
synchronized (fRequestSocket) {
@@ -466,7 +466,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
// wait for reply
String retVal = fRequestReader.readLine();
if (retVal == null) {
- requestFailed("Request failed: " + request + ". Debugger connection closed.", null); //$NON-NLS-1$ //$NON-NLS-2$
+ requestFailed("Request failed: " + request + ". Debugger connection closed.", null); //$NON-NLS-1$ //$NON-NLS-2$
}
return retVal;
} catch (IOException e) {
@@ -479,8 +479,8 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
@Override
public PDACommandResult sendCommand(PDACommand command) throws DebugException {
- String response = sendRequest(command.getRequest());
- return command.createResult(response);
+ String response = sendRequest(command.getRequest());
+ return command.createResult(response);
}
/**
@@ -496,7 +496,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
} else {
breakpointRemoved(breakpoints[i], null);
}
- }
+ }
}
@Override
@@ -505,15 +505,15 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
started((PDAStartedEvent)event);
} else if (event instanceof PDAExitedEvent) {
exited((PDAExitedEvent)event);
- } else if (event instanceof PDAVMStartedEvent) {
- vmStarted((PDAVMStartedEvent)event);
+ } else if (event instanceof PDAVMStartedEvent) {
+ vmStarted((PDAVMStartedEvent)event);
} else if (event instanceof PDAVMTerminatedEvent) {
- vmTerminated();
- } else if (event instanceof PDAVMSuspendedEvent) {
- vmSuspended((PDAVMSuspendedEvent)event);
- } else if (event instanceof PDAVMResumedEvent) {
- vmResumed((PDAVMResumedEvent)event);
- }
+ vmTerminated();
+ } else if (event instanceof PDAVMSuspendedEvent) {
+ vmSuspended((PDAVMSuspendedEvent)event);
+ } else if (event instanceof PDAVMResumedEvent) {
+ vmResumed((PDAVMResumedEvent)event);
+ }
}
/**
@@ -526,15 +526,15 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* if terminated
*/
public PDAThread getThread(int threadId) {
- if (threadId > 0) {
- return fThreads.get(Integer.valueOf(threadId));
- } else {
- synchronized(fThreads) {
- if (fThreads.size() > 0) {
- return fThreads.values().iterator().next();
- }
- }
- }
+ if (threadId > 0) {
+ return fThreads.get(Integer.valueOf(threadId));
+ } else {
+ synchronized(fThreads) {
+ if (fThreads.size() > 0) {
+ return fThreads.values().iterator().next();
+ }
+ }
+ }
return null;
}
@@ -544,7 +544,7 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* @throws DebugException
*/
public void restart() throws DebugException {
- sendCommand(new PDARestartCommand());
- }
+ sendCommand(new PDARestartCommand());
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
index fdd7cde92..761ea8211 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
@@ -221,15 +221,15 @@ public class PDAStackFrame extends PDADebugElement implements IStackFrame {
return fId;
}
- /**
- * Returns the stack frame's thread's unique identifier
- *
- * @return this stack frame's thread's unique identifier
- *
- * @since 3.5
- */
+ /**
+ * Returns the stack frame's thread's unique identifier
+ *
+ * @return this stack frame's thread's unique identifier
+ *
+ * @since 3.5
+ */
protected int getThreadIdentifier() {
- return fThread.getIdentifier();
+ return fThread.getIdentifier();
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
index 6eda5867b..007c5c25b 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
@@ -24,17 +24,17 @@ import org.eclipse.debug.core.model.IVariable;
*/
public class PDAStackValue extends PDADebugElement implements IValue {
- final private PDAThread fThread;
- final private String fValue;
- final private int fIndex;
+ final private PDAThread fThread;
+ final private String fValue;
+ final private int fIndex;
- /**
- * Constructs a value that appears on the data stack
- *
- * @param target debug target
- * @param value value on the stack
- * @param index index on the stack
- */
+ /**
+ * Constructs a value that appears on the data stack
+ *
+ * @param target debug target
+ * @param value value on the stack
+ * @param index index on the stack
+ */
public PDAStackValue(PDAThread thread, String value, int index) {
super(thread.getDebugTarget());
fThread = thread;
@@ -43,43 +43,43 @@ public class PDAStackValue extends PDADebugElement implements IValue {
}
public PDAThread getThread() {
- return fThread;
+ return fThread;
}
- @Override
+ @Override
public String getValueString() throws DebugException {
- return fValue;
- }
+ return fValue;
+ }
- @Override
+ @Override
public boolean isAllocated() throws DebugException {
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public IVariable[] getVariables() throws DebugException {
- return new IVariable[0];
- }
+ return new IVariable[0];
+ }
- @Override
+ @Override
public boolean hasVariables() throws DebugException {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public String getReferenceTypeName() throws DebugException {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof PDAStackValue &&
- ((PDAStackValue)obj).fValue.equals(fValue) &&
- ((PDAStackValue)obj).fIndex == fIndex;
- }
+ return obj instanceof PDAStackValue &&
+ ((PDAStackValue)obj).fValue.equals(fValue) &&
+ ((PDAStackValue)obj).fIndex == fIndex;
+ }
- @Override
+ @Override
public int hashCode() {
- return super.hashCode() + fIndex;
- }
+ return super.hashCode() + fIndex;
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
index 19913ecf7..b72fa1b18 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
@@ -50,10 +50,10 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent;
*/
public class PDAThread extends PDADebugElement implements IThread, IPDAEventListener {
- /**
- * ID of this thread as reported by PDA.
- */
- private final int fThreadId;
+ /**
+ * ID of this thread as reported by PDA.
+ */
+ private final int fThreadId;
/**
* Breakpoint this thread is suspended at or <code>null</code>
@@ -97,29 +97,29 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
* @since 3.5
*/
void start() {
- fireCreationEvent();
- getPDADebugTarget().addEventListener(this);
+ fireCreationEvent();
+ getPDADebugTarget().addEventListener(this);
}
- /**
- * Called by the debug target before the thread is removed.
- *
- * @since 3.5
- */
+ /**
+ * Called by the debug target before the thread is removed.
+ *
+ * @since 3.5
+ */
void exit() {
- getPDADebugTarget().removeEventListener(this);
- fireTerminateEvent();
+ getPDADebugTarget().removeEventListener(this);
+ fireTerminateEvent();
}
@Override
public IStackFrame[] getStackFrames() throws DebugException {
if (isSuspended()) {
- PDAStackCommandResult result = (PDAStackCommandResult)sendCommand(new PDAStackCommand(fThreadId));
- IStackFrame[] frames = new IStackFrame[result.fFrames.length];
- for (int i = 0; i < result.fFrames.length; i++) {
- frames[frames.length - i - 1] = new PDAStackFrame(this, result.fFrames[i], i);
+ PDAStackCommandResult result = (PDAStackCommandResult)sendCommand(new PDAStackCommand(fThreadId));
+ IStackFrame[] frames = new IStackFrame[result.fFrames.length];
+ for (int i = 0; i < result.fFrames.length; i++) {
+ frames[frames.length - i - 1] = new PDAStackFrame(this, result.fFrames[i], i);
}
- return frames;
+ return frames;
}
return new IStackFrame[0];
}
@@ -178,15 +178,15 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
@Override
public boolean isSuspended() {
- if (getDebugTarget().isTerminated()) {
- return false;
- }
- if (getDebugTarget().isSuspended()) {
- return true;
- }
- synchronized (this) {
- return fSuspended;
- }
+ if (getDebugTarget().isTerminated()) {
+ return false;
+ }
+ if (getDebugTarget().isSuspended()) {
+ return true;
+ }
+ synchronized (this) {
+ return fSuspended;
+ }
}
@Override
@@ -203,7 +203,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
//#ifdef ex2
//# // TODO: Exercise 2 - send suspend request to interpreter
//#else
- sendCommand(new PDASuspendCommand(fThreadId));
+ sendCommand(new PDASuspendCommand(fThreadId));
//#endif
}
@@ -252,7 +252,7 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
@Override
public void terminate() throws DebugException {
- getDebugTarget().terminate();
+ getDebugTarget().terminate();
}
/**
@@ -296,64 +296,64 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
@Override
public void handleEvent(PDAEvent _event) {
- if (_event instanceof PDARunControlEvent && fThreadId == ((PDARunControlEvent)_event).fThreadId) {
- PDARunControlEvent event = (PDARunControlEvent)_event;
- // clear previous state
- fBreakpoint = null;
- setStepping(false);
-
- // handle events
- if (event instanceof PDAResumedEvent || event instanceof PDAVMResumedEvent) {
- setSuspended(false);
- if ("step".equals(event.fReason)) { //$NON-NLS-1$
- setStepping(true);
- resumed(DebugEvent.STEP_OVER);
- //#ifdef ex2
- //# }
- //# // TODO: Exercise 2 - handle/fire "client" resume event
- //#else
- } else if ("client".equals(event.fReason)) { //$NON-NLS-1$
- resumed(DebugEvent.CLIENT_REQUEST);
- }
- //#endif
- //#ifdef ex5
- //# // TODO: Exercise 5 - handle start of drop event
- //#else
- else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
- resumed(DebugEvent.STEP_RETURN);
- }
- //#endif
- } else if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
- setSuspended(true);
- //#ifdef ex2
- //# // TODO: Exercise 2 - handle/fire "client" suspend event
- //# if (event.endsWith("step")) {
- //# suspended(DebugEvent.STEP_END);
- //# } else if (event.startsWith("suspended event") && getError() != null) {
- //# exceptionHit();
- //# }
- //#else
- if ("client".equals(event.fReason)) { //$NON-NLS-1$
- suspended(DebugEvent.CLIENT_REQUEST);
- } else if ("step".equals(event.fReason)) { //$NON-NLS-1$
- suspended(DebugEvent.STEP_END);
- } else if ("event".equals(event.fReason) && getError() != null) { //$NON-NLS-1$
- exceptionHit();
- }
- //#endif
- //#ifdef ex5
- //# // TODO: Exercise 5 - handle end of drop event
- //#else
- else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
- suspended(DebugEvent.STEP_END);
- }
- //#endif
- } else if (_event instanceof PDANoSuchLabelEvent ||
- _event instanceof PDAUnimplementedInstructionEvent)
- {
- setError(event.fMessage);
- }
- }
+ if (_event instanceof PDARunControlEvent && fThreadId == ((PDARunControlEvent)_event).fThreadId) {
+ PDARunControlEvent event = (PDARunControlEvent)_event;
+ // clear previous state
+ fBreakpoint = null;
+ setStepping(false);
+
+ // handle events
+ if (event instanceof PDAResumedEvent || event instanceof PDAVMResumedEvent) {
+ setSuspended(false);
+ if ("step".equals(event.fReason)) { //$NON-NLS-1$
+ setStepping(true);
+ resumed(DebugEvent.STEP_OVER);
+ //#ifdef ex2
+ //# }
+ //# // TODO: Exercise 2 - handle/fire "client" resume event
+ //#else
+ } else if ("client".equals(event.fReason)) { //$NON-NLS-1$
+ resumed(DebugEvent.CLIENT_REQUEST);
+ }
+ //#endif
+ //#ifdef ex5
+ //# // TODO: Exercise 5 - handle start of drop event
+ //#else
+ else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
+ resumed(DebugEvent.STEP_RETURN);
+ }
+ //#endif
+ } else if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
+ setSuspended(true);
+ //#ifdef ex2
+ //# // TODO: Exercise 2 - handle/fire "client" suspend event
+ //# if (event.endsWith("step")) {
+ //# suspended(DebugEvent.STEP_END);
+ //# } else if (event.startsWith("suspended event") && getError() != null) {
+ //# exceptionHit();
+ //# }
+ //#else
+ if ("client".equals(event.fReason)) { //$NON-NLS-1$
+ suspended(DebugEvent.CLIENT_REQUEST);
+ } else if ("step".equals(event.fReason)) { //$NON-NLS-1$
+ suspended(DebugEvent.STEP_END);
+ } else if ("event".equals(event.fReason) && getError() != null) { //$NON-NLS-1$
+ exceptionHit();
+ }
+ //#endif
+ //#ifdef ex5
+ //# // TODO: Exercise 5 - handle end of drop event
+ //#else
+ else if ("drop".equals(event.fReason)) { //$NON-NLS-1$
+ suspended(DebugEvent.STEP_END);
+ }
+ //#endif
+ } else if (_event instanceof PDANoSuchLabelEvent ||
+ _event instanceof PDAUnimplementedInstructionEvent)
+ {
+ setError(event.fMessage);
+ }
+ }
}
/**
@@ -380,12 +380,12 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
}
/**
- * Notification an error was encountered. Fires a breakpoint
- * suspend event.
- */
- private void exceptionHit() {
- suspended(DebugEvent.BREAKPOINT);
- }
+ * Notification an error was encountered. Fires a breakpoint
+ * suspend event.
+ */
+ private void exceptionHit() {
+ suspended(DebugEvent.BREAKPOINT);
+ }
/**
* Sets the current variables for the given stack frame. Called
@@ -421,8 +421,8 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
* Pops the top frame off the callstack.
*
* @throws DebugException
- *
- * @since 3.5
+ *
+ * @since 3.5
*/
public void popFrame() throws DebugException {
//#ifdef ex5
@@ -451,89 +451,89 @@ public class PDAThread extends PDADebugElement implements IThread, IPDAEventList
return false;
}
- /**
- * Returns the values on the data stack (top down)
- *
- * @return the values on the data stack (top down)
- *
- * @since 3.5
- */
- public IValue[] getDataStack() throws DebugException {
- PDAListResult result = (PDAListResult)sendCommand(new PDADataCommand(fThreadId));
- if (result.fValues.length > 0) {
- IValue[] values = new IValue[result.fValues.length];
- for (int i = 0; i < result.fValues.length; i++) {
- values[values.length - i - 1] = new PDAStackValue(this, result.fValues[i], i);
- }
- return values;
- }
- return new IValue[0];
- }
-
- /**
- * Returns whether popping the data stack is currently permitted
- *
- * @return whether popping the data stack is currently permitted
- *
- * @since 3.5
- */
- public boolean canPopData() {
- try {
- return !isTerminated() && isSuspended() && getDataStack().length > 0;
- } catch (DebugException e) {
- }
- return false;
- }
-
- /**
- * Pops and returns the top of the data stack
- *
- * @return the top value on the stack
- * @throws DebugException if the stack is empty or the request fails
- *
- * @since 3.5
- */
- public IValue popData() throws DebugException {
- IValue[] dataStack = getDataStack();
- if (dataStack.length > 0) {
- sendCommand(new PDAPopDataCommand(fThreadId));
- return dataStack[0];
- }
- requestFailed("Empty stack", null); //$NON-NLS-1$
- return null;
- }
-
- /**
- * Returns whether pushing a value is currently supported.
- *
- * @return whether pushing a value is currently supported
- *
- * @since 3.5
- */
- public boolean canPushData() {
- return !isTerminated() && isSuspended();
- }
-
- /**
- * Pushes a value onto the stack.
- *
- * @param value value to push
- * @throws DebugException on failure
- *
- * @since 3.5
- */
- public void pushData(String value) throws DebugException {
- sendCommand(new PDAPushDataCommand(fThreadId, value));
- }
-
- /**
- * Returns this thread's unique identifier
- *
- * @return this thread's unique identifier
- *
- * @since 3.5
- */
+ /**
+ * Returns the values on the data stack (top down)
+ *
+ * @return the values on the data stack (top down)
+ *
+ * @since 3.5
+ */
+ public IValue[] getDataStack() throws DebugException {
+ PDAListResult result = (PDAListResult)sendCommand(new PDADataCommand(fThreadId));
+ if (result.fValues.length > 0) {
+ IValue[] values = new IValue[result.fValues.length];
+ for (int i = 0; i < result.fValues.length; i++) {
+ values[values.length - i - 1] = new PDAStackValue(this, result.fValues[i], i);
+ }
+ return values;
+ }
+ return new IValue[0];
+ }
+
+ /**
+ * Returns whether popping the data stack is currently permitted
+ *
+ * @return whether popping the data stack is currently permitted
+ *
+ * @since 3.5
+ */
+ public boolean canPopData() {
+ try {
+ return !isTerminated() && isSuspended() && getDataStack().length > 0;
+ } catch (DebugException e) {
+ }
+ return false;
+ }
+
+ /**
+ * Pops and returns the top of the data stack
+ *
+ * @return the top value on the stack
+ * @throws DebugException if the stack is empty or the request fails
+ *
+ * @since 3.5
+ */
+ public IValue popData() throws DebugException {
+ IValue[] dataStack = getDataStack();
+ if (dataStack.length > 0) {
+ sendCommand(new PDAPopDataCommand(fThreadId));
+ return dataStack[0];
+ }
+ requestFailed("Empty stack", null); //$NON-NLS-1$
+ return null;
+ }
+
+ /**
+ * Returns whether pushing a value is currently supported.
+ *
+ * @return whether pushing a value is currently supported
+ *
+ * @since 3.5
+ */
+ public boolean canPushData() {
+ return !isTerminated() && isSuspended();
+ }
+
+ /**
+ * Pushes a value onto the stack.
+ *
+ * @param value value to push
+ * @throws DebugException on failure
+ *
+ * @since 3.5
+ */
+ public void pushData(String value) throws DebugException {
+ sendCommand(new PDAPushDataCommand(fThreadId, value));
+ }
+
+ /**
+ * Returns this thread's unique identifier
+ *
+ * @return this thread's unique identifier
+ *
+ * @since 3.5
+ */
public int getIdentifier() {
- return fThreadId;
+ return fThreadId;
}
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
index 24a8ef402..fe1452c4c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
@@ -26,7 +26,7 @@ import org.eclipse.debug.examples.core.pda.protocol.PDAListResult;
*/
public class PDAValue extends PDADebugElement implements IValue {
- final private PDAVariable fVariable;
+ final private PDAVariable fVariable;
final private String fValue;
public PDAValue(PDAVariable variable, String value) {
@@ -57,46 +57,46 @@ public class PDAValue extends PDADebugElement implements IValue {
@Override
public IVariable[] getVariables() throws DebugException {
- PDAStackFrame frame = fVariable.getStackFrame();
- PDAListResult result = (PDAListResult) sendCommand(
- new PDAChildrenCommand(frame.getThreadIdentifier(), frame.getIdentifier(), fVariable.getName()) );
+ PDAStackFrame frame = fVariable.getStackFrame();
+ PDAListResult result = (PDAListResult) sendCommand(
+ new PDAChildrenCommand(frame.getThreadIdentifier(), frame.getIdentifier(), fVariable.getName()) );
- IVariable[] children = new IVariable[result.fValues.length];
- for(int i = 0; i < result.fValues.length; i++) {
- children[i] = new PDAVariable(frame, result.fValues[i]);
- }
+ IVariable[] children = new IVariable[result.fValues.length];
+ for(int i = 0; i < result.fValues.length; i++) {
+ children[i] = new PDAVariable(frame, result.fValues[i]);
+ }
return children;
}
@Override
public boolean hasVariables() throws DebugException {
- if (getVariables().length != 0) {
- return true;
- }
- // Value with multiple words can be show as an array using logical
- // structures. If the value has multiple words, it needs to indicate
- // that it has children even if logical structures are not turned on.
+ if (getVariables().length != 0) {
+ return true;
+ }
+ // Value with multiple words can be show as an array using logical
+ // structures. If the value has multiple words, it needs to indicate
+ // that it has children even if logical structures are not turned on.
return fValue.split("\\W+").length > 1; //$NON-NLS-1$
}
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof PDAValue && ((PDAValue)obj).fValue.equals(fValue);
- }
+ return obj instanceof PDAValue && ((PDAValue)obj).fValue.equals(fValue);
+ }
- @Override
+ @Override
public int hashCode() {
- return fValue.hashCode();
- }
+ return fValue.hashCode();
+ }
- /**
- * Returns the variable that this value was created for.
- *
- * @return The variable that this value was created for.
- *
- * @since 3.5
- */
- public PDAVariable getVariable() {
- return fVariable;
- }
+ /**
+ * Returns the variable that this value was created for.
+ *
+ * @return The variable that this value was created for.
+ *
+ * @since 3.5
+ */
+ public PDAVariable getVariable() {
+ return fVariable;
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
index afe1d7f9c..4db49c209 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
@@ -49,7 +49,7 @@ public class PDAVariable extends PDADebugElement implements IVariable {
@Override
public IValue getValue() throws DebugException {
PDACommandResult result = sendCommand(new PDAVarCommand(
- fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName()));
+ fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName()));
return new PDAValue(this, result.fResponseText);
}
@@ -70,8 +70,8 @@ public class PDAVariable extends PDADebugElement implements IVariable {
@Override
public void setValue(String expression) throws DebugException {
- sendCommand(new PDASetVarCommand(
- fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName(), expression));
+ sendCommand(new PDASetVarCommand(
+ fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName(), expression));
fireChangeEvent(DebugEvent.CONTENT);
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
index 7f407eed0..6188ccddf 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
@@ -25,21 +25,21 @@ import java.util.StringTokenizer;
*/
public class PDABitFieldData {
- final public String fName;
- final public int fOffset;
- final public int fCount;
+ final public String fName;
+ final public int fOffset;
+ final public int fCount;
final public Map<String, String> fMnemonics;
- PDABitFieldData(String bitFieldString) {
- StringTokenizer st = new StringTokenizer(bitFieldString, " "); //$NON-NLS-1$
+ PDABitFieldData(String bitFieldString) {
+ StringTokenizer st = new StringTokenizer(bitFieldString, " "); //$NON-NLS-1$
- fName = st.nextToken();
- fOffset = Integer.parseInt(st.nextToken());
- fCount = Integer.parseInt(st.nextToken());
+ fName = st.nextToken();
+ fOffset = Integer.parseInt(st.nextToken());
+ fCount = Integer.parseInt(st.nextToken());
fMnemonics = new LinkedHashMap<>(0);
- while (st.hasMoreTokens()) {
- fMnemonics.put(st.nextToken(), st.nextToken());
- }
- }
+ while (st.hasMoreTokens()) {
+ fMnemonics.put(st.nextToken(), st.nextToken());
+ }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
index 4ae78a10b..f85431b7c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
@@ -28,12 +28,12 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAChildrenCommand extends PDACommand {
- public PDAChildrenCommand(int threadId, int frameId, String name ) {
- super("children " + threadId + " " + frameId + " " + name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public PDAChildrenCommand(int threadId, int frameId, String name ) {
+ super("children " + threadId + " " + frameId + " " + name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDAListResult(resultText);
- }
+ return new PDAListResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
index ceb16884f..45a383b38 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
@@ -25,12 +25,12 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAClearBreakpointCommand extends PDACommand {
- public PDAClearBreakpointCommand(int line) {
- super("clear " + line); //$NON-NLS-1$
- }
+ public PDAClearBreakpointCommand(int line) {
+ super("clear " + line); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java
index cb2ea671c..b04f388a9 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java
@@ -20,24 +20,24 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
abstract public class PDACommand {
- final private String fRequest;
+ final private String fRequest;
- public PDACommand(String request) {
- fRequest = request;
- }
+ public PDACommand(String request) {
+ fRequest = request;
+ }
- /**
- * Returns the request to be sent to PDA.
- */
- public String getRequest() {
- return fRequest;
- }
+ /**
+ * Returns the request to be sent to PDA.
+ */
+ public String getRequest() {
+ return fRequest;
+ }
- /**
- * Returns the command result based on the given PDA response. This command
- * uses the class type parameter as the return type to allow the compiler to
- * enforce the correct command result. This class must be implemented by
- * each command to create the concrete result type.
- */
- abstract public PDACommandResult createResult(String resultText);
+ /**
+ * Returns the command result based on the given PDA response. This command
+ * uses the class type parameter as the return type to allow the compiler to
+ * enforce the correct command result. This class must be implemented by
+ * each command to create the concrete result type.
+ */
+ abstract public PDACommandResult createResult(String resultText);
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java
index 6b0ff76d4..9e8977111 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java
@@ -22,9 +22,9 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDACommandResult {
- final public String fResponseText;
+ final public String fResponseText;
- public PDACommandResult(String response) {
- fResponseText = response;
- }
+ public PDACommandResult(String response) {
+ fResponseText = response;
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
index 5742e4bdd..326eed9cc 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
@@ -29,12 +29,12 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDADataCommand extends PDACommand {
- public PDADataCommand(int threadId) {
- super("data " + threadId); //$NON-NLS-1$
- }
+ public PDADataCommand(int threadId) {
+ super("data " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDAListResult(resultText);
- }
+ return new PDAListResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
index 2ff3fc140..e768055cb 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
@@ -38,12 +38,12 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDADropFrameCommand extends PDACommand {
- public PDADropFrameCommand(int threadId) {
- super("drop " + threadId); //$NON-NLS-1$
- }
+ public PDADropFrameCommand(int threadId) {
+ super("drop " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
index b0d019574..7307b709c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
@@ -37,12 +37,12 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAEvalCommand extends PDACommand {
- public PDAEvalCommand(int threadId, String operation) {
- super("eval " + threadId + " " + operation); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public PDAEvalCommand(int threadId, String operation) {
+ super("eval " + threadId + " " + operation); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java
index c3d27287b..b5ffe03fa 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java
@@ -23,14 +23,14 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAEvalResultEvent extends PDAEvent {
- public final String fResult;
+ public final String fResult;
- public PDAEvalResultEvent(String message) {
- super(message);
- fResult = message.substring(getName(message).length() + 1);
- }
+ public PDAEvalResultEvent(String message) {
+ super(message);
+ fResult = message.substring(getName(message).length() + 1);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("evalresult"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("evalresult"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java
index c65642e2c..484339209 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java
@@ -17,62 +17,62 @@ package org.eclipse.debug.examples.core.pda.protocol;
* Base class for PDA events.
*/
public class PDAEvent {
- public final String fMessage;
- public final String fName;
+ public final String fMessage;
+ public final String fName;
- public PDAEvent(String message) {
- fMessage = message;
- fName = getName(message);
- }
+ public PDAEvent(String message) {
+ fMessage = message;
+ fName = getName(message);
+ }
- protected String getName(String message) {
- int nameEnd = message.indexOf(' ');
- nameEnd = nameEnd == -1 ? message.length() : nameEnd;
- return message.substring(0, nameEnd);
- }
+ protected String getName(String message) {
+ int nameEnd = message.indexOf(' ');
+ nameEnd = nameEnd == -1 ? message.length() : nameEnd;
+ return message.substring(0, nameEnd);
+ }
- public static PDAEvent parseEvent(String message) {
- if (PDAEvalResultEvent.isEventMessage(message)) {
- return new PDAEvalResultEvent(message);
- }
- else if (PDAExitedEvent.isEventMessage(message)) {
- return new PDAExitedEvent(message);
- }
- else if (PDANoSuchLabelEvent.isEventMessage(message)) {
- return new PDANoSuchLabelEvent(message);
- }
- else if (PDARegistersEvent.isEventMessage(message)) {
- return new PDARegistersEvent(message);
- }
- else if (PDAResumedEvent.isEventMessage(message)) {
- return new PDAResumedEvent(message);
- }
- else if (PDAStartedEvent.isEventMessage(message)) {
- return new PDAStartedEvent(message);
- }
- else if (PDASuspendedEvent.isEventMessage(message)) {
- return new PDASuspendedEvent(message);
- }
- else if (PDATerminatedEvent.isEventMessage(message)) {
- return new PDATerminatedEvent(message);
- }
- else if (PDAUnimplementedInstructionEvent.isEventMessage(message)) {
- return new PDAUnimplementedInstructionEvent(message);
- }
- else if (PDAVMResumedEvent.isEventMessage(message)) {
- return new PDAVMResumedEvent(message);
- }
- else if (PDAVMStartedEvent.isEventMessage(message)) {
- return new PDAVMStartedEvent(message);
- }
- else if (PDAVMSuspendedEvent.isEventMessage(message)) {
- return new PDAVMSuspendedEvent(message);
- }
- else if (PDAExitedEvent.isEventMessage(message)) {
- return new PDAExitedEvent(message);
- }
- else {
- return new PDAEvent(message);
- }
- }
+ public static PDAEvent parseEvent(String message) {
+ if (PDAEvalResultEvent.isEventMessage(message)) {
+ return new PDAEvalResultEvent(message);
+ }
+ else if (PDAExitedEvent.isEventMessage(message)) {
+ return new PDAExitedEvent(message);
+ }
+ else if (PDANoSuchLabelEvent.isEventMessage(message)) {
+ return new PDANoSuchLabelEvent(message);
+ }
+ else if (PDARegistersEvent.isEventMessage(message)) {
+ return new PDARegistersEvent(message);
+ }
+ else if (PDAResumedEvent.isEventMessage(message)) {
+ return new PDAResumedEvent(message);
+ }
+ else if (PDAStartedEvent.isEventMessage(message)) {
+ return new PDAStartedEvent(message);
+ }
+ else if (PDASuspendedEvent.isEventMessage(message)) {
+ return new PDASuspendedEvent(message);
+ }
+ else if (PDATerminatedEvent.isEventMessage(message)) {
+ return new PDATerminatedEvent(message);
+ }
+ else if (PDAUnimplementedInstructionEvent.isEventMessage(message)) {
+ return new PDAUnimplementedInstructionEvent(message);
+ }
+ else if (PDAVMResumedEvent.isEventMessage(message)) {
+ return new PDAVMResumedEvent(message);
+ }
+ else if (PDAVMStartedEvent.isEventMessage(message)) {
+ return new PDAVMStartedEvent(message);
+ }
+ else if (PDAVMSuspendedEvent.isEventMessage(message)) {
+ return new PDAVMSuspendedEvent(message);
+ }
+ else if (PDAExitedEvent.isEventMessage(message)) {
+ return new PDAExitedEvent(message);
+ }
+ else {
+ return new PDAEvent(message);
+ }
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
index c89eedd5a..f040a0869 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
@@ -36,18 +36,18 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAEventStopCommand extends PDACommand {
- public static final int UNIMPINSTR = 0;
- public static final int NOSUCHLABEL = 1;
+ public static final int UNIMPINSTR = 0;
+ public static final int NOSUCHLABEL = 1;
- public PDAEventStopCommand(int event, boolean enable) {
- super("eventstop " + //$NON-NLS-1$
- (event == UNIMPINSTR ? "unimpinstr " : "nosuchlabel ") + //$NON-NLS-1$ //$NON-NLS-2$
- (enable ? "1" : "0")); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public PDAEventStopCommand(int event, boolean enable) {
+ super("eventstop " + //$NON-NLS-1$
+ (event == UNIMPINSTR ? "unimpinstr " : "nosuchlabel ") + //$NON-NLS-1$ //$NON-NLS-2$
+ (enable ? "1" : "0")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java
index 66ed1e333..eb3c9c696 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java
@@ -23,11 +23,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAExitedEvent extends PDARunControlEvent {
- public PDAExitedEvent(String message) {
- super(message);
- }
+ public PDAExitedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("exited"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("exited"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
index dc72143ba..22b8e9bee 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
@@ -29,13 +29,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAFrameCommand extends PDACommand {
- public PDAFrameCommand(int threadId, int frameNum) {
- super("frame " + threadId + " " + frameNum); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public PDAFrameCommand(int threadId, int frameNum) {
+ super("frame " + threadId + " " + frameNum); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDAFrameCommandResult(resultText);
- }
+ return new PDAFrameCommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java
index 4db761741..48fe4aed2 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java
@@ -21,13 +21,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAFrameCommandResult extends PDACommandResult {
- /**
- * Frame data return by the frame command.
- */
- final public PDAFrameData fFrame;
+ /**
+ * Frame data return by the frame command.
+ */
+ final public PDAFrameData fFrame;
- PDAFrameCommandResult(String response) {
- super(response);
- fFrame = new PDAFrameData(response);
- }
+ PDAFrameCommandResult(String response) {
+ super(response);
+ fFrame = new PDAFrameData(response);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
index 4aa13dbdc..4ae645796 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
@@ -29,22 +29,22 @@ import org.eclipse.core.runtime.Path;
public class PDAFrameData {
- final public IPath fFilePath;
- final public int fPC;
- final public String fFunction;
- final public String[] fVariables;
+ final public IPath fFilePath;
+ final public int fPC;
+ final public String fFunction;
+ final public String[] fVariables;
- PDAFrameData(String frameString) {
- StringTokenizer st = new StringTokenizer(frameString, "|"); //$NON-NLS-1$
+ PDAFrameData(String frameString) {
+ StringTokenizer st = new StringTokenizer(frameString, "|"); //$NON-NLS-1$
- fFilePath = new Path(st.nextToken());
- fPC = Integer.parseInt(st.nextToken());
- fFunction = st.nextToken();
+ fFilePath = new Path(st.nextToken());
+ fPC = Integer.parseInt(st.nextToken());
+ fFunction = st.nextToken();
List<String> variablesList = new ArrayList<>();
- while (st.hasMoreTokens()) {
- variablesList.add(st.nextToken());
- }
- fVariables = variablesList.toArray(new String[variablesList.size()]);
- }
+ while (st.hasMoreTokens()) {
+ variablesList.add(st.nextToken());
+ }
+ fVariables = variablesList.toArray(new String[variablesList.size()]);
+ }
} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
index 9ff5b3425..f5a3b606c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
@@ -26,13 +26,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAGroupsCommand extends PDACommand {
- public PDAGroupsCommand() {
- super("groups"); //$NON-NLS-1$
- }
+ public PDAGroupsCommand() {
+ super("groups"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDAListResult(resultText);
- }
+ return new PDAListResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
index 67d3ab73c..11c5092be 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
@@ -25,23 +25,23 @@ import java.util.StringTokenizer;
public class PDAListResult extends PDACommandResult {
- final public String[] fValues;
+ final public String[] fValues;
- PDAListResult(String response) {
- super(response);
- StringTokenizer st = new StringTokenizer(response, "|"); //$NON-NLS-1$
+ PDAListResult(String response) {
+ super(response);
+ StringTokenizer st = new StringTokenizer(response, "|"); //$NON-NLS-1$
List<String> valuesList = new ArrayList<>();
- while (st.hasMoreTokens()) {
- String token = st.nextToken();
- if (token.length() != 0) {
- valuesList.add(token);
- }
- }
-
- fValues = new String[valuesList.size()];
- for (int i = 0; i < valuesList.size(); i++) {
- fValues[i] = valuesList.get(i);
- }
- }
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if (token.length() != 0) {
+ valuesList.add(token);
+ }
+ }
+
+ fValues = new String[valuesList.size()];
+ for (int i = 0; i < valuesList.size(); i++) {
+ fValues[i] = valuesList.get(i);
+ }
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
index 5d14047e6..48748cd3c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
@@ -24,22 +24,22 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDANoSuchLabelEvent extends PDAEvent {
- public final String fLabel;
+ public final String fLabel;
- public PDANoSuchLabelEvent(String message) {
- super(message);
- fLabel = message.substring(getName(message).length() + 1);
- }
+ public PDANoSuchLabelEvent(String message) {
+ super(message);
+ fLabel = message.substring(getName(message).length() + 1);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("no such label"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("no such label"); //$NON-NLS-1$
+ }
- @Override
+ @Override
protected String getName(String message) {
- if (isEventMessage(message)) {
- return "no such label"; //$NON-NLS-1$
- }
- throw new IllegalArgumentException("Invalid event: " + message); //$NON-NLS-1$
- }
+ if (isEventMessage(message)) {
+ return "no such label"; //$NON-NLS-1$
+ }
+ throw new IllegalArgumentException("Invalid event: " + message); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
index 56f7c78fd..e719a19cd 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
@@ -28,12 +28,12 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAPopDataCommand extends PDACommand {
- public PDAPopDataCommand(int threadId) {
- super("popdata " + threadId); //$NON-NLS-1$
- }
+ public PDAPopDataCommand(int threadId) {
+ super("popdata " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
index 8c54a975d..6045881e4 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
@@ -29,13 +29,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAPushDataCommand extends PDACommand {
- public PDAPushDataCommand(int threadId, String value) {
- super("pushdata " + threadId + " " + value); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public PDAPushDataCommand(int threadId, String value) {
+ super("pushdata " + threadId + " " + value); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
index c8fa66162..e071d4768 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
@@ -26,22 +26,22 @@ import java.util.StringTokenizer;
public class PDARegisterData {
- final public String fName;
- final public boolean fWritable;
- final public PDABitFieldData[] fBitFields;
+ final public String fName;
+ final public boolean fWritable;
+ final public PDABitFieldData[] fBitFields;
- PDARegisterData(String regString) {
- StringTokenizer st = new StringTokenizer(regString, "|"); //$NON-NLS-1$
+ PDARegisterData(String regString) {
+ StringTokenizer st = new StringTokenizer(regString, "|"); //$NON-NLS-1$
- String regInfo = st.nextToken();
- StringTokenizer regSt = new StringTokenizer(regInfo, " "); //$NON-NLS-1$
- fName = regSt.nextToken();
- fWritable = Boolean.getBoolean(regSt.nextToken());
+ String regInfo = st.nextToken();
+ StringTokenizer regSt = new StringTokenizer(regInfo, " "); //$NON-NLS-1$
+ fName = regSt.nextToken();
+ fWritable = Boolean.getBoolean(regSt.nextToken());
List<PDABitFieldData> bitFieldsList = new ArrayList<>();
- while (st.hasMoreTokens()) {
- bitFieldsList.add(new PDABitFieldData(st.nextToken()));
- }
- fBitFields = bitFieldsList.toArray(new PDABitFieldData[bitFieldsList.size()]);
- }
+ while (st.hasMoreTokens()) {
+ bitFieldsList.add(new PDABitFieldData(st.nextToken()));
+ }
+ fBitFields = bitFieldsList.toArray(new PDABitFieldData[bitFieldsList.size()]);
+ }
} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
index 19ff4a04b..94a094305 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
@@ -26,13 +26,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDARegistersCommand extends PDACommand {
- public PDARegistersCommand(String group) {
- super("registers " + group); //$NON-NLS-1$
- }
+ public PDARegistersCommand(String group) {
+ super("registers " + group); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDARegistersCommandResult(resultText);
- }
+ return new PDARegistersCommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
index e0b5bbbbb..ff092ecc7 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
@@ -25,19 +25,19 @@ import java.util.StringTokenizer;
public class PDARegistersCommandResult extends PDACommandResult {
- /**
- * Array of registers returned by the registers commands.
- */
- final public PDARegisterData[] fRegisters;
+ /**
+ * Array of registers returned by the registers commands.
+ */
+ final public PDARegisterData[] fRegisters;
- PDARegistersCommandResult(String response) {
- super(response);
- StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$
+ PDARegistersCommandResult(String response) {
+ super(response);
+ StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$
List<PDARegisterData> regList = new ArrayList<>();
- while (st.hasMoreTokens()) {
- regList.add(new PDARegisterData(st.nextToken()));
- }
- fRegisters = regList.toArray(new PDARegisterData[regList.size()]);
- }
+ while (st.hasMoreTokens()) {
+ regList.add(new PDARegisterData(st.nextToken()));
+ }
+ fRegisters = regList.toArray(new PDARegisterData[regList.size()]);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java
index 9be258251..a0a4a7486 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java
@@ -24,11 +24,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDARegistersEvent extends PDAEvent {
- public PDARegistersEvent(String message) {
- super(message);
- }
+ public PDARegistersEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("registers"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("registers"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
index 448aa89db..75c766345 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
@@ -28,13 +28,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDARestartCommand extends PDACommand {
- public PDARestartCommand() {
- super("restart"); //$NON-NLS-1$
- }
+ public PDARestartCommand() {
+ super("restart"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
index be6b1660f..d0be2eb9f 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
@@ -33,13 +33,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAResumeCommand extends PDACommand {
- public PDAResumeCommand(int threadId) {
- super("resume " + threadId); //$NON-NLS-1$
- }
+ public PDAResumeCommand(int threadId) {
+ super("resume " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java
index bea022c9d..29b95ed53 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java
@@ -23,11 +23,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAResumedEvent extends PDARunControlEvent {
- public PDAResumedEvent(String message) {
- super(message);
- }
+ public PDAResumedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("resumed"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("resumed"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
index dc99a8fee..c98e75257 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
@@ -20,55 +20,55 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDARunControlEvent extends PDAEvent {
- public final int fThreadId;
- public final String fReason;
+ public final int fThreadId;
+ public final String fReason;
- public PDARunControlEvent(String message) {
- super(message);
- fThreadId = getThreadId(message);
- fReason = getStateChangeReason(message);
- }
+ public PDARunControlEvent(String message) {
+ super(message);
+ fThreadId = getThreadId(message);
+ fReason = getStateChangeReason(message);
+ }
- protected int getThreadId(String message) {
- int nameEnd = getName(message).length();
- if ( Character.isDigit(message.charAt(nameEnd + 1)) ) {
- int threadIdEnd = message.indexOf(' ', nameEnd + 1);
- threadIdEnd = threadIdEnd == -1 ? message.length() : threadIdEnd;
- try {
- return Integer.parseInt(message.substring(nameEnd + 1, threadIdEnd));
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid event: " + message); //$NON-NLS-1$
- }
- } else {
- return -1;
- }
- }
+ protected int getThreadId(String message) {
+ int nameEnd = getName(message).length();
+ if ( Character.isDigit(message.charAt(nameEnd + 1)) ) {
+ int threadIdEnd = message.indexOf(' ', nameEnd + 1);
+ threadIdEnd = threadIdEnd == -1 ? message.length() : threadIdEnd;
+ try {
+ return Integer.parseInt(message.substring(nameEnd + 1, threadIdEnd));
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Invalid event: " + message); //$NON-NLS-1$
+ }
+ } else {
+ return -1;
+ }
+ }
- protected String getStateChangeReason(String message) {
- int idx = getName(message).length();
- if ( Character.isDigit(message.charAt(idx + 1)) ) {
- idx = message.indexOf(' ', idx + 1);
- idx = idx == -1 ? message.length() : idx + 1;
- } else {
- idx++;
- }
- if (idx >= message.length()) {
- return ""; //$NON-NLS-1$
- }
+ protected String getStateChangeReason(String message) {
+ int idx = getName(message).length();
+ if ( Character.isDigit(message.charAt(idx + 1)) ) {
+ idx = message.indexOf(' ', idx + 1);
+ idx = idx == -1 ? message.length() : idx + 1;
+ } else {
+ idx++;
+ }
+ if (idx >= message.length()) {
+ return ""; //$NON-NLS-1$
+ }
- int endIdx = message.indexOf(' ', idx);
- endIdx = endIdx == -1 ? message.length() : endIdx;
- return message.substring(idx, endIdx);
- }
+ int endIdx = message.indexOf(' ', idx);
+ endIdx = endIdx == -1 ? message.length() : endIdx;
+ return message.substring(idx, endIdx);
+ }
- @Override
+ @Override
protected String getName(String message) {
- int nameEnd = message.indexOf(' ');
- nameEnd = nameEnd == -1 ? message.length() : nameEnd;
- return message.substring(0, nameEnd);
- }
+ int nameEnd = message.indexOf(' ');
+ nameEnd = nameEnd == -1 ? message.length() : nameEnd;
+ return message.substring(0, nameEnd);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("started"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("started"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
index df8e6e44f..54706916b 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
@@ -37,15 +37,15 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDASetBreakpointCommand extends PDACommand {
- public PDASetBreakpointCommand(int line, boolean stopVM) {
- super("set " + //$NON-NLS-1$
- line + " " + //$NON-NLS-1$
- (stopVM ? "1" : "0")); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public PDASetBreakpointCommand(int line, boolean stopVM) {
+ super("set " + //$NON-NLS-1$
+ line + " " + //$NON-NLS-1$
+ (stopVM ? "1" : "0")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
index 2273a4456..2a30eb7b2 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
@@ -29,13 +29,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDASetDataCommand extends PDACommand {
- public PDASetDataCommand(int threadId, int index, String value) {
- super("setdata " + threadId + " " + index + " " + value); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public PDASetDataCommand(int threadId, int index, String value) {
+ super("setdata " + threadId + " " + index + " " + value); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
index 504fbda4b..a813906cb 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
@@ -31,13 +31,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDASetVarCommand extends PDACommand {
- public PDASetVarCommand(int threadId, int frame, String variable, String value) {
- super("setvar " + threadId + " " + frame + " " + variable + " " + value); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
+ public PDASetVarCommand(int threadId, int frame, String variable, String value) {
+ super("setvar " + threadId + " " + frame + " " + variable + " " + value); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
index 2a3300a6f..6c4206551 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
@@ -32,13 +32,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAStackCommand extends PDACommand {
- public PDAStackCommand(int threadId) {
- super("stack " + threadId); //$NON-NLS-1$
- }
+ public PDAStackCommand(int threadId) {
+ super("stack " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDAStackCommandResult(resultText);
- }
+ return new PDAStackCommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
index be6db7343..9a1774603 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
@@ -25,20 +25,20 @@ import java.util.StringTokenizer;
public class PDAStackCommandResult extends PDACommandResult {
- /**
- * Array of frames return by the stack commands. The frames are ordered
- * with the highest-level frame first.
- */
- final public PDAFrameData[] fFrames;
+ /**
+ * Array of frames return by the stack commands. The frames are ordered
+ * with the highest-level frame first.
+ */
+ final public PDAFrameData[] fFrames;
- PDAStackCommandResult(String response) {
- super(response);
- StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$
+ PDAStackCommandResult(String response) {
+ super(response);
+ StringTokenizer st = new StringTokenizer(response, "#"); //$NON-NLS-1$
List<PDAFrameData> framesList = new ArrayList<>();
- while (st.hasMoreTokens()) {
- framesList.add(new PDAFrameData(st.nextToken()));
- }
- fFrames = framesList.toArray(new PDAFrameData[framesList.size()]);
- }
+ while (st.hasMoreTokens()) {
+ framesList.add(new PDAFrameData(st.nextToken()));
+ }
+ fFrames = framesList.toArray(new PDAFrameData[framesList.size()]);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
index 2a6f777e5..53a00a699 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
@@ -29,13 +29,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAStackDepthCommand extends PDACommand {
- public PDAStackDepthCommand(int threadId) {
- super("stackdepth " + threadId); //$NON-NLS-1$
- }
+ public PDAStackDepthCommand(int threadId) {
+ super("stackdepth " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDAStackDepthCommandResult(resultText);
- }
+ return new PDAStackDepthCommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java
index 9688c76a7..267d7d466 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java
@@ -21,14 +21,14 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAStackDepthCommandResult extends PDACommandResult {
- final public int fDepth;
+ final public int fDepth;
- PDAStackDepthCommandResult(String response) {
- super(response);
- int depth = 1; // default to something that won't cause NPEs
- try {
- depth = Integer.parseInt(response);
- } catch (NumberFormatException e) {}
- fDepth = depth;
- }
+ PDAStackDepthCommandResult(String response) {
+ super(response);
+ int depth = 1; // default to something that won't cause NPEs
+ try {
+ depth = Integer.parseInt(response);
+ } catch (NumberFormatException e) {}
+ fDepth = depth;
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java
index 993785c76..1fa2402df 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java
@@ -24,11 +24,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAStartedEvent extends PDARunControlEvent {
- public PDAStartedEvent(String message) {
- super(message);
- }
+ public PDAStartedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("started"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("started"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
index 071128324..947cbe899 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
@@ -38,13 +38,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAStepCommand extends PDACommand {
- public PDAStepCommand(int threadId) {
- super("step " + threadId); //$NON-NLS-1$
- }
+ public PDAStepCommand(int threadId) {
+ super("step " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
index 3b4f5c775..a927178b4 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
@@ -39,13 +39,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAStepReturnCommand extends PDACommand {
- public PDAStepReturnCommand(int threadId) {
- super("stepreturn " + threadId); //$NON-NLS-1$
- }
+ public PDAStepReturnCommand(int threadId) {
+ super("stepreturn " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
index 85502dac8..1059e7240 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
@@ -33,13 +33,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDASuspendCommand extends PDACommand {
- public PDASuspendCommand(int threadId) {
- super("suspend " + threadId); //$NON-NLS-1$
- }
+ public PDASuspendCommand(int threadId) {
+ super("suspend " + threadId); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java
index 18c99af38..575515132 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java
@@ -37,11 +37,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDASuspendedEvent extends PDARunControlEvent {
- public PDASuspendedEvent(String message) {
- super(message);
- }
+ public PDASuspendedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("suspended"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("suspended"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
index 542e86512..7e18f5e7c 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
@@ -27,13 +27,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDATerminateCommand extends PDACommand {
- public PDATerminateCommand() {
- super("terminate"); //$NON-NLS-1$
- }
+ public PDATerminateCommand() {
+ super("terminate"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java
index 52d92a569..d9b5831f1 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java
@@ -23,11 +23,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDATerminatedEvent extends PDAEvent {
- public PDATerminatedEvent(String message) {
- super(message);
- }
+ public PDATerminatedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("terminated"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("terminated"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
index 645348415..16ec91c05 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
@@ -25,22 +25,22 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAUnimplementedInstructionEvent extends PDAEvent {
- public final String fOperation;
+ public final String fOperation;
- public PDAUnimplementedInstructionEvent(String message) {
- super(message);
- fOperation = message.substring(getName(message).length() + 1);
- }
+ public PDAUnimplementedInstructionEvent(String message) {
+ super(message);
+ fOperation = message.substring(getName(message).length() + 1);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("unimplemented instruction"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("unimplemented instruction"); //$NON-NLS-1$
+ }
- @Override
+ @Override
protected String getName(String message) {
- if (isEventMessage(message)) {
- return "unimplemented instruction"; //$NON-NLS-1$
- }
- throw new IllegalArgumentException("Invalid event: " + message); //$NON-NLS-1$
- }
+ if (isEventMessage(message)) {
+ return "unimplemented instruction"; //$NON-NLS-1$
+ }
+ throw new IllegalArgumentException("Invalid event: " + message); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
index cfd3d5b9d..13e8b182f 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
@@ -30,13 +30,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAVMResumeCommand extends PDACommand {
- public PDAVMResumeCommand() {
- super("vmresume"); //$NON-NLS-1$
- }
+ public PDAVMResumeCommand() {
+ super("vmresume"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java
index 752254edd..ae927989e 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java
@@ -30,11 +30,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAVMResumedEvent extends PDARunControlEvent {
- public PDAVMResumedEvent(String message) {
- super(message);
- }
+ public PDAVMResumedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmresumed"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("vmresumed"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java
index b784bff87..dd9747aa6 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java
@@ -24,11 +24,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAVMStartedEvent extends PDAEvent {
- public PDAVMStartedEvent(String message) {
- super(message);
- }
+ public PDAVMStartedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmstarted"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("vmstarted"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
index bfbc90863..75304a55b 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
@@ -30,13 +30,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAVMSuspendCommand extends PDACommand {
- public PDAVMSuspendCommand() {
- super("vmsuspend"); //$NON-NLS-1$
- }
+ public PDAVMSuspendCommand() {
+ super("vmsuspend"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java
index 96ca3ec5d..df7860fb6 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java
@@ -38,11 +38,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAVMSuspendedEvent extends PDARunControlEvent {
- public PDAVMSuspendedEvent(String message) {
- super(message);
- }
+ public PDAVMSuspendedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmsuspended"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("vmsuspended"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java
index fcbe52580..63ade7796 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java
@@ -22,11 +22,11 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAVMTerminatedEvent extends PDAEvent {
- public PDAVMTerminatedEvent(String message) {
- super(message);
- }
+ public PDAVMTerminatedEvent(String message) {
+ super(message);
+ }
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmterminated"); //$NON-NLS-1$
- }
+ public static boolean isEventMessage(String message) {
+ return message.startsWith("vmterminated"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
index f39347a33..91e07a0ec 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
@@ -32,13 +32,13 @@ package org.eclipse.debug.examples.core.pda.protocol;
public class PDAVarCommand extends PDACommand {
- public PDAVarCommand(int threadId, int frameId, String name) {
- super("var " + threadId + " " + frameId + " " + name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public PDAVarCommand(int threadId, int frameId, String name) {
+ super("var " + threadId + " " + frameId + " " + name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
index a681e873e..64ebbb300 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
@@ -31,18 +31,18 @@ package org.eclipse.debug.examples.core.pda.protocol;
*/
public class PDAWatchCommand extends PDACommand {
- public static final int READ = 1;
- public static final int WRITE = 2;
- public static final int BOTH = READ | WRITE;
- public static final int NONE = 0;
+ public static final int READ = 1;
+ public static final int WRITE = 2;
+ public static final int BOTH = READ | WRITE;
+ public static final int NONE = 0;
- public PDAWatchCommand(String function, String variable, int operation) {
- super("watch " + function+ "::" + variable + " " + operation); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ public PDAWatchCommand(String function, String variable, int operation) {
+ super("watch " + function+ "::" + variable + " " + operation); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
- @Override
+ @Override
public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
+ return new PDACommandResult(resultText);
+ }
}
diff --git a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
index 2bb17d2af..1a600ca28 100644
--- a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
+++ b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
@@ -73,25 +73,25 @@ public class PreProcessor extends Task {
public PreProcessor() {
}
- /**
- * Adds a set of files to process.
- *
- * @param set a set of files to process
- */
- public void addFileset(FileSet set) {
- fFileSets.addElement(set);
- }
+ /**
+ * Adds a set of files to process.
+ *
+ * @param set a set of files to process
+ */
+ public void addFileset(FileSet set) {
+ fFileSets.addElement(set);
+ }
- /**
- * Sets the destination directory for processed files.
- *
- * @param destDir destination directory for processed files
- */
- public void setDestdir(File destDir) {
- fDestDir = destDir;
- }
+ /**
+ * Sets the destination directory for processed files.
+ *
+ * @param destDir destination directory for processed files
+ */
+ public void setDestdir(File destDir) {
+ fDestDir = destDir;
+ }
- /**
+ /**
* Sets the symbols that are "on" for the preprocessing.
*
* @param symbols symbols that are "on" for the preprocessing
@@ -283,7 +283,7 @@ public class PreProcessor extends Task {
}
}
- public static void main(String[] args) {
+ public static void main(String[] args) {
PreProcessor processor = new PreProcessor();
processor.setSymbols("ex2"); //$NON-NLS-1$
String string = processor.preProcessFile(new File("c:\\eclipse3.1\\dev\\example.debug.core\\src\\example\\debug\\core\\launcher\\PDALaunchDelegate.java"), "//#"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java
index e50d90bf9..664ab17ca 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java
@@ -49,15 +49,15 @@ public class ControlCellModifier implements ICellModifier {
@Override
public void modify(Object element, String property, Object value) {
Object oldValue = getValue(element, property);
- if (!value.equals(oldValue)) {
- if (SequencerColumnPresentation.COL_VALUE.equals(property)) {
+ if (!value.equals(oldValue)) {
+ if (SequencerColumnPresentation.COL_VALUE.equals(property)) {
if (element instanceof SequencerControl) {
if (value instanceof String) {
SequencerControl control = (SequencerControl) element;
control.setValue((String) value);
}
}
- }
+ }
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java
index be482366d..66d18e20a 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java
@@ -47,10 +47,10 @@ public class DebugUIPlugin extends AbstractUIPlugin {
private final static String ICONS_PATH = "icons/full/";//$NON-NLS-1$
private final static String PATH_OBJECT = ICONS_PATH + "obj16/"; //Model object icons //$NON-NLS-1$
- private final static String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //Enabled local toolbar icons //$NON-NLS-1$
- private final static String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; //Disabled local toolbar icons //$NON-NLS-1$
+ private final static String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //Enabled local toolbar icons //$NON-NLS-1$
+ private final static String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; //Disabled local toolbar icons //$NON-NLS-1$
- /**
+ /**
* The id of the plugin
*
* @since 1.4.200
@@ -62,31 +62,31 @@ public class DebugUIPlugin extends AbstractUIPlugin {
public final static String IMG_ELCL_POP = "IMG_ELCL_POP"; //$NON-NLS-1$
public final static String IMG_DLCL_POP = "IMG_DLCL_POP"; //$NON-NLS-1$
- /**
- * Toolbar action to push onto data stack
- */
+ /**
+ * Toolbar action to push onto data stack
+ */
public final static String IMG_ELCL_PUSH = "IMG_ELCL_PUSH"; //$NON-NLS-1$
public final static String IMG_DLCL_PUSH = "IMG_DLCL_PUSH"; //$NON-NLS-1$
- /**
- * PDA program image
- */
+ /**
+ * PDA program image
+ */
public final static String IMG_OBJ_PDA = "IMB_OBJ_PDA"; //$NON-NLS-1$
- /**
- * MIDI file image
- */
+ /**
+ * MIDI file image
+ */
public final static String IMG_OBJ_MIDI = "IMB_OBJ_MIDI"; //$NON-NLS-1$
- /**
- * Keyword color
- */
- public final static RGB KEYWORD = new RGB(0,0,255);
- public final static RGB LABEL = new RGB(128, 128, 0);
+ /**
+ * Keyword color
+ */
+ public final static RGB KEYWORD = new RGB(0,0,255);
+ public final static RGB LABEL = new RGB(128, 128, 0);
- /**
- * Managed colors
- */
+ /**
+ * Managed colors
+ */
private final Map<RGB, Color> fColors = new HashMap<>();
/**
@@ -118,10 +118,10 @@ public class DebugUIPlugin extends AbstractUIPlugin {
plugin = null;
resourceBundle = null;
Iterator<Entry<RGB, Color>> colors = fColors.entrySet().iterator();
- while (colors.hasNext()) {
- Entry<RGB, Color> entry = colors.next();
- entry.getValue().dispose();
- }
+ while (colors.hasNext()) {
+ Entry<RGB, Color> entry = colors.next();
+ entry.getValue().dispose();
+ }
}
/**
@@ -169,17 +169,17 @@ public class DebugUIPlugin extends AbstractUIPlugin {
declareImage(IMG_DLCL_PUSH, PATH_DLOCALTOOL + "push.gif"); //$NON-NLS-1$
}
- /**
- * Declares a workbench image given the path of the image file (relative to
- * the workbench plug-in). This is a helper method that creates the image
- * descriptor and passes it to the main <code>declareImage</code> method.
- *
- * @param symbolicName the symbolic name of the image
- * @param path the path of the image file relative to the base of the workbench
- * plug-ins install directory
- * <code>false</code> if this is not a shared image
- */
- private void declareImage(String key, String path) {
+ /**
+ * Declares a workbench image given the path of the image file (relative to
+ * the workbench plug-in). This is a helper method that creates the image
+ * descriptor and passes it to the main <code>declareImage</code> method.
+ *
+ * @param symbolicName the symbolic name of the image
+ * @param path the path of the image file relative to the base of the workbench
+ * plug-ins install directory
+ * <code>false</code> if this is not a shared image
+ */
+ private void declareImage(String key, String path) {
ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
Bundle bundle = Platform.getBundle(PLUGIN_ID);
URL url = null;
@@ -189,23 +189,23 @@ public class DebugUIPlugin extends AbstractUIPlugin {
desc = ImageDescriptor.createFromURL(url);
}
}
- getImageRegistry().put(key, desc);
- }
-
- /**
- * Returns the color described by the given RGB.
- *
- * @param rgb
- * @return color
- */
- public Color getColor(RGB rgb) {
- Color color = fColors.get(rgb);
- if (color == null) {
- color= new Color(Display.getCurrent(), rgb);
- fColors.put(rgb, color);
- }
- return color;
- }
+ getImageRegistry().put(key, desc);
+ }
+
+ /**
+ * Returns the color described by the given RGB.
+ *
+ * @param rgb
+ * @return color
+ */
+ public Color getColor(RGB rgb) {
+ Color color = fColors.get(rgb);
+ if (color == null) {
+ color= new Color(Display.getCurrent(), rgb);
+ fColors.put(rgb, color);
+ }
+ return color;
+ }
/**
* Returns the active workbench window
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
index 4698fa1b7..25a5ebb20 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
@@ -26,22 +26,22 @@ import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
*/
public class CommandAdapterFactory implements IAdapterFactory {
- private static IRestartHandler fgRestartHandler = new PDARestartDebugCommand();
+ private static IRestartHandler fgRestartHandler = new PDARestartDebugCommand();
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (IRestartHandler.class.equals(adapterType)) {
- if (adaptableObject instanceof PDADebugTarget) {
- return (T) fgRestartHandler;
- }
- }
- return null;
- }
+ if (IRestartHandler.class.equals(adapterType)) {
+ if (adaptableObject instanceof PDADebugTarget) {
+ return (T) fgRestartHandler;
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public Class<?>[] getAdapterList() {
- return new Class[]{IRestartHandler.class};
- }
+ return new Class[]{IRestartHandler.class};
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
index 2a13dce63..6c4b8fcc3 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
@@ -26,7 +26,7 @@ import org.eclipse.debug.ui.IDebugUIConstants;
public class PDADebugTargetContentProvider extends ElementContentProvider {
- @Override
+ @Override
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
PDAThread thread = ((PDADebugTarget) element).getThread(0);
if (thread != null) {
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
index 1a7ef09ba..86ac85ca9 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
@@ -27,34 +27,34 @@ import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
*/
public class PDARestartDebugCommand extends AbstractDebugCommand implements IRestartHandler {
- @Override
+ @Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
- for (int i = 0; i < targets.length; i++) {
- ((PDADebugTarget)targets[i]).restart();
- monitor.worked(1);
- }
- }
+ for (int i = 0; i < targets.length; i++) {
+ ((PDADebugTarget)targets[i]).restart();
+ monitor.worked(1);
+ }
+ }
- @Override
+ @Override
protected Object getTarget(Object element) {
- IDebugTarget target = (IDebugTarget)getAdapter(element, IDebugTarget.class);
- if (target instanceof PDADebugTarget) {
- return target;
- }
- return null;
- }
+ IDebugTarget target = (IDebugTarget)getAdapter(element, IDebugTarget.class);
+ if (target instanceof PDADebugTarget) {
+ return target;
+ }
+ return null;
+ }
- @Override
+ @Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
- for (int i = 0; i < targets.length; i++) {
- if (((PDADebugTarget)targets[i]).isTerminated()) {
- return false;
- }
- monitor.worked(1);
- }
- return true;
- }
+ throws CoreException
+ {
+ for (int i = 0; i < targets.length; i++) {
+ if (((PDADebugTarget)targets[i]).isTerminated()) {
+ return false;
+ }
+ monitor.worked(1);
+ }
+ return true;
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
index 1e38468de..99d6a2f7c 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
@@ -46,12 +46,12 @@ public class PDAThreadEventHandler extends DebugEventHandler {
@Override
protected void handleSuspend(DebugEvent event) {
- IThread thread = (IThread) event.getSource();
- int extras = IModelDelta.STATE;
- if (event.getDetail() == DebugEvent.BREAKPOINT | event.getDetail() == DebugEvent.CLIENT_REQUEST) {
- extras = IModelDelta.EXPAND;
- }
- fireDeltaUpdatingTopFrame(thread, IModelDelta.NO_CHANGE | extras);
+ IThread thread = (IThread) event.getSource();
+ int extras = IModelDelta.STATE;
+ if (event.getDetail() == DebugEvent.BREAKPOINT | event.getDetail() == DebugEvent.CLIENT_REQUEST) {
+ extras = IModelDelta.EXPAND;
+ }
+ fireDeltaUpdatingTopFrame(thread, IModelDelta.NO_CHANGE | extras);
}
private boolean isEqual(Object o1, Object o2) {
@@ -135,23 +135,23 @@ public class PDAThreadEventHandler extends DebugEventHandler {
ModelDelta delta = buildRootDelta();
ModelDelta node = addTarget(delta, thread);
synchronized (this) {
- IStackFrame prev = fPrev;
- IStackFrame frame = null;
+ IStackFrame prev = fPrev;
+ IStackFrame frame = null;
try {
frame = thread.getTopStackFrame();
} catch (DebugException e) {
}
- if (isEqual(frame, prev)) {
- node.setFlags(flags);
- } else {
+ if (isEqual(frame, prev)) {
+ node.setFlags(flags);
+ } else {
node.setFlags(flags | IModelDelta.CONTENT);
- }
- if (frame != null) {
- node.addNode(frame, 0, IModelDelta.STATE | IModelDelta.SELECT, 0);
- }
- fPrev = frame;
+ }
+ if (frame != null) {
+ node.addNode(frame, 0, IModelDelta.STATE | IModelDelta.SELECT, 0);
+ }
+ fPrev = frame;
}
- fireDelta(delta);
+ fireDelta(delta);
}
@Override
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
index 7a7b246a3..3e002de85 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
@@ -65,69 +65,69 @@ import org.eclipse.ui.texteditor.IUpdate;
*/
public class PDAVirtualFindAction extends Action implements IUpdate {
- private final TreeModelViewer fClientViewer;
+ private final TreeModelViewer fClientViewer;
protected class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
- private boolean fViewerUpdatesComplete = false;
- private boolean fLabelUpdatesComplete = false;
- private IProgressMonitor fProgressMonitor;
- private int fRemainingUpdatesCount = 0;
+ private boolean fViewerUpdatesComplete = false;
+ private boolean fLabelUpdatesComplete = false;
+ private IProgressMonitor fProgressMonitor;
+ private int fRemainingUpdatesCount = 0;
- @Override
+ @Override
public void labelUpdateStarted(ILabelUpdate update) {}
- @Override
+ @Override
public void labelUpdateComplete(ILabelUpdate update) {
- incrementProgress(1);
- }
- @Override
+ incrementProgress(1);
+ }
+ @Override
public void labelUpdatesBegin() {
- fLabelUpdatesComplete = false;
- }
- @Override
+ fLabelUpdatesComplete = false;
+ }
+ @Override
public void labelUpdatesComplete() {
- fLabelUpdatesComplete = true;
- completeProgress();
- }
+ fLabelUpdatesComplete = true;
+ completeProgress();
+ }
- @Override
+ @Override
public void updateStarted(IViewerUpdate update) {}
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {
- if (update instanceof IChildrenUpdate) {
- incrementProgress(((IChildrenUpdate)update).getLength());
- }
- }
- @Override
+ if (update instanceof IChildrenUpdate) {
+ incrementProgress(((IChildrenUpdate)update).getLength());
+ }
+ }
+ @Override
public void viewerUpdatesBegin() {
- fViewerUpdatesComplete = false;
- }
- @Override
+ fViewerUpdatesComplete = false;
+ }
+ @Override
public void viewerUpdatesComplete() {
- fViewerUpdatesComplete = true;
- completeProgress();
- }
-
- private void completeProgress() {
- IProgressMonitor pm;
- synchronized (this) {
- pm = fProgressMonitor;
- }
- if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
- pm.done();
- }
- }
-
- private void incrementProgress(int count) {
- IProgressMonitor pm;
- synchronized (this) {
- pm = fProgressMonitor;
- fRemainingUpdatesCount -= count;
- }
- if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
- pm.worked(count);
- }
- }
+ fViewerUpdatesComplete = true;
+ completeProgress();
+ }
+
+ private void completeProgress() {
+ IProgressMonitor pm;
+ synchronized (this) {
+ pm = fProgressMonitor;
+ }
+ if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
+ pm.done();
+ }
+ }
+
+ private void incrementProgress(int count) {
+ IProgressMonitor pm;
+ synchronized (this) {
+ pm = fProgressMonitor;
+ fRemainingUpdatesCount -= count;
+ }
+ if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
+ pm.worked(count);
+ }
+ }
}
@@ -136,21 +136,21 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
private final Map<VirtualItem, String> fTextCache = new HashMap<>();
public FindLabelProvider(VirtualTreeModelViewer viewer, List<VirtualItem> items) {
- fVirtualViewer = viewer;
- for (int i = 0; i < items.size(); i++) {
- VirtualItem item = items.get(i);
- fTextCache.put(item, fVirtualViewer.getText(item, 0));
- }
+ fVirtualViewer = viewer;
+ for (int i = 0; i < items.size(); i++) {
+ VirtualItem item = items.get(i);
+ fTextCache.put(item, fVirtualViewer.getText(item, 0));
+ }
}
@Override
public Image getImage(Object element) {
- return fVirtualViewer.getImage((VirtualItem) element, 0);
+ return fVirtualViewer.getImage((VirtualItem) element, 0);
}
@Override
public String getText(Object element) {
- return fTextCache.get(element);
+ return fTextCache.get(element);
}
}
@@ -159,64 +159,64 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
setId(DebugUIPlugin.getUniqueIdentifier() + ".FindElementAction"); //$NON-NLS-1$
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.FIND_ELEMENT_ACTION);
setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
- fClientViewer = (TreeModelViewer)((IDebugView)context.getPart()).getViewer();
+ fClientViewer = (TreeModelViewer)((IDebugView)context.getPart()).getViewer();
}
protected VirtualTreeModelViewer initVirtualViewer(TreeModelViewer clientViewer, VirtualViewerListener listener) {
- Object input = clientViewer.getInput();
- ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
- clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
- listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta);
- VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(
- clientViewer.getDisplay(),
- SWT.NONE,
- makeVirtualPresentationContext(clientViewer.getPresentationContext()));
- fVirtualViewer.addViewerUpdateListener(listener);
- fVirtualViewer.addLabelUpdateListener(listener);
- fVirtualViewer.setInput(input);
- if (fVirtualViewer.canToggleColumns()) {
- fVirtualViewer.setShowColumns(clientViewer.isShowColumns());
- }
- fVirtualViewer.updateViewer(stateDelta);
- return fVirtualViewer;
+ Object input = clientViewer.getInput();
+ ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
+ clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
+ listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta);
+ VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(
+ clientViewer.getDisplay(),
+ SWT.NONE,
+ makeVirtualPresentationContext(clientViewer.getPresentationContext()));
+ fVirtualViewer.addViewerUpdateListener(listener);
+ fVirtualViewer.addLabelUpdateListener(listener);
+ fVirtualViewer.setInput(input);
+ if (fVirtualViewer.canToggleColumns()) {
+ fVirtualViewer.setShowColumns(clientViewer.isShowColumns());
+ }
+ fVirtualViewer.updateViewer(stateDelta);
+ return fVirtualViewer;
}
protected IPresentationContext makeVirtualPresentationContext(final IPresentationContext clientViewerContext) {
- return new PresentationContext(clientViewerContext.getId()) {
+ return new PresentationContext(clientViewerContext.getId()) {
- {
- String[] clientProperties = clientViewerContext.getProperties();
- for (int i = 0; i < clientProperties.length; i++) {
- setProperty(clientProperties[i], clientViewerContext.getProperty(clientProperties[i]));
- }
+ {
+ String[] clientProperties = clientViewerContext.getProperties();
+ for (int i = 0; i < clientProperties.length; i++) {
+ setProperty(clientProperties[i], clientViewerContext.getProperty(clientProperties[i]));
+ }
- }
+ }
- @Override
+ @Override
public String[] getColumns() {
- String[] clientColumns = super.getColumns();
-
- if (clientColumns == null || clientColumns.length == 0) {
- // No columns are used.
- return null;
- }
-
- // Try to find the name column.
- for (int i = 0; i < clientColumns.length; i++) {
- if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(clientColumns[i])) {
- return new String[] { IDebugUIConstants.COLUMN_ID_VARIABLE_NAME };
- }
- }
-
- return new String[] { clientColumns[0] };
- }
- };
+ String[] clientColumns = super.getColumns();
+
+ if (clientColumns == null || clientColumns.length == 0) {
+ // No columns are used.
+ return null;
+ }
+
+ // Try to find the name column.
+ for (int i = 0; i < clientColumns.length; i++) {
+ if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(clientColumns[i])) {
+ return new String[] { IDebugUIConstants.COLUMN_ID_VARIABLE_NAME };
+ }
+ }
+
+ return new String[] { clientColumns[0] };
+ }
+ };
}
@Override
public void run() {
- final VirtualViewerListener listener = new VirtualViewerListener();
- VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);
+ final VirtualViewerListener listener = new VirtualViewerListener();
+ VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);
ProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(fClientViewer.getControl().getShell(), 500);
final IProgressMonitor monitor = dialog.getProgressMonitor();
@@ -224,23 +224,23 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
try {
dialog.run(
- true, true,
- new IRunnableWithProgress() {
- @Override
+ true, true,
+ new IRunnableWithProgress() {
+ @Override
public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException {
- synchronized(listener) {
- listener.fProgressMonitor = m;
- listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
- }
-
- while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) {
- Thread.sleep(1);
- }
- synchronized(listener) {
- listener.fProgressMonitor = null;
- }
- }
- });
+ synchronized(listener) {
+ listener.fProgressMonitor = m;
+ listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
+ }
+
+ while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) {
+ Thread.sleep(1);
+ }
+ synchronized(listener) {
+ listener.fProgressMonitor = null;
+ }
+ }
+ });
} catch (InvocationTargetException e) {
DebugUIPlugin.log(e);
return;
@@ -255,30 +255,30 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
FindLabelProvider labelProvider = new FindLabelProvider(virtualViewer, list);
VirtualItem result = performFind(list, labelProvider);
if (result != null) {
- setSelectionToClient(virtualViewer, labelProvider, result);
+ setSelectionToClient(virtualViewer, labelProvider, result);
}
}
- virtualViewer.removeLabelUpdateListener(listener);
- virtualViewer.removeViewerUpdateListener(listener);
- virtualViewer.dispose();
+ virtualViewer.removeLabelUpdateListener(listener);
+ virtualViewer.removeViewerUpdateListener(listener);
+ virtualViewer.dispose();
}
private int calcUpdatesCount(IModelDelta stateDelta) {
- final int[] count = new int[] {0};
- stateDelta.accept( new IModelDeltaVisitor() {
- @Override
+ final int[] count = new int[] {0};
+ stateDelta.accept( new IModelDeltaVisitor() {
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
- count[0] += delta.getChildCount();
- return true;
- }
- return false;
- }
- });
-
- // Double it to account for separate element and label update ticks.
- return count[0] * 2;
+ if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
+ count[0] += delta.getChildCount();
+ return true;
+ }
+ return false;
+ }
+ });
+
+ // Double it to account for separate element and label update ticks.
+ return count[0] * 2;
}
private void collectAllChildren(VirtualItem element, List<VirtualItem> collect) {
@@ -295,42 +295,42 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
protected VirtualItem performFind(List<VirtualItem> items, FindLabelProvider labelProvider) {
FindElementDialog dialog = new FindElementDialog(
- fClientViewer.getControl().getShell(),
- labelProvider,
- items.toArray());
+ fClientViewer.getControl().getShell(),
+ labelProvider,
+ items.toArray());
dialog.setTitle("PDA Variables View Find"); //$NON-NLS-1$
dialog.setMessage("&Specify an element to select (? = any character, * = any String):"); //$NON-NLS-1$
if (dialog.open() == Window.OK) {
Object[] elements = dialog.getResult();
if (elements.length == 1) {
- return (VirtualItem)elements[0];
+ return (VirtualItem)elements[0];
}
}
return null;
}
protected void setSelectionToClient(VirtualTreeModelViewer virtualViewer, ILabelProvider labelProvider, VirtualItem findItem) {
- virtualViewer.getTree().setSelection(new VirtualItem[] { findItem } );
- ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
- virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
- fClientViewer.updateViewer(stateDelta);
-
- ISelection selection = fClientViewer.getSelection();
- if (!selection.isEmpty() &&
- selection instanceof IStructuredSelection &&
- ((IStructuredSelection)selection).getFirstElement().equals(findItem.getData()) ) {
- } else {
- DebugUIPlugin.errorDialog(
- fClientViewer.getControl().getShell(),
+ virtualViewer.getTree().setSelection(new VirtualItem[] { findItem } );
+ ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
+ virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
+ fClientViewer.updateViewer(stateDelta);
+
+ ISelection selection = fClientViewer.getSelection();
+ if (!selection.isEmpty() &&
+ selection instanceof IStructuredSelection &&
+ ((IStructuredSelection)selection).getFirstElement().equals(findItem.getData()) ) {
+ } else {
+ DebugUIPlugin.errorDialog(
+ fClientViewer.getControl().getShell(),
"Error", //$NON-NLS-1$
"Could not select item:" + labelProvider.getText(findItem), //$NON-NLS-1$
new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Element no longer in viewer.")); //$NON-NLS-1$
- }
+ }
}
@Override
public void update() {
- setEnabled( fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0 );
+ setEnabled( fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0 );
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java
index fc617622e..3cdfcf5fb 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java
@@ -100,15 +100,15 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
@Override
public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
- if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
- ITextEditor editorPart = (ITextEditor)part;
- int lineNumber = ((ITextSelection)selection).getStartLine();
- IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
- String var = variableAndFunctionName[0];
- String fcn = variableAndFunctionName[1];
- toggleWatchpoint(resource, lineNumber, fcn, var, true, true);
- }
+ String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
+ if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
+ ITextEditor editorPart = (ITextEditor)part;
+ int lineNumber = ((ITextSelection)selection).getStartLine();
+ IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
+ String var = variableAndFunctionName[0];
+ String fcn = variableAndFunctionName[1];
+ toggleWatchpoint(resource, lineNumber, fcn, var, true, true);
+ }
}
@Override
@@ -117,25 +117,25 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
}
protected void toggleWatchpoint(IResource resource, int lineNumber, String fcn, String var, boolean access,
- boolean modification) throws CoreException
+ boolean modification) throws CoreException
{
- // look for existing watchpoint to delete
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DebugCorePlugin.ID_PDA_DEBUG_MODEL);
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- if (breakpoint instanceof PDAWatchpoint && resource.equals(breakpoint.getMarker().getResource())) {
- PDAWatchpoint watchpoint = (PDAWatchpoint)breakpoint;
- String otherVar = watchpoint.getVariableName();
- String otherFcn = watchpoint.getFunctionName();
- if (otherVar.equals(var) && otherFcn.equals(fcn)) {
- breakpoint.delete();
- return;
- }
- }
- }
- // create watchpoint
- PDAWatchpoint watchpoint = new PDAWatchpoint(resource, lineNumber + 1, fcn, var, access, modification);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(watchpoint);
+ // look for existing watchpoint to delete
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DebugCorePlugin.ID_PDA_DEBUG_MODEL);
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ if (breakpoint instanceof PDAWatchpoint && resource.equals(breakpoint.getMarker().getResource())) {
+ PDAWatchpoint watchpoint = (PDAWatchpoint)breakpoint;
+ String otherVar = watchpoint.getVariableName();
+ String otherFcn = watchpoint.getFunctionName();
+ if (otherVar.equals(var) && otherFcn.equals(fcn)) {
+ breakpoint.delete();
+ return;
+ }
+ }
+ }
+ // create watchpoint
+ PDAWatchpoint watchpoint = new PDAWatchpoint(resource, lineNumber + 1, fcn, var, access, modification);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(watchpoint);
}
/**
@@ -147,27 +147,27 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
* The array has two elements, the first is the variable name, the second is the function name.
*/
protected String[] getVariableAndFunctionName(IWorkbenchPart part, ISelection selection) {
- ITextEditor editor = getEditor(part);
- if (editor != null && selection instanceof ITextSelection) {
- ITextSelection textSelection = (ITextSelection) selection;
- IDocumentProvider documentProvider = editor.getDocumentProvider();
- try {
- documentProvider.connect(this);
- IDocument document = documentProvider.getDocument(editor.getEditorInput());
- IRegion region = document.getLineInformationOfOffset(textSelection.getOffset());
- String string = document.get(region.getOffset(), region.getLength()).trim();
+ ITextEditor editor = getEditor(part);
+ if (editor != null && selection instanceof ITextSelection) {
+ ITextSelection textSelection = (ITextSelection) selection;
+ IDocumentProvider documentProvider = editor.getDocumentProvider();
+ try {
+ documentProvider.connect(this);
+ IDocument document = documentProvider.getDocument(editor.getEditorInput());
+ IRegion region = document.getLineInformationOfOffset(textSelection.getOffset());
+ String string = document.get(region.getOffset(), region.getLength()).trim();
if (string.startsWith("var ")) { //$NON-NLS-1$
- String varName = string.substring(4).trim();
- String fcnName = getFunctionName(document, varName, document.getLineOfOffset(textSelection.getOffset()));
- return new String[] {varName, fcnName};
- }
- } catch (CoreException e) {
- } catch (BadLocationException e) {
- } finally {
- documentProvider.disconnect(this);
- }
- }
- return null;
+ String varName = string.substring(4).trim();
+ String fcnName = getFunctionName(document, varName, document.getLineOfOffset(textSelection.getOffset()));
+ return new String[] {varName, fcnName};
+ }
+ } catch (CoreException e) {
+ } catch (BadLocationException e) {
+ } finally {
+ documentProvider.disconnect(this);
+ }
+ }
+ return null;
}
/**
@@ -180,39 +180,39 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
* @return name of function defining the variable
*/
private String getFunctionName(IDocument document, String varName, int line) {
- // This is a simple guess at the function name - look for the labels preceeding
- // the variable definition, and then see if there are any 'calls' to that
- // label. If none, assumet the variable is in the "_main_" function
- String source = document.get();
- int lineIndex = line - 1;
- while (lineIndex >= 0) {
- try {
- IRegion information = document.getLineInformation(lineIndex);
- String lineText = document.get(information.getOffset(), information.getLength());
+ // This is a simple guess at the function name - look for the labels preceeding
+ // the variable definition, and then see if there are any 'calls' to that
+ // label. If none, assumet the variable is in the "_main_" function
+ String source = document.get();
+ int lineIndex = line - 1;
+ while (lineIndex >= 0) {
+ try {
+ IRegion information = document.getLineInformation(lineIndex);
+ String lineText = document.get(information.getOffset(), information.getLength());
if (lineText.startsWith(":")) { //$NON-NLS-1$
- String label = lineText.substring(1);
+ String label = lineText.substring(1);
if (source.contains("call " + label)) { //$NON-NLS-1$
- return label;
- }
- }
- lineIndex--;
- } catch (BadLocationException e) {
- }
- }
+ return label;
+ }
+ }
+ lineIndex--;
+ } catch (BadLocationException e) {
+ }
+ }
return "_main_"; //$NON-NLS-1$
}
- @Override
+ @Override
public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- if (canToggleWatchpoints(part, selection)) {
- toggleWatchpoints(part, selection);
- } else {
- toggleLineBreakpoints(part, selection);
- }
- }
+ if (canToggleWatchpoints(part, selection)) {
+ toggleWatchpoints(part, selection);
+ } else {
+ toggleLineBreakpoints(part, selection);
+ }
+ }
- @Override
+ @Override
public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
- return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
- }
+ return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java
index 438afa76c..277747887 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java
@@ -35,15 +35,15 @@ public class PDAEditorAdapterFactory implements IAdapterFactory {
if (resource != null) {
String extension = resource.getFileExtension();
if (extension != null && extension.equals("pda")) { //$NON-NLS-1$
- if (adapterType.equals(IToggleBreakpointsTarget.class)) {
+ if (adapterType.equals(IToggleBreakpointsTarget.class)) {
return (T) new PDABreakpointAdapter();
- }
+ }
//#ifdef ex7
//# // TODO: Exercise 7 - create run to line adapter
//#else
if (adapterType.equals(IRunToLineTarget.class)) {
return (T) new PDARunToLineAdapter();
- }
+ }
//#endif
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
index 1aef74728..0fe58af12 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
@@ -42,121 +42,121 @@ import org.eclipse.ui.texteditor.ITextEditor;
*/
public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter {
- final private boolean fAccessModeEnabled;
- final private boolean fModificationModeEnabled;
+ final private boolean fAccessModeEnabled;
+ final private boolean fModificationModeEnabled;
- PDAToggleWatchpointsTarget(boolean access, boolean modification) {
- fAccessModeEnabled = access;
- fModificationModeEnabled = modification;
- }
+ PDAToggleWatchpointsTarget(boolean access, boolean modification) {
+ fAccessModeEnabled = access;
+ fModificationModeEnabled = modification;
+ }
- @Override
+ @Override
public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
- if (super.canToggleWatchpoints(part, selection)) {
- return true;
- } else {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- return ss.getFirstElement() instanceof PDAVariable;
- }
- }
- return false;
- }
+ if (super.canToggleWatchpoints(part, selection)) {
+ return true;
+ } else {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ return ss.getFirstElement() instanceof PDAVariable;
+ }
+ }
+ return false;
+ }
@Override
public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
-
- if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
- // Selection inside text editor. Create a watchpoint based on
- // current source line.
- ITextEditor editorPart = (ITextEditor)part;
- int lineNumber = ((ITextSelection)selection).getStartLine();
- IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
- String var = variableAndFunctionName[0];
- String fcn = variableAndFunctionName[1];
- toggleWatchpoint(resource, lineNumber, fcn, var, fAccessModeEnabled, fModificationModeEnabled);
- } else if (selection instanceof IStructuredSelection &&
- ((IStructuredSelection)selection).getFirstElement() instanceof PDAVariable )
- {
- // Selection is inside a variables view. Create a watchpoint
- // using information from the variable. Retrieving information
- // from the model requires performing source lookup which should be
- // done on a background thread.
- final PDAVariable var = (PDAVariable)((IStructuredSelection)selection).getFirstElement();
- final PDAStackFrame frame = var.getStackFrame();
- final Shell shell = part.getSite().getShell();
+ String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
+
+ if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
+ // Selection inside text editor. Create a watchpoint based on
+ // current source line.
+ ITextEditor editorPart = (ITextEditor)part;
+ int lineNumber = ((ITextSelection)selection).getStartLine();
+ IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
+ String var = variableAndFunctionName[0];
+ String fcn = variableAndFunctionName[1];
+ toggleWatchpoint(resource, lineNumber, fcn, var, fAccessModeEnabled, fModificationModeEnabled);
+ } else if (selection instanceof IStructuredSelection &&
+ ((IStructuredSelection)selection).getFirstElement() instanceof PDAVariable )
+ {
+ // Selection is inside a variables view. Create a watchpoint
+ // using information from the variable. Retrieving information
+ // from the model requires performing source lookup which should be
+ // done on a background thread.
+ final PDAVariable var = (PDAVariable)((IStructuredSelection)selection).getFirstElement();
+ final PDAStackFrame frame = var.getStackFrame();
+ final Shell shell = part.getSite().getShell();
new Job("Toggle PDA Watchpoint") { //$NON-NLS-1$
- { setSystem(true); }
+ { setSystem(true); }
- @Override
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- try {
- IFile file = getResource(var.getStackFrame());
- String varName = var.getName();
- int line = findLine(file, varName);
- toggleWatchpoint(file, line, frame.getName(), varName,
- fAccessModeEnabled, fModificationModeEnabled);
- } catch (final CoreException e) {
- // Need to switch back to the UI thread to show the error
- // dialog.
+ try {
+ IFile file = getResource(var.getStackFrame());
+ String varName = var.getName();
+ int line = findLine(file, varName);
+ toggleWatchpoint(file, line, frame.getName(), varName,
+ fAccessModeEnabled, fModificationModeEnabled);
+ } catch (final CoreException e) {
+ // Need to switch back to the UI thread to show the error
+ // dialog.
new WorkbenchJob(shell.getDisplay(), "Toggle PDA Watchpoint") { //$NON-NLS-1$
- { setSystem(true); }
+ { setSystem(true); }
- @Override
+ @Override
public IStatus runInUIThread(IProgressMonitor submonitor) {
ErrorDialog.openError(shell, "Failed to create PDA watchpoint", "Failed to create PDA watchpoint.\n", e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
}
private IFile getResource(PDAStackFrame frame) {
- ISourceLocator locator = frame.getLaunch().getSourceLocator();
- Object sourceElement = locator.getSourceElement(frame);
- if (sourceElement instanceof IFile) {
- return (IFile)sourceElement;
- }
- return null;
+ ISourceLocator locator = frame.getLaunch().getSourceLocator();
+ Object sourceElement = locator.getSourceElement(frame);
+ if (sourceElement instanceof IFile) {
+ return (IFile)sourceElement;
+ }
+ return null;
}
private int findLine(IFile file, String var) throws CoreException {
- int lineNum = 0;
+ int lineNum = 0;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()))) {
- while(true) {
- String line = reader.readLine().trim();
+ while(true) {
+ String line = reader.readLine().trim();
if (line.startsWith("var")) { //$NON-NLS-1$
String varName = line.substring("var".length()).trim(); //$NON-NLS-1$
- if (varName.equals(var)) {
- break;
- }
- }
- lineNum++;
- }
- } catch (IOException e) {
- // end of file reached and line wasn't found
- return -1;
+ if (varName.equals(var)) {
+ break;
+ }
+ }
+ lineNum++;
+ }
+ } catch (IOException e) {
+ // end of file reached and line wasn't found
+ return -1;
}
return lineNum;
}
- @Override
+ @Override
public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- if (canToggleWatchpoints(part, selection)) {
- toggleWatchpoints(part, selection);
- } else {
- toggleLineBreakpoints(part, selection);
- }
- }
-
- @Override
+ if (canToggleWatchpoints(part, selection)) {
+ toggleWatchpoints(part, selection);
+ } else {
+ toggleLineBreakpoints(part, selection);
+ }
+ }
+
+ @Override
public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
- return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
- }
+ return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java
index c04f19c8c..3c363792a 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java
@@ -39,55 +39,55 @@ public class PDAToggleWatchpointsTargetFactory implements IToggleBreakpointsTarg
private final Map<String, IToggleBreakpointsTarget> fToggleWatchpointTargets = new HashMap<>(3);
- static {
- TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_BOTH);
- TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_ACCESS);
- TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_MODIFICATION);
- }
+ static {
+ TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_BOTH);
+ TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_ACCESS);
+ TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_MODIFICATION);
+ }
- @Override
+ @Override
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
- IToggleBreakpointsTarget target = fToggleWatchpointTargets.get(targetID);
- if (target == null) {
- if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
- target = new PDAToggleWatchpointsTarget(true, true);
- } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
- target = new PDAToggleWatchpointsTarget(true, false);
- } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
- target = new PDAToggleWatchpointsTarget(false, true);
- } else {
- return null;
- }
- fToggleWatchpointTargets.put(targetID, target);
- }
- return target;
- }
+ IToggleBreakpointsTarget target = fToggleWatchpointTargets.get(targetID);
+ if (target == null) {
+ if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
+ target = new PDAToggleWatchpointsTarget(true, true);
+ } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
+ target = new PDAToggleWatchpointsTarget(true, false);
+ } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
+ target = new PDAToggleWatchpointsTarget(false, true);
+ } else {
+ return null;
+ }
+ fToggleWatchpointTargets.put(targetID, target);
+ }
+ return target;
+ }
- @Override
+ @Override
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
- return TOGGLE_WATCHPOINT_TARGET_BOTH;
- }
+ return TOGGLE_WATCHPOINT_TARGET_BOTH;
+ }
- @Override
+ @Override
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
- return TOGGLE_WATCHPOINTS_TARGETS;
- }
+ return TOGGLE_WATCHPOINTS_TARGETS;
+ }
- @Override
+ @Override
public String getToggleTargetName(String targetID) {
- if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
+ if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
return "Watchpoints (Read/Write)"; //$NON-NLS-1$
- } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
+ } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
return "Watchpoints (Read)"; //$NON-NLS-1$
- } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
+ } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
return "Watchpoints (Write)"; //$NON-NLS-1$
- } else {
- return null;
- }
- }
+ } else {
+ return null;
+ }
+ }
- @Override
+ @Override
public String getToggleTargetDescription(String targetID) {
- return getToggleTargetName(targetID);
- }
+ return getToggleTargetName(targetID);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java
index c7b698bc9..85ea65334 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java
@@ -28,68 +28,68 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
public class PDAContentAssistProcessor implements IContentAssistProcessor {
- @Override
+ @Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- int index = offset - 1;
- StringBuilder prefix = new StringBuilder();
- IDocument document = viewer.getDocument();
- while (index > 0) {
- try {
- char prev = document.getChar(index);
- if (Character.isWhitespace(prev)) {
- break;
- }
- prefix.insert(0, prev);
- index--;
- } catch (BadLocationException e) {
- }
- }
+ int index = offset - 1;
+ StringBuilder prefix = new StringBuilder();
+ IDocument document = viewer.getDocument();
+ while (index > 0) {
+ try {
+ char prev = document.getChar(index);
+ if (Character.isWhitespace(prev)) {
+ break;
+ }
+ prefix.insert(0, prev);
+ index--;
+ } catch (BadLocationException e) {
+ }
+ }
List<CompletionProposal> proposals = new ArrayList<>();
- String[] keywords = PDAScanner.fgKeywords;
- if (prefix.length() > 0) {
- String word = prefix.toString();
- for (int i = 0; i < keywords.length; i++) {
- String keyword = keywords[i];
- if (keyword.startsWith(word) && word.length() < keyword.length()) {
+ String[] keywords = PDAScanner.fgKeywords;
+ if (prefix.length() > 0) {
+ String word = prefix.toString();
+ for (int i = 0; i < keywords.length; i++) {
+ String keyword = keywords[i];
+ if (keyword.startsWith(word) && word.length() < keyword.length()) {
proposals.add(new CompletionProposal(keyword + " ", index + 1, offset - (index + 1), keyword.length() + 1)); //$NON-NLS-1$
- }
- }
- } else {
- // propose all keywords
- for (int i = 0; i < keywords.length; i++) {
- String keyword = keywords[i];
+ }
+ }
+ } else {
+ // propose all keywords
+ for (int i = 0; i < keywords.length; i++) {
+ String keyword = keywords[i];
proposals.add(new CompletionProposal(keyword + " ", offset, 0, keyword.length() + 1)); //$NON-NLS-1$
- }
- }
- if (!proposals.isEmpty()) {
- return proposals.toArray(new ICompletionProposal[proposals.size()]);
- }
- return null;
- }
+ }
+ }
+ if (!proposals.isEmpty()) {
+ return proposals.toArray(new ICompletionProposal[proposals.size()]);
+ }
+ return null;
+ }
- @Override
+ @Override
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getErrorMessage() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java
index 396b362bd..67b543bdd 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java
@@ -23,24 +23,24 @@ import org.eclipse.swt.widgets.Shell;
public class PDAContentAssistant extends ContentAssistant {
- public PDAContentAssistant() {
- super();
+ public PDAContentAssistant() {
+ super();
- PDAContentAssistProcessor processor= new PDAContentAssistProcessor();
- setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
+ PDAContentAssistProcessor processor= new PDAContentAssistProcessor();
+ setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
- enableAutoActivation(false);
- enableAutoInsert(false);
+ enableAutoActivation(false);
+ enableAutoInsert(false);
- setInformationControlCreator(getInformationControlCreator());
- }
+ setInformationControlCreator(getInformationControlCreator());
+ }
- private IInformationControlCreator getInformationControlCreator() {
- return new IInformationControlCreator() {
- @Override
+ private IInformationControlCreator getInformationControlCreator() {
+ return new IInformationControlCreator() {
+ @Override
public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- };
- }
+ return new DefaultInformationControl(parent);
+ }
+ };
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java
index a11a0525c..8f1aa2745 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java
@@ -26,24 +26,24 @@ import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
*/
public class PDAEditor extends AbstractDecoratedTextEditor {
- /**
- * Creates a PDE editor
- */
- public PDAEditor() {
- super();
- setSourceViewerConfiguration(new PDASourceViewerConfiguration());
+ /**
+ * Creates a PDE editor
+ */
+ public PDAEditor() {
+ super();
+ setSourceViewerConfiguration(new PDASourceViewerConfiguration());
setRulerContextMenuId("pda.editor.rulerMenu"); //$NON-NLS-1$
setEditorContextMenuId("pda.editor.editorMenu"); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
protected void createActions() {
- super.createActions();
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.debug.examples.ui.pda.editor.PDAEditorMessages"); //$NON-NLS-1$
- IAction action = new ContentAssistAction(bundle, "ContentAssistProposal.", this); //$NON-NLS-1$
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", action); //$NON-NLS-1$
- }
+ super.createActions();
+ ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.debug.examples.ui.pda.editor.PDAEditorMessages"); //$NON-NLS-1$
+ IAction action = new ContentAssistAction(bundle, "ContentAssistProposal.", this); //$NON-NLS-1$
+ action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", action); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java
index 9573c4b16..aa586afe5 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java
@@ -28,60 +28,60 @@ import org.eclipse.jface.text.rules.WordRule;
*/
public class PDAScanner extends BufferedRuleBasedScanner {
- /**
- * PDA keywods
- */
- public static final String[] fgKeywords = new String[] {
+ /**
+ * PDA keywods
+ */
+ public static final String[] fgKeywords = new String[] {
"add", "branch_not_zero", "call", "dec", "dup", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"halt", "output", "pop", "push", "return", "var" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- };
+ };
- /**
- * Detects potential keywords
- */
- class PDAWordDetector implements IWordDetector {
+ /**
+ * Detects potential keywords
+ */
+ class PDAWordDetector implements IWordDetector {
- @Override
+ @Override
public boolean isWordStart(char c) {
- return Character.isLetter(c);
- }
+ return Character.isLetter(c);
+ }
- @Override
+ @Override
public boolean isWordPart(char c) {
- return Character.isLetter(c) || c == '_';
- }
- }
+ return Character.isLetter(c) || c == '_';
+ }
+ }
- /**
- * Detects PDA branch labels
- */
- class PDALabelDetector extends PDAWordDetector {
+ /**
+ * Detects PDA branch labels
+ */
+ class PDALabelDetector extends PDAWordDetector {
- @Override
+ @Override
public boolean isWordStart(char c) {
- return c == ':';
- }
+ return c == ':';
+ }
- @Override
+ @Override
public boolean isWordPart(char c) {
- return super.isWordPart(c) || Character.isDigit(c);
- }
- }
+ return super.isWordPart(c) || Character.isDigit(c);
+ }
+ }
- /**
- * Constructs a scanner that identifies PDA keywords.
- */
- public PDAScanner() {
- // keywords
- Token token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.KEYWORD)));
- WordRule keywords = new WordRule(new PDAWordDetector());
- for (int i = 0; i < fgKeywords.length; i++) {
- String keyword = fgKeywords[i];
- keywords.addWord(keyword, token);
- }
- // labels
- token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.LABEL)));
- WordRule labels = new WordRule(new PDALabelDetector(), token);
- setRules(new IRule[]{keywords, labels});
- }
+ /**
+ * Constructs a scanner that identifies PDA keywords.
+ */
+ public PDAScanner() {
+ // keywords
+ Token token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.KEYWORD)));
+ WordRule keywords = new WordRule(new PDAWordDetector());
+ for (int i = 0; i < fgKeywords.length; i++) {
+ String keyword = fgKeywords[i];
+ keywords.addWord(keyword, token);
+ }
+ // labels
+ token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.LABEL)));
+ WordRule labels = new WordRule(new PDALabelDetector(), token);
+ setRules(new IRule[]{keywords, labels});
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java
index 4149c23ff..bf99f3b7b 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java
@@ -29,30 +29,30 @@ import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
*/
public class PDASourceViewerConfiguration extends TextSourceViewerConfiguration {
- @Override
+ @Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- return new TextHover();
- }
+ return new TextHover();
+ }
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new AnnotationHover();
}
- @Override
+ @Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
- reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
- DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new PDAScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
- return reconciler;
- }
-
- @Override
+ PresentationReconciler reconciler = new PresentationReconciler();
+ reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new PDAScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ return reconciler;
+ }
+
+ @Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- return new PDAContentAssistant();
- }
+ return new PDAContentAssistant();
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java
index c0c6470a9..e84d3e81d 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java
@@ -33,58 +33,58 @@ import org.eclipse.jface.text.ITextViewer;
*/
public class TextHover implements ITextHover {
- @Override
+ @Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
- String varName = null;
- try {
- varName = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
- } catch (BadLocationException e) {
- return null;
- }
+ String varName = null;
+ try {
+ varName = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
+ } catch (BadLocationException e) {
+ return null;
+ }
if (varName.startsWith("$") && varName.length() > 1) { //$NON-NLS-1$
- varName = varName.substring(1);
- }
+ varName = varName.substring(1);
+ }
- PDAStackFrame frame = null;
- IAdaptable debugContext = DebugUITools.getDebugContext();
- if (debugContext instanceof PDAStackFrame) {
- frame = (PDAStackFrame) debugContext;
- } else if (debugContext instanceof PDAThread) {
- PDAThread thread = (PDAThread) debugContext;
- try {
- frame = (PDAStackFrame) thread.getTopStackFrame();
- } catch (DebugException e) {
- return null;
- }
- } else if (debugContext instanceof PDADebugTarget) {
- PDADebugTarget target = (PDADebugTarget) debugContext;
- try {
- IThread[] threads = target.getThreads();
- if (threads.length > 0) {
- frame = (PDAStackFrame) threads[0].getTopStackFrame();
- }
- } catch (DebugException e) {
- return null;
- }
- }
- if (frame != null) {
- try {
- IVariable[] variables = frame.getVariables();
- for (int i = 0; i < variables.length; i++) {
- IVariable variable = variables[i];
- if (variable.getName().equals(varName)) {
+ PDAStackFrame frame = null;
+ IAdaptable debugContext = DebugUITools.getDebugContext();
+ if (debugContext instanceof PDAStackFrame) {
+ frame = (PDAStackFrame) debugContext;
+ } else if (debugContext instanceof PDAThread) {
+ PDAThread thread = (PDAThread) debugContext;
+ try {
+ frame = (PDAStackFrame) thread.getTopStackFrame();
+ } catch (DebugException e) {
+ return null;
+ }
+ } else if (debugContext instanceof PDADebugTarget) {
+ PDADebugTarget target = (PDADebugTarget) debugContext;
+ try {
+ IThread[] threads = target.getThreads();
+ if (threads.length > 0) {
+ frame = (PDAStackFrame) threads[0].getTopStackFrame();
+ }
+ } catch (DebugException e) {
+ return null;
+ }
+ }
+ if (frame != null) {
+ try {
+ IVariable[] variables = frame.getVariables();
+ for (int i = 0; i < variables.length; i++) {
+ IVariable variable = variables[i];
+ if (variable.getName().equals(varName)) {
return varName + " = " + variable.getValue().getValueString(); //$NON-NLS-1$
- }
- }
- } catch (DebugException e) {
- }
- }
- return null;
- }
+ }
+ }
+ } catch (DebugException e) {
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
- return WordFinder.findWord(textViewer.getDocument(), offset);
- }
+ return WordFinder.findWord(textViewer.getDocument(), offset);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java
index 1b31bd097..5eab942fe 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java
@@ -25,14 +25,14 @@ import org.eclipse.jface.text.Region;
*/
public class WordFinder {
- /**
- * Returns the region in the given document that contains an identifier, or
- * <code>null</code> if none.
- *
- * @param document document to search
- * @param offset offset at which to look for an identifier
- * @return region containing an identifier, or <code>null</code>
- */
+ /**
+ * Returns the region in the given document that contains an identifier, or
+ * <code>null</code> if none.
+ *
+ * @param document document to search
+ * @param offset offset at which to look for an identifier
+ * @return region containing an identifier, or <code>null</code>
+ */
public static IRegion findWord(IDocument document, int offset) {
int start= -1;
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java
index 4d374ae29..d45df1a79 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java
@@ -35,42 +35,42 @@ import org.eclipse.ui.IEditorPart;
*/
public class PDALaunchShortcut implements ILaunchShortcut {
- @Override
+ @Override
public void launch(ISelection selection, String mode) {
- // must be a structured selection with one file selected
- IFile file = (IFile) ((IStructuredSelection)selection).getFirstElement();
+ // must be a structured selection with one file selected
+ IFile file = (IFile) ((IStructuredSelection)selection).getFirstElement();
- // check for an existing launch config for the pda file
- String path = file.getFullPath().toString();
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(DebugCorePlugin.ID_PDA_LAUNCH_CONFIGURATION_TYPE);
- try {
- ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(type);
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration configuration = configurations[i];
- String attribute = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
- if (path.equals(attribute)) {
- DebugUITools.launch(configuration, mode);
- return;
- }
- }
- } catch (CoreException e) {
- return;
- }
+ // check for an existing launch config for the pda file
+ String path = file.getFullPath().toString();
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(DebugCorePlugin.ID_PDA_LAUNCH_CONFIGURATION_TYPE);
+ try {
+ ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(type);
+ for (int i = 0; i < configurations.length; i++) {
+ ILaunchConfiguration configuration = configurations[i];
+ String attribute = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
+ if (path.equals(attribute)) {
+ DebugUITools.launch(configuration, mode);
+ return;
+ }
+ }
+ } catch (CoreException e) {
+ return;
+ }
- try {
- // create a new configuration for the pda file
- ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, file.getName());
- workingCopy.setAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, path);
- workingCopy.setMappedResources(new IResource[]{file});
- ILaunchConfiguration configuration = workingCopy.doSave();
- DebugUITools.launch(configuration, mode);
- } catch (CoreException e1) {
- }
- }
+ try {
+ // create a new configuration for the pda file
+ ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, file.getName());
+ workingCopy.setAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, path);
+ workingCopy.setMappedResources(new IResource[]{file});
+ ILaunchConfiguration configuration = workingCopy.doSave();
+ DebugUITools.launch(configuration, mode);
+ } catch (CoreException e1) {
+ }
+ }
- @Override
+ @Override
public void launch(IEditorPart editor, String mode) {
- }
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java
index 233661cef..72b9856b9 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java
@@ -48,36 +48,36 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
if (element instanceof PDADebugTarget) {
return getTargetText((PDADebugTarget)element);
} else if (element instanceof PDAThread) {
- return getThreadText((PDAThread)element);
- } else if (element instanceof PDAStackFrame) {
- return getStackFrameText((PDAStackFrame)element);
- } else if (element instanceof PDAWatchpoint) {
- return getWatchpointText((PDAWatchpoint)element);
- }
+ return getThreadText((PDAThread)element);
+ } else if (element instanceof PDAStackFrame) {
+ return getStackFrameText((PDAStackFrame)element);
+ } else if (element instanceof PDAWatchpoint) {
+ return getWatchpointText((PDAWatchpoint)element);
+ }
return null;
}
/**
* Returns a label for the given watchpoint.
*
- * @param watchpoint
- * @return a label for the given watchpoint
- */
- private String getWatchpointText(PDAWatchpoint watchpoint) {
- try {
+ * @param watchpoint
+ * @return a label for the given watchpoint
+ */
+ private String getWatchpointText(PDAWatchpoint watchpoint) {
+ try {
String label = watchpoint.getVariableName() + " (" + watchpoint.getFunctionName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- if (watchpoint.isAccess()) {
+ if (watchpoint.isAccess()) {
label += " [read]"; //$NON-NLS-1$
- }
- if (watchpoint.isModification()) {
+ }
+ if (watchpoint.isModification()) {
label += " [write]"; //$NON-NLS-1$
- }
- return label;
- } catch (CoreException e) {
- return null;
- }
- }
- /**
+ }
+ return label;
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+ /**
* Returns a label for the given debug target
*
* @param target debug target
@@ -87,11 +87,11 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
try {
String pgmPath = target.getLaunch().getLaunchConfiguration().getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
if (pgmPath != null) {
- IPath path = new Path(pgmPath);
+ IPath path = new Path(pgmPath);
String label = ""; //$NON-NLS-1$
- if (target.isTerminated()) {
+ if (target.isTerminated()) {
label = "<terminated>"; //$NON-NLS-1$
- }
+ }
return label + "PDA [" + path.lastSegment() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
} catch (CoreException e) {
@@ -107,11 +107,11 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
* @return a label for the given stack frame
*/
private String getStackFrameText(PDAStackFrame frame) {
- try {
+ try {
return frame.getName() + " (line: " + frame.getLineNumber() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- } catch (DebugException e) {
- }
- return null;
+ } catch (DebugException e) {
+ }
+ return null;
}
@@ -122,38 +122,38 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
* @return a label for the given thread
*/
private String getThreadText(PDAThread thread) {
- String label = thread.getName();
- if (thread.isStepping()) {
+ String label = thread.getName();
+ if (thread.isStepping()) {
label += " (stepping)"; //$NON-NLS-1$
- } else if (thread.isSuspended()) {
- IBreakpoint[] breakpoints = thread.getBreakpoints();
- if (breakpoints.length == 0) {
- if (thread.getError() == null) {
+ } else if (thread.isSuspended()) {
+ IBreakpoint[] breakpoints = thread.getBreakpoints();
+ if (breakpoints.length == 0) {
+ if (thread.getError() == null) {
label += " (suspended)"; //$NON-NLS-1$
- } else {
+ } else {
label += " (" + thread.getError() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- IBreakpoint breakpoint = breakpoints[0]; // there can only be one in PDA
- if (breakpoint instanceof PDALineBreakpoint) {
- PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint) breakpoint;
- if (pdaBreakpoint instanceof PDAWatchpoint) {
- try {
- PDAWatchpoint watchpoint = (PDAWatchpoint)pdaBreakpoint;
+ }
+ } else {
+ IBreakpoint breakpoint = breakpoints[0]; // there can only be one in PDA
+ if (breakpoint instanceof PDALineBreakpoint) {
+ PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint) breakpoint;
+ if (pdaBreakpoint instanceof PDAWatchpoint) {
+ try {
+ PDAWatchpoint watchpoint = (PDAWatchpoint)pdaBreakpoint;
label += " (watchpoint: " + watchpoint.getSuspendType() + " " + watchpoint.getVariableName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } catch (CoreException e) {
- }
- } else if (pdaBreakpoint.isRunToLineBreakpoint()) {
+ } catch (CoreException e) {
+ }
+ } else if (pdaBreakpoint.isRunToLineBreakpoint()) {
label += " (run to line)"; //$NON-NLS-1$
- } else {
+ } else {
label += " (suspended at line breakpoint)"; //$NON-NLS-1$
- }
- }
- }
- } else if (thread.isTerminated()) {
+ }
+ }
+ }
+ } else if (thread.isTerminated()) {
label = "<terminated> " + label; //$NON-NLS-1$
- }
- return label;
+ }
+ return label;
}
@Override
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java
index 5e73b59c2..7673f759f 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java
@@ -30,42 +30,42 @@ import org.eclipse.ui.handlers.HandlerUtil;
*/
abstract public class AbstractDataStackViewHandler extends AbstractHandler {
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
- if (part instanceof DataStackView) {
- DataStackView view = (DataStackView)part;
+ IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
+ if (part instanceof DataStackView) {
+ DataStackView view = (DataStackView)part;
- ISelection selection = DebugUITools.getDebugContextForEventChecked(event);
- if (selection instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)selection).getFirstElement();
+ ISelection selection = DebugUITools.getDebugContextForEventChecked(event);
+ if (selection instanceof IStructuredSelection) {
+ Object element = ((IStructuredSelection)selection).getFirstElement();
- PDAThread thread = null;
- if (element instanceof PDAThread) {
- thread = (PDAThread)element;
- } else if (element instanceof PDAStackFrame) {
- thread = (PDAThread)((PDAStackFrame)element).getThread();
- }
+ PDAThread thread = null;
+ if (element instanceof PDAThread) {
+ thread = (PDAThread)element;
+ } else if (element instanceof PDAStackFrame) {
+ thread = (PDAThread)((PDAStackFrame)element).getThread();
+ }
- if (element != null) {
- doExecute(
- view,
- thread,
- HandlerUtil.getCurrentSelectionChecked(event));
- }
- }
- } else {
+ if (element != null) {
+ doExecute(
+ view,
+ thread,
+ HandlerUtil.getCurrentSelectionChecked(event));
+ }
+ }
+ } else {
throw new ExecutionException("Handler must be with DataStackView only"); //$NON-NLS-1$
- }
- return null;
- }
+ }
+ return null;
+ }
- /**
- * Performs the actual handler operation.
- *
- * @param view The view that the handler was invoked in.
- * @param target The current active debug target.
- * @param selection The current selection in view.
- */
- abstract protected void doExecute(DataStackView view, PDAThread target, ISelection selection) throws ExecutionException;
+ /**
+ * Performs the actual handler operation.
+ *
+ * @param view The view that the handler was invoked in.
+ * @param target The current active debug target.
+ * @param selection The current selection in view.
+ */
+ abstract protected void doExecute(DataStackView view, PDAThread target, ISelection selection) throws ExecutionException;
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java
index b741227ce..d5dd6784d 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java
@@ -28,23 +28,23 @@ public class CanPushTester extends PropertyTester {
private static final String CAN_PUSH_PROPERTY = "canPush"; //$NON-NLS-1$
- @Override
+ @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (CAN_PUSH_PROPERTY.equals(property)) {
- if (receiver instanceof IAdaptable) {
+ if (CAN_PUSH_PROPERTY.equals(property)) {
+ if (receiver instanceof IAdaptable) {
PDADebugElement element = ((IAdaptable) receiver).getAdapter(PDADebugElement.class);
- PDAThread thread = null;
- if (element instanceof PDAThread) {
- thread = (PDAThread)element;
- } else if (element instanceof PDAStackFrame) {
- thread = (PDAThread)((PDAStackFrame)element).getThread();
- }
+ PDAThread thread = null;
+ if (element instanceof PDAThread) {
+ thread = (PDAThread)element;
+ } else if (element instanceof PDAStackFrame) {
+ thread = (PDAThread)((PDAStackFrame)element).getThread();
+ }
- if (thread != null) {
- return thread.canPushData();
- }
- }
- }
- return false;
- }
+ if (thread != null) {
+ return thread.canPushData();
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java
index 2f3250e7a..3b95d2909 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java
@@ -44,7 +44,7 @@ import org.eclipse.ui.progress.UIJob;
*/
public class DataStackView extends AbstractDebugView implements IDebugContextListener {
- private PDAThread fThread;
+ private PDAThread fThread;
class StackViewContentProvider implements ITreeContentProvider {
@@ -118,46 +118,46 @@ public class DataStackView extends AbstractDebugView implements IDebugContextLis
@Override
public void dispose() {
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
super.dispose();
}
@Override
public void debugContextChanged(final DebugContextEvent event) {
new UIJob(getSite().getShell().getDisplay(), "DataStackView update") { //$NON-NLS-1$
- {
- setSystem(true);
- }
+ {
+ setSystem(true);
+ }
- @Override
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (getViewer() != null) { // runs asynchronously, view may be disposed
- update(event.getContext());
- }
- return Status.OK_STATUS;
- }
- }.schedule();
+ if (getViewer() != null) { // runs asynchronously, view may be disposed
+ update(event.getContext());
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
}
- /**
- * Updates the view for the selected thread (if suspended)
- */
- private void update(ISelection context) {
- fThread = null;
-
- if (context instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)context).getFirstElement();
- if (element instanceof PDAThread) {
- fThread = (PDAThread)element;
- } else if (element instanceof PDAStackFrame) {
- fThread = (PDAThread)((PDAStackFrame)element).getThread();
- }
- }
+ /**
+ * Updates the view for the selected thread (if suspended)
+ */
+ private void update(ISelection context) {
+ fThread = null;
+
+ if (context instanceof IStructuredSelection) {
+ Object element = ((IStructuredSelection)context).getFirstElement();
+ if (element instanceof PDAThread) {
+ fThread = (PDAThread)element;
+ } else if (element instanceof PDAStackFrame) {
+ fThread = (PDAThread)((PDAStackFrame)element).getThread();
+ }
+ }
Object input = null;
if (fThread != null && fThread.isSuspended()) {
- input = fThread;
+ input = fThread;
}
getViewer().setInput(input);
getViewer().refresh();
- }
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java
index 5fccc4c1c..74274ca4b 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java
@@ -31,35 +31,35 @@ import org.eclipse.jface.viewers.TreeViewer;
*/
public class PopHandler extends AbstractDataStackViewHandler {
- @Override
+ @Override
protected void doExecute(DataStackView view, PDAThread thread, ISelection selection) throws ExecutionException {
- TreeViewer viewer = (TreeViewer)view.getViewer();
- Object popee = selection instanceof IStructuredSelection
- ? ((IStructuredSelection)selection).getFirstElement() : null;
- if (popee != null) {
- try {
- IValue[] stack = thread.getDataStack();
+ TreeViewer viewer = (TreeViewer)view.getViewer();
+ Object popee = selection instanceof IStructuredSelection
+ ? ((IStructuredSelection)selection).getFirstElement() : null;
+ if (popee != null) {
+ try {
+ IValue[] stack = thread.getDataStack();
List<IValue> restore = new ArrayList<>();
- for (int i = 0; i < stack.length; i++) {
- Object value = stack[i];
- if (popee.equals(value)) {
- // pop & stop
- thread.popData();
- break;
- } else {
- // remember value to push back on
- restore.add(thread.popData());
- }
- }
- while (!restore.isEmpty()) {
- IValue value = restore.remove(restore.size() - 1);
- thread.pushData(value.getValueString());
- }
- } catch (DebugException e) {
+ for (int i = 0; i < stack.length; i++) {
+ Object value = stack[i];
+ if (popee.equals(value)) {
+ // pop & stop
+ thread.popData();
+ break;
+ } else {
+ // remember value to push back on
+ restore.add(thread.popData());
+ }
+ }
+ while (!restore.isEmpty()) {
+ IValue value = restore.remove(restore.size() - 1);
+ thread.pushData(value.getValueString());
+ }
+ } catch (DebugException e) {
throw new ExecutionException("Failed to execute push command", e); //$NON-NLS-1$
- }
- viewer.refresh();
- }
- }
+ }
+ viewer.refresh();
+ }
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java
index 592c02c19..0dd182361 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java
@@ -26,17 +26,17 @@ import org.eclipse.jface.window.Window;
*/
public class PushHandler extends AbstractDataStackViewHandler {
- @Override
+ @Override
protected void doExecute(DataStackView view, PDAThread thread, ISelection selection) throws ExecutionException {
InputDialog dialog = new InputDialog(view.getSite().getShell(), "Specify Value", "Enter value to push", null, null); //$NON-NLS-1$ //$NON-NLS-2$
- if (dialog.open() == Window.OK) {
- try {
- thread.pushData(dialog.getValue());
- } catch (DebugException e) {
+ if (dialog.open() == Window.OK) {
+ try {
+ thread.pushData(dialog.getValue());
+ } catch (DebugException e) {
throw new ExecutionException("Failed to execute push command", e); //$NON-NLS-1$
- }
- }
- view.getViewer().refresh();
- }
+ }
+ }
+ view.getViewer().refresh();
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java
index d1858f09e..317599be1 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java
@@ -51,7 +51,7 @@ import junit.framework.Test;
import junit.framework.TestSuite;
/**
- * Tests for integration and nightly builds.
+ * Tests for integration and nightly builds.
*
* @since 3.6
*/
@@ -74,18 +74,18 @@ public class AutomatedSuite extends TestSuite {
addTest(new TestSuite(SourceLookupFacilityTests.class));
// BP tests
addTest(new TestSuite(BreakpointOrderingTests.class));
- // Note: jface viewer tests were moved out of nightly tests
- // due to frequent problems on nightly build machines.
- // (Bug 343308).
+ // Note: jface viewer tests were moved out of nightly tests
+ // due to frequent problems on nightly build machines.
+ // (Bug 343308).
// Virtual viewer tests
addTest(new TestSuite(VirtualViewerDeltaTests.class));
- addTest(new TestSuite(VirtualViewerContentTests.class));
+ addTest(new TestSuite(VirtualViewerContentTests.class));
addTest(new TestSuite(VirtualViewerLazyModeTests.class));
addTest(new TestSuite(VirtualViewerSelectionTests.class));
addTest(new TestSuite(VirtualViewerStateTests.class));
addTest(new TestSuite(VirtualViewerUpdateTests.class));
- addTest(new TestSuite(VirtualViewerFilterTests.class));
+ addTest(new TestSuite(VirtualViewerFilterTests.class));
// Viewer neutral tests
addTest(new TestSuite(FilterTransformTests.class));
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/LocalSuite.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/LocalSuite.java
index 4475e9fd1..58ef4f76a 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/LocalSuite.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/LocalSuite.java
@@ -55,9 +55,9 @@ public class LocalSuite extends TestSuite {
addTest(new TestSuite(JFaceViewerSelectionTests.class));
addTest(new TestSuite(JFaceViewerStateTests.class));
addTest(new TestSuite(JFaceViewerUpdateTests.class));
- addTest(new TestSuite(JFaceViewerLazyTests.class));
- addTest(new TestSuite(JFaceViewerTopIndexTests.class));
- addTest(new TestSuite(JFaceViewerFilterTests.class));
- addTest(new TestSuite(ColumnPresentationTests.class));
+ addTest(new TestSuite(JFaceViewerLazyTests.class));
+ addTest(new TestSuite(JFaceViewerTopIndexTests.class));
+ addTest(new TestSuite(JFaceViewerFilterTests.class));
+ addTest(new TestSuite(ColumnPresentationTests.class));
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java
index a18468823..4d44939fd 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java
@@ -26,24 +26,24 @@ import org.eclipse.debug.tests.viewer.model.VirtualViewerPerformanceTests;
*/
public class PerformanceSuite extends TestSuite {
- /**
- * Returns the suite. This is required to use the JUnit Launcher.
- *
- * @return the test suite
- */
- public static Test suite() {
- return new PerformanceSuite();
- }
+ /**
+ * Returns the suite. This is required to use the JUnit Launcher.
+ *
+ * @return the test suite
+ */
+ public static Test suite() {
+ return new PerformanceSuite();
+ }
- /**
- * Constructs the automated test suite. Adds all tests.
- */
- public PerformanceSuite() {
- // JFace viewer tests
- addTest(new TestSuite(JFaceViewerPerformanceTests.class));
+ /**
+ * Constructs the automated test suite. Adds all tests.
+ */
+ public PerformanceSuite() {
+ // JFace viewer tests
+ addTest(new TestSuite(JFaceViewerPerformanceTests.class));
- // Virtual viewer tests
- addTest(new TestSuite(VirtualViewerPerformanceTests.class));
- }
+ // Virtual viewer tests
+ addTest(new TestSuite(VirtualViewerPerformanceTests.class));
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
index 95ef799ea..11c32f86c 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
@@ -61,7 +61,7 @@ public class TestsPlugin extends AbstractUIPlugin {
}
/**
- * Returns the shared instance
+ * Returns the shared instance
*
* @return the shared instance
*/
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
index 6e89c9859..af364ea97 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java
@@ -227,16 +227,16 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* - Boolean2 = false
*/
protected ILaunchConfigurationWorkingCopy newConfiguration(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- assertTrue("Should support debug mode", type.supportsMode(ILaunchManager.DEBUG_MODE)); //$NON-NLS-1$
- assertTrue("Should support run mode", type.supportsMode(ILaunchManager.RUN_MODE)); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc = type.newInstance(container, name);
- wc.setAttribute("String1", "String1"); //$NON-NLS-1$ //$NON-NLS-2$
- wc.setAttribute("Int1", 1); //$NON-NLS-1$
- wc.setAttribute("Boolean1", true); //$NON-NLS-1$
- wc.setAttribute("Boolean2", false); //$NON-NLS-1$
- assertTrue("Should need saving", wc.isDirty()); //$NON-NLS-1$
- return wc;
+ ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
+ assertTrue("Should support debug mode", type.supportsMode(ILaunchManager.DEBUG_MODE)); //$NON-NLS-1$
+ assertTrue("Should support run mode", type.supportsMode(ILaunchManager.RUN_MODE)); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = type.newInstance(container, name);
+ wc.setAttribute("String1", "String1"); //$NON-NLS-1$ //$NON-NLS-2$
+ wc.setAttribute("Int1", 1); //$NON-NLS-1$
+ wc.setAttribute("Boolean1", true); //$NON-NLS-1$
+ wc.setAttribute("Boolean2", false); //$NON-NLS-1$
+ assertTrue("Should need saving", wc.isDirty()); //$NON-NLS-1$
+ return wc;
}
/**
@@ -244,10 +244,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* or shared, with no attributes
*/
protected ILaunchConfigurationWorkingCopy newEmptyConfiguration(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- ILaunchConfigurationWorkingCopy wc = type.newInstance(container, name);
+ ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
+ ILaunchConfigurationWorkingCopy wc = type.newInstance(container, name);
assertEquals("Should have no attributes", 0, wc.getAttributes().size()); //$NON-NLS-1$
- return wc;
+ return wc;
}
/**
@@ -259,16 +259,16 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* - Boolean2 = false
*/
protected ILaunchConfigurationWorkingCopy newPrototype(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- assertTrue("Should support debug mode", type.supportsMode(ILaunchManager.DEBUG_MODE)); //$NON-NLS-1$
- assertTrue("Should support run mode", type.supportsMode(ILaunchManager.RUN_MODE)); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc = type.newPrototypeInstance(container, name);
- wc.setAttribute("String1", "String1"); //$NON-NLS-1$ //$NON-NLS-2$
- wc.setAttribute("Int1", 1); //$NON-NLS-1$
- wc.setAttribute("Boolean1", true); //$NON-NLS-1$
- wc.setAttribute("Boolean2", false); //$NON-NLS-1$
- assertTrue("Should need saving", wc.isDirty()); //$NON-NLS-1$
- return wc;
+ ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
+ assertTrue("Should support debug mode", type.supportsMode(ILaunchManager.DEBUG_MODE)); //$NON-NLS-1$
+ assertTrue("Should support run mode", type.supportsMode(ILaunchManager.RUN_MODE)); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = type.newPrototypeInstance(container, name);
+ wc.setAttribute("String1", "String1"); //$NON-NLS-1$ //$NON-NLS-2$
+ wc.setAttribute("Int1", 1); //$NON-NLS-1$
+ wc.setAttribute("Boolean1", true); //$NON-NLS-1$
+ wc.setAttribute("Boolean2", false); //$NON-NLS-1$
+ assertTrue("Should need saving", wc.isDirty()); //$NON-NLS-1$
+ return wc;
}
/**
@@ -276,10 +276,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* or shared, with no attributes
*/
protected ILaunchConfigurationWorkingCopy newEmptyPrototype(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- ILaunchConfigurationWorkingCopy wc = type.newPrototypeInstance(container, name);
- assertEquals("Should have no attributes", 0, wc.getAttributes().size()); //$NON-NLS-1$
- return wc;
+ ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
+ ILaunchConfigurationWorkingCopy wc = type.newPrototypeInstance(container, name);
+ assertEquals("Should have no attributes", 0, wc.getAttributes().size()); //$NON-NLS-1$
+ return wc;
}
/**
@@ -302,25 +302,25 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testCreateLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertEquals("String1 should be String1", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Int1 should be 1", handle.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$//$NON-NLS-2$
+ // retrieve attributes
+ assertEquals("String1 should be String1", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Int1 should be 1", handle.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$//$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$//$NON-NLS-2$
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
+ // ensure new handle is the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
@@ -329,32 +329,32 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testLocalName() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "localName"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "localName"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertEquals("Wrong name", handle.getName(), "localName"); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertEquals("Wrong name", handle.getName(), "localName"); //$NON-NLS-1$ //$NON-NLS-2$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
* Creates a shared working copy configuration and tests is name.
*/
public void testSharedName() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "sharedName"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "sharedName"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertEquals("Wrong name", handle.getName(), "sharedName"); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertEquals("Wrong name", handle.getName(), "sharedName"); //$NON-NLS-1$ //$NON-NLS-2$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
@@ -362,22 +362,22 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testGetAttributes() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
Map<?, ?> attributes = handle.getAttributes();
- // retrieve attributes
- assertEquals("String1 should be String1", "String1", attributes.get("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Int1 should be 1", Integer.valueOf(1), attributes.get("Int1")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Boolean1 should be true", Boolean.TRUE, attributes.get("Boolean1")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Boolean2 should be false", Boolean.FALSE, attributes.get("Boolean2")); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertEquals("String1 should be String1", "String1", attributes.get("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("Int1 should be 1", Integer.valueOf(1), attributes.get("Int1")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Boolean1 should be true", Boolean.TRUE, attributes.get("Boolean1")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Boolean2 should be false", Boolean.FALSE, attributes.get("Boolean2")); //$NON-NLS-1$ //$NON-NLS-2$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
@@ -385,25 +385,25 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testSetAttributes() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
Map<String, Object> map = new HashMap<>();
- map.put("ATTR1", "ONE"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("ATTR2", "TWO"); //$NON-NLS-1$ //$NON-NLS-2$
- wc.setAttributes(map);
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+ map.put("ATTR1", "ONE"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("ATTR2", "TWO"); //$NON-NLS-1$ //$NON-NLS-2$
+ wc.setAttributes(map);
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
Map<?, ?> attributes = handle.getAttributes();
- assertEquals("should have two attributes", 2, attributes.size()); //$NON-NLS-1$
- // retrieve attributes
- assertEquals("ATTR1 should be ONE", "ONE", attributes.get("ATTR1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("ATTR2 should be TWO", "TWO", attributes.get("ATTR2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("should have two attributes", 2, attributes.size()); //$NON-NLS-1$
+ // retrieve attributes
+ assertEquals("ATTR1 should be ONE", "ONE", attributes.get("ATTR1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("ATTR2 should be TWO", "TWO", attributes.get("ATTR2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
@@ -411,18 +411,18 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testSetNullAttributes() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
- wc.setAttributes(null);
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
+ wc.setAttributes(null);
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
Map<?, ?> attributes = handle.getAttributes();
- assertEquals("should have no attributes", 0, attributes.size()); //$NON-NLS-1$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ assertEquals("should have no attributes", 0, attributes.size()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
@@ -432,39 +432,39 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testLocalCopy() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configToCopy"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configToCopy"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
+ // ensure new handle is the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy softCopy = handle.copy("CopyOf" + handle.getName()); //$NON-NLS-1$
- assertNull("Original in copy should be null", softCopy.getOriginal()); //$NON-NLS-1$
- ILaunchConfiguration hardCopy = softCopy.doSave();
+ ILaunchConfigurationWorkingCopy softCopy = handle.copy("CopyOf" + handle.getName()); //$NON-NLS-1$
+ assertNull("Original in copy should be null", softCopy.getOriginal()); //$NON-NLS-1$
+ ILaunchConfiguration hardCopy = softCopy.doSave();
- // retrieve attributes
- assertTrue("String1 should be String1", hardCopy.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", hardCopy.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", hardCopy.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !hardCopy.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", hardCopy.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", hardCopy.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", hardCopy.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !hardCopy.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Original should still exist", handle.exists()); //$NON-NLS-1$
+ assertTrue("Original should still exist", handle.exists()); //$NON-NLS-1$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- hardCopy.delete();
- assertTrue("Config should not exist after deletion", !hardCopy.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ hardCopy.delete();
+ assertTrue("Config should not exist after deletion", !hardCopy.exists()); //$NON-NLS-1$
}
/**
@@ -473,21 +473,21 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testDoubleSave() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configDoubleSave"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configDoubleSave"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // ensure new handle is the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
String name = wc.getName();
wc.rename("newName"); //$NON-NLS-1$
@@ -498,9 +498,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
ILaunchConfiguration[] newConfigs = getLaunchManager().getLaunchConfigurations();
assertTrue("Should be the same number of configs", newConfigs.length == configs.length); //$NON-NLS-1$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
@@ -511,24 +511,24 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testDeleteLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2delete"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- File file = wc.getLocation().toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2delete"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ File file = wc.getLocation().toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
- // delete
- handle.delete();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
+ // delete
+ handle.delete();
+ assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- // ensure handle is not in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should not exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
+ // ensure handle is not in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should not exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
}
/**
@@ -539,42 +539,42 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testRenameLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2rename"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // rename
- wc = handle.getWorkingCopy();
- wc.rename("config-2-rename"); //$NON-NLS-1$
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2rename"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // rename
+ wc = handle.getWorkingCopy();
+ wc.rename("config-2-rename"); //$NON-NLS-1$
+ addConfigListener();
+ ILaunchConfiguration newHandle = wc.doSave();
+ removeConfigListener();
+ assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
+ assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
+ assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
+
+ // retrieve new attributes
+ assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$//$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // ensure new handle is in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
+ assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
+
+ // cleanup
+ newHandle.delete();
+ assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
}
/**
@@ -582,42 +582,42 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testMoveLocalToSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2share"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // move
- wc = handle.getWorkingCopy();
- wc.setContainer(getProject());
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2share"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // move
+ wc = handle.getWorkingCopy();
+ wc.setContainer(getProject());
+ addConfigListener();
+ ILaunchConfiguration newHandle = wc.doSave();
+ removeConfigListener();
+ assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
+ assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
+ assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
+
+ // retrieve new attributes
+ assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // ensure new handle is in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
+ assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
+
+ // cleanup
+ newHandle.delete();
+ assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
}
/**
@@ -625,42 +625,42 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testMoveSharedToLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2local"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // move
- wc = handle.getWorkingCopy();
- wc.setContainer(null);
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2local"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // move
+ wc = handle.getWorkingCopy();
+ wc.setContainer(null);
+ addConfigListener();
+ ILaunchConfiguration newHandle = wc.doSave();
+ removeConfigListener();
+ assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
+ assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
+ assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
+
+ // retrieve new attributes
+ assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // ensure new handle is in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
+ assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
+
+ // cleanup
+ newHandle.delete();
+ assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
}
/**
@@ -669,23 +669,23 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testCreateSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
+ // ensure new handle is in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
@@ -695,37 +695,37 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testSharedCopy() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2Copy"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2Copy"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
+ // ensure new handle is in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
- // copy
- ILaunchConfigurationWorkingCopy softCopy = handle.copy("CopyOf" + handle.getName()); //$NON-NLS-1$
- ILaunchConfiguration hardCopy = softCopy.doSave();
+ // copy
+ ILaunchConfigurationWorkingCopy softCopy = handle.copy("CopyOf" + handle.getName()); //$NON-NLS-1$
+ ILaunchConfiguration hardCopy = softCopy.doSave();
- // retrieve attributes
- assertTrue("String1 should be String1", hardCopy.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", hardCopy.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", hardCopy.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !hardCopy.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", hardCopy.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", hardCopy.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", hardCopy.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !hardCopy.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Original should still exist", handle.exists()); //$NON-NLS-1$
+ assertTrue("Original should still exist", handle.exists()); //$NON-NLS-1$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- hardCopy.delete();
- assertTrue("Config should not exist after deletion", !hardCopy.exists()); //$NON-NLS-1$
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ hardCopy.delete();
+ assertTrue("Config should not exist after deletion", !hardCopy.exists()); //$NON-NLS-1$
}
@@ -736,23 +736,23 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testDeleteSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2delete"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2delete"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
- // delete
- handle.delete();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
+ // delete
+ handle.delete();
+ assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- // ensure handle is not in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should not exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
+ // ensure handle is not in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should not exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
}
/**
@@ -763,40 +763,40 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testRenameSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2rename"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // rename
- wc = handle.getWorkingCopy();
- wc.rename("shared-2-rename"); //$NON-NLS-1$
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2rename"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
+
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // rename
+ wc = handle.getWorkingCopy();
+ wc.rename("shared-2-rename"); //$NON-NLS-1$
+ addConfigListener();
+ ILaunchConfiguration newHandle = wc.doSave();
+ removeConfigListener();
+ assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
+ assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
+ assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
+
+ // retrieve new attributes
+ assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // ensure new handle is in the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
+ assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
+
+ // cleanup
+ newHandle.delete();
+ assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
}
/**
@@ -841,11 +841,11 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertTrue("Config should exist after openning", existsIn(after, before[i])); //$NON-NLS-1$
}
- // cleanup
- lc1.delete();
- assertTrue("Config should not exist after deletion", !lc1.exists()); //$NON-NLS-1$
- lc2.delete();
- assertTrue("Config should not exist after deletion", !lc2.exists()); //$NON-NLS-1$
+ // cleanup
+ lc1.delete();
+ assertTrue("Config should not exist after deletion", !lc1.exists()); //$NON-NLS-1$
+ lc2.delete();
+ assertTrue("Config should not exist after deletion", !lc2.exists()); //$NON-NLS-1$
}
@@ -858,9 +858,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
fFrom = getLaunchManager().getMovedFrom(configuration);
synchronized (fLock) {
- fAdded = configuration;
- fLock.notifyAll();
- }
+ fAdded = configuration;
+ fLock.notifyAll();
+ }
}
/**
@@ -877,9 +877,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
fTo = getLaunchManager().getMovedTo(configuration);
synchronized (fLock) {
- fRemoved = configuration;
- fLock.notifyAll();
- }
+ fRemoved = configuration;
+ fLock.notifyAll();
+ }
}
protected void addConfigListener() {
@@ -897,33 +897,33 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
*/
public void testDeleteProjectWithSharedConfig() throws Exception {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("DeleteSharedConfig"); //$NON-NLS-1$
- try {
- assertFalse("project should not exist yet", project.exists()); //$NON-NLS-1$
- project.create(null);
- assertTrue("project should now exist", project.exists()); //$NON-NLS-1$
- project.open(null);
- assertTrue("project should be open", project.isOpen()); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc = newConfiguration(project, "ToBeDeleted"); //$NON-NLS-1$
-
- addConfigListener();
- ILaunchConfiguration configuration = wc.doSave();
- assertEquals(configuration, fAdded);
-
- synchronized (fLock) {
- fRemoved = null;
- project.delete(true, false, null);
- if (fRemoved == null) {
- fLock.wait(10000);
- }
- }
- assertEquals(configuration, fRemoved);
- } finally {
- if (project.exists()) {
- project.delete(true, false, null);
- }
- removeConfigListener();
- }
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("DeleteSharedConfig"); //$NON-NLS-1$
+ try {
+ assertFalse("project should not exist yet", project.exists()); //$NON-NLS-1$
+ project.create(null);
+ assertTrue("project should now exist", project.exists()); //$NON-NLS-1$
+ project.open(null);
+ assertTrue("project should be open", project.isOpen()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(project, "ToBeDeleted"); //$NON-NLS-1$
+
+ addConfigListener();
+ ILaunchConfiguration configuration = wc.doSave();
+ assertEquals(configuration, fAdded);
+
+ synchronized (fLock) {
+ fRemoved = null;
+ project.delete(true, false, null);
+ if (fRemoved == null) {
+ fLock.wait(10000);
+ }
+ }
+ assertEquals(configuration, fRemoved);
+ } finally {
+ if (project.exists()) {
+ project.delete(true, false, null);
+ }
+ removeConfigListener();
+ }
}
/**
@@ -932,53 +932,53 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testNestedWorkingCopyLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config123"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertEquals("String1 should be String1", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Int1 should be 1", handle.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
-
- // get a working copy
- wc = handle.getWorkingCopy();
- ILaunchConfigurationWorkingCopy nested = wc.getWorkingCopy();
-
- // verify nested is same as original
- assertEquals("String1 should be String1", nested.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Int1 should be 1", nested.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", nested.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !nested.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // change an attribute in the nested working copy
- nested.setAttribute("String1", "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong attribute value", nested.getAttribute("String1", "Missing"), "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong attribute value", wc.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong attribute value", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // save back to parent
- ILaunchConfigurationWorkingCopy parent = nested.getParent();
- assertEquals("Wrong parent", wc, parent); //$NON-NLS-1$
- assertNull("Should have no parent", wc.getParent()); //$NON-NLS-1$
- nested.doSave();
- assertEquals("Wrong attribute value", wc.getAttribute("String1", "Missing"), "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong attribute value", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // check originals
- assertEquals("Wrong original config" , handle, wc.getOriginal()); //$NON-NLS-1$
- assertEquals("Wrong original config" , handle, nested.getOriginal()); //$NON-NLS-1$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config123"); //$NON-NLS-1$
+ IPath location = wc.getLocation();
+ ILaunchConfiguration handle = wc.doSave();
+ File file = location.toFile();
+ assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
+
+ // retrieve attributes
+ assertEquals("String1 should be String1", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Int1 should be 1", handle.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // ensure new handle is the index
+ ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
+ assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
+
+ // get a working copy
+ wc = handle.getWorkingCopy();
+ ILaunchConfigurationWorkingCopy nested = wc.getWorkingCopy();
+
+ // verify nested is same as original
+ assertEquals("String1 should be String1", nested.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Int1 should be 1", nested.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", nested.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !nested.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // change an attribute in the nested working copy
+ nested.setAttribute("String1", "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong attribute value", nested.getAttribute("String1", "Missing"), "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Wrong attribute value", wc.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Wrong attribute value", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ // save back to parent
+ ILaunchConfigurationWorkingCopy parent = nested.getParent();
+ assertEquals("Wrong parent", wc, parent); //$NON-NLS-1$
+ assertNull("Should have no parent", wc.getParent()); //$NON-NLS-1$
+ nested.doSave();
+ assertEquals("Wrong attribute value", wc.getAttribute("String1", "Missing"), "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Wrong attribute value", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ // check originals
+ assertEquals("Wrong original config" , handle, wc.getOriginal()); //$NON-NLS-1$
+ assertEquals("Wrong original config" , handle, nested.getOriginal()); //$NON-NLS-1$
+
+ // cleanup
+ handle.delete();
+ assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
}
/**
@@ -1000,11 +1000,11 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
ILaunchConfiguration handle = wc.doSave();
assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
// delete configuration
handle.delete();
@@ -1034,11 +1034,11 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
ILaunchConfiguration handle = wc.doSave();
assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
+ // retrieve attributes
+ assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
// cleanup
folder.delete(IResource.NONE, null);
@@ -1052,12 +1052,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
*/
public void testEFSProjectRename() throws Exception {
- // create test project
+ // create test project
IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("RenameEFS"); //$NON-NLS-1$
- if (pro.exists()) {
- pro.delete(true, true, null);
- }
- // create project
+ if (pro.exists()) {
+ pro.delete(true, true, null);
+ }
+ // create project
IProject project = TestsPlugin.createProject("RenameEFS"); //$NON-NLS-1$
IFileSystem fileSystem = EFS.getFileSystem("debug"); //$NON-NLS-1$
@@ -1116,19 +1116,19 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*/
public void testImport() throws Exception {
// create a shared configuration "Import4" in the workspace to be overwritten on import
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "Import4"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "Import4"); //$NON-NLS-1$
+ ILaunchConfiguration handle = wc.doSave();
+ assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
File dir = TestsPlugin.getDefault().getFileInPlugin(new Path("test-import")); //$NON-NLS-1$
assertTrue("Import directory does not exist", dir.exists()); //$NON-NLS-1$
- LaunchManager manager = (LaunchManager) getLaunchManager();
+ LaunchManager manager = (LaunchManager) getLaunchManager();
- Listener listener = new Listener();
- try {
- getLaunchManager().addLaunchConfigurationListener(listener);
- // import
- manager.importConfigurations(dir.listFiles(
+ Listener listener = new Listener();
+ try {
+ getLaunchManager().addLaunchConfigurationListener(listener);
+ // import
+ manager.importConfigurations(dir.listFiles(
new FileFilter() {
@Override
public boolean accept(File file) {
@@ -1139,17 +1139,17 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}),
null);
- // should be one removed
+ // should be one removed
List<ILaunchConfiguration> removed = listener.getRemoved();
assertEquals("Should be one removed config", 1, removed.size()); //$NON-NLS-1$
assertTrue("Import4 should be removed", removed.contains(handle)); //$NON-NLS-1$
- // should be 5 added
+ // should be 5 added
List<?> added = listener.getAdded();
assertEquals("Should be 5 added configs", 5, added.size()); //$NON-NLS-1$
Set<String> names = new HashSet<>();
Iterator<?> iterator = added.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
ILaunchConfiguration lc = (ILaunchConfiguration) iterator.next();
names.add(lc.getName());
}
@@ -1163,9 +1163,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
List<ILaunchConfiguration> changed = listener.getChanged();
assertEquals("Should be 1 changed config", 1, changed.size()); //$NON-NLS-1$
assertEquals("Wrong changed config", "Import4", changed.get(0).getName()); //$NON-NLS-1$ //$NON-NLS-2$
- } finally {
- manager.removeLaunchConfigurationListener(listener);
- }
+ } finally {
+ manager.removeLaunchConfigurationListener(listener);
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/DynamicRenderingBindings.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/DynamicRenderingBindings.java
index 2767477c1..a4e53f4ff 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/DynamicRenderingBindings.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/DynamicRenderingBindings.java
@@ -37,29 +37,29 @@ public class DynamicRenderingBindings extends AbstractMemoryRenderingBindingsPro
fgSingleton = this;
}
- /**
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getRenderingTypes(org.eclipse.debug.core.model.IMemoryBlock)
- */
- @Override
+ /**
+ * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getRenderingTypes(org.eclipse.debug.core.model.IMemoryBlock)
+ */
+ @Override
public IMemoryRenderingType[] getRenderingTypes(IMemoryBlock block) {
- return new IMemoryRenderingType[]{getPrimaryRenderingType(block)};
- }
+ return new IMemoryRenderingType[]{getPrimaryRenderingType(block)};
+ }
- /**
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getDefaultRenderingTypes(org.eclipse.debug.core.model.IMemoryBlock)
- */
- @Override
+ /**
+ * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getDefaultRenderingTypes(org.eclipse.debug.core.model.IMemoryBlock)
+ */
+ @Override
public IMemoryRenderingType[] getDefaultRenderingTypes(IMemoryBlock block) {
- return new IMemoryRenderingType[]{getPrimaryRenderingType(block)};
- }
+ return new IMemoryRenderingType[]{getPrimaryRenderingType(block)};
+ }
- /**
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getPrimaryRenderingType(org.eclipse.debug.core.model.IMemoryBlock)
- */
- @Override
+ /**
+ * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getPrimaryRenderingType(org.eclipse.debug.core.model.IMemoryBlock)
+ */
+ @Override
public IMemoryRenderingType getPrimaryRenderingType(IMemoryBlock block) {
- return DebugUITools.getMemoryRenderingManager().getRenderingType(fId);
- }
+ return DebugUITools.getMemoryRenderingManager().getRenderingType(fId);
+ }
/**
* Sets the current rendering bound to this provider, and notifies
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/MemoryRenderingTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/MemoryRenderingTests.java
index 98baa47a2..0fe5c99f6 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/MemoryRenderingTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/MemoryRenderingTests.java
@@ -67,55 +67,55 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
}
- public void testDefaultBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockOne();
- IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
+ public void testDefaultBinding() {
+ IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
+ IMemoryBlock block = new MemoryBlockOne();
+ IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
- public void testNoDefaultBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockTwo();
- IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
+ public void testNoDefaultBinding() {
+ IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
+ IMemoryBlock block = new MemoryBlockTwo();
+ IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
assertEquals("Wrong number of bindings", 0, types.length); //$NON-NLS-1$
- }
+ }
- public void testPrimaryBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockOne();
- IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
+ public void testPrimaryBinding() {
+ IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
+ IMemoryBlock block = new MemoryBlockOne();
+ IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
assertEquals("Wrong binding", "rendering_type_1", type.getId()); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
- public void testNoPrimaryBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockTwo();
- IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
+ public void testNoPrimaryBinding() {
+ IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
+ IMemoryBlock block = new MemoryBlockTwo();
+ IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
assertNull("Wrong binding", type); //$NON-NLS-1$
- }
+ }
- public void testDefaultWithoutPrimaryBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockThree();
- IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
+ public void testDefaultWithoutPrimaryBinding() {
+ IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
+ IMemoryBlock block = new MemoryBlockThree();
+ IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
assertEquals("Wrong binding", "rendering_type_3", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
- public void testDynamicBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockDynamic();
- IMemoryRenderingType[] types = manager.getRenderingTypes(block);
+ public void testDynamicBinding() {
+ IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
+ IMemoryBlock block = new MemoryBlockDynamic();
+ IMemoryRenderingType[] types = manager.getRenderingTypes(block);
assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
- types = manager.getDefaultRenderingTypes(block);
+ types = manager.getDefaultRenderingTypes(block);
assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
- IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
+ IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
assertEquals("Wrong bindings", manager.getRenderingType("rendering_type_1"), type); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
public void testBindingChangeNotification() {
final boolean[] changed = new boolean[1];
@@ -130,14 +130,14 @@ public class MemoryRenderingTests extends AbstractDebugTest {
// bug 374447 - Need to make sure that DynamicRenderingBindings singleton
// is initialized
IMemoryBlock block = new MemoryBlockDynamic();
- IMemoryRenderingType[] types = manager.getRenderingTypes(block);
+ IMemoryRenderingType[] types = manager.getRenderingTypes(block);
try {
manager.addListener(listener);
assertFalse("Renderings should not have changed yet", changed[0]); //$NON-NLS-1$
DynamicRenderingBindings.setBinding("rendering_type_2"); //$NON-NLS-1$
assertTrue("Renderings should have changed", changed[0]); //$NON-NLS-1$
- types = manager.getRenderingTypes(block);
+ types = manager.getRenderingTypes(block);
assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
assertEquals("Wrong binding", "rendering_type_2", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/CheckTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/CheckTests.java
index 07a142007..287a72393 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/CheckTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/CheckTests.java
@@ -29,9 +29,9 @@ import org.eclipse.jface.viewers.TreePath;
*/
abstract public class CheckTests extends AbstractViewerModelTest {
- public CheckTests(String name) {
- super(name);
- }
+ public CheckTests(String name) {
+ super(name);
+ }
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
@@ -39,43 +39,43 @@ abstract public class CheckTests extends AbstractViewerModelTest {
}
public void testSimpleSingleLevel() throws Exception {
- // Create the model with test data
- TestModel model = TestModel.simpleSingleLevel();
+ // Create the model with test data
+ TestModel model = TestModel.simpleSingleLevel();
- // Make sure that all elements are expanded
- fViewer.setAutoExpandLevel(-1);
+ // Make sure that all elements are expanded
+ fViewer.setAutoExpandLevel(-1);
- // Create the agent which forces the tree to populate
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ // Create the agent which forces the tree to populate
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- // Create the listener which determines when the view is finished updating.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener which determines when the view is finished updating.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the viewer input (and trigger updates).
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input (and trigger updates).
+ fViewer.setInput(model.getRootElement());
- // Wait for the updates to complete.
+ // Wait for the updates to complete.
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testSimpleMultiLevel() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- fViewer.setInput(model.getRootElement());
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
- // TODO: no idea how to trigger a toggle event on an item
+ // TODO: no idea how to trigger a toggle event on an item
// public void testCheckReceiver() {
// // Initial setup
// TestModel model = TestModel.simpleSingleLevel();
@@ -106,28 +106,28 @@ abstract public class CheckTests extends AbstractViewerModelTest {
// }
public void testUpdateCheck() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
+ // Update the model
+ TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.setElementChecked(elementPath, false, false);
+ TreePath elementPath = new TreePath(new Object[] { element });
+ ModelDelta delta = model.setElementChecked(elementPath, false, false);
- fListener.reset(elementPath, element, -1, true, false);
- model.postDelta(delta);
+ fListener.reset(elementPath, element, -1, true, false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(ITestModelUpdatesListenerConstants.LABEL_COMPLETE | ITestModelUpdatesListenerConstants.MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ChildrenUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ChildrenUpdateTests.java
index b7e310b3c..fb293ebfa 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ChildrenUpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ChildrenUpdateTests.java
@@ -76,33 +76,33 @@ public class ChildrenUpdateTests extends AbstractDebugTest {
public void removeModelChangedListener(IModelChangedListener listener) {}
@Override
public void removeLabelUpdateListener(ILabelUpdateListener listener) {}
- @Override
+ @Override
public void addViewerUpdateListener(IViewerUpdateListener listener) {}
- @Override
+ @Override
public void addStateUpdateListener(IStateUpdateListener listener) {}
- @Override
+ @Override
public void addModelChangedListener(IModelChangedListener listener) {}
- @Override
+ @Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {}
- @Override
+ @Override
public void update(Object element) {}
- @Override
+ @Override
public void setHasChildren(Object elementOrTreePath, boolean hasChildren) {}
- @Override
+ @Override
public void setExpandedState(Object elementOrTreePath, boolean expanded) {}
- @Override
+ @Override
public void setChildCount(Object elementOrTreePath, int count) {}
- @Override
+ @Override
public void reveal(TreePath path, int index) {}
- @Override
+ @Override
public void replace(Object parentOrTreePath, int index, Object element) {}
- @Override
+ @Override
public void remove(Object parentOrTreePath, int index) {}
- @Override
+ @Override
public void remove(Object elementOrTreePath) {}
- @Override
+ @Override
public void refresh() {}
- @Override
+ @Override
public void refresh(Object element) {}
@Override
@@ -171,10 +171,10 @@ public class ChildrenUpdateTests extends AbstractDebugTest {
return null;
}
- @Override
+ @Override
public boolean getHasChildren(Object elementOrTreePath) {
- return false;
- }
+ return false;
+ }
@Override
public int getChildCount(TreePath path) {
@@ -194,37 +194,37 @@ public class ChildrenUpdateTests extends AbstractDebugTest {
public void autoExpand(TreePath elementPath) {
}
- @Override
+ @Override
public boolean getElementChildrenRealized(TreePath parentPath) {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean getElementChecked(TreePath path) {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean getElementGrayed(TreePath path) {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public void setElementChecked(TreePath path, boolean checked, boolean grayed) {
- }
+ }
- @Override
+ @Override
public TreePath[] getElementPaths(Object element) {
- return null;
- }
- @Override
+ return null;
+ }
+ @Override
public void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
- FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds) {
- }
- @Override
+ FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds) {
+ }
+ @Override
public String[] getVisibleColumns() {
- return null;
- }
+ return null;
+ }
};
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ColumnPresentationTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ColumnPresentationTests.java
index b202e5838..92d3c131b 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ColumnPresentationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ColumnPresentationTests.java
@@ -67,20 +67,20 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
void createViewer() {
fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay);
- fShell.setSize(800, 600);
+ fShell = new Shell(fDisplay);
+ fShell.setSize(800, 600);
fShell.setLayout(new FillLayout());
fViewer = new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- fViewer.getTree().addControlListener(new ControlListener() {
- @Override
+ fViewer.getTree().addControlListener(new ControlListener() {
+ @Override
public void controlResized(ControlEvent e) {
- fResized = true;
- }
+ fResized = true;
+ }
- @Override
+ @Override
public void controlMoved(ControlEvent e) {
- }
- });
+ }
+ });
fListener = new TestModelUpdatesListener(fViewer, false, false);
fShell.open();
TestUtil.processUIEvents();
@@ -104,15 +104,15 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
protected String[] columnIds;
MyColumnPresentation() {
- this (makeDefaultColumnIds());
- }
+ this (makeDefaultColumnIds());
+ }
static String[] makeDefaultColumnIds() {
- String[] columnIds = new String[5];
- for (int i = 0; i < columnIds.length; i++) {
+ String[] columnIds = new String[5];
+ for (int i = 0; i < columnIds.length; i++) {
columnIds[i] = "ColumnId_" + i; //$NON-NLS-1$
- }
- return columnIds;
+ }
+ return columnIds;
}
MyColumnPresentation(String[] columnIds) {
@@ -150,10 +150,10 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
@Override
public String getHeader(String id) {
- if (Arrays.asList(columnIds).indexOf(id) != -1) {
- return id;
- }
- return null;
+ if (Arrays.asList(columnIds).indexOf(id) != -1) {
+ return id;
+ }
+ return null;
}
@Override
@@ -262,7 +262,7 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
* in InternalTreeModelViewer.
*/
public void testInitialColumnAverageWidth() throws Exception {
- fResized = false;
+ fResized = false;
MyColumnPresentation colPre = new MyColumnPresentation();
makeModel(colPre, "m1"); //$NON-NLS-1$
@@ -271,9 +271,9 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
int treeWidth = tree.getSize().x;
int avgWidth = treeWidth / columns.length;
- // Resizing the tree invalidates the test.
+ // Resizing the tree invalidates the test.
if (fResized) {
- return;
+ return;
}
for (int i = 0; i < columns.length - 1; i++) {
@@ -281,8 +281,8 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
}
// Checking of the width of the last column is not reliable.
// I.e. it's handled differenty on different platforms.
- //int remainder = treeWidth % columns.length;
- //assertEquals(avgWidth + remainder, columns[columns.length - 1].getWidth());
+ //int remainder = treeWidth % columns.length;
+ //assertEquals(avgWidth + remainder, columns[columns.length - 1].getWidth());
}
/**
@@ -291,22 +291,22 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
* the IColumnPresentation2 implementation.
*/
public void testInitialColumnWidth() throws Exception {
- fResized = false;
+ fResized = false;
- MyColumnPresentation2 colPre = new MyColumnPresentation2();
+ MyColumnPresentation2 colPre = new MyColumnPresentation2();
makeModel(colPre, "m2"); //$NON-NLS-1$
Tree tree = fViewer.getTree();
TreeColumn[] columns = tree.getColumns();
- // Resizing the tree invalidates the test.
+ // Resizing the tree invalidates the test.
if (fResized) {
- return;
+ return;
}
for (int i = 0; i < columns.length; i++) {
int width = colPre.repliedWidths[i];
if (width != -1) {
- assertEquals(width, columns[i].getWidth());
+ assertEquals(width, columns[i].getWidth());
}
}
}
@@ -392,36 +392,36 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
}
/**
- * In this test: verify that tree viewer can handle the column presentation changing
- * its available column IDs between runs (bug 360015).
- */
+ * In this test: verify that tree viewer can handle the column presentation changing
+ * its available column IDs between runs (bug 360015).
+ */
public void testChangedColumnIds() throws Exception {
- MyColumnPresentation colPre = new MyColumnPresentation();
+ MyColumnPresentation colPre = new MyColumnPresentation();
makeModel(colPre, "m1"); //$NON-NLS-1$
- TreeColumn[] columns = fViewer.getTree().getColumns();
- // Select visible columns
- fViewer.setVisibleColumns(new String[] { colPre.columnIds[0] });
+ TreeColumn[] columns = fViewer.getTree().getColumns();
+ // Select visible columns
+ fViewer.setVisibleColumns(new String[] { colPre.columnIds[0] });
TestUtil.processUIEvents();
waitWhile(t -> fViewer.getTree().getColumns().length != 1, createColumnsErrorMessage());
- // get InternalTreeModelViewer to rebuild columns due to change of
- // model and presentation - first set to another model and column
- // presentation, then switch to a model with original presentation.
+ // get InternalTreeModelViewer to rebuild columns due to change of
+ // model and presentation - first set to another model and column
+ // presentation, then switch to a model with original presentation.
makeModel(new MyColumnPresentation2(), "m2"); //$NON-NLS-1$
- String[] newColumnIds = MyColumnPresentation.makeDefaultColumnIds();
+ String[] newColumnIds = MyColumnPresentation.makeDefaultColumnIds();
newColumnIds[0] = "new_column_id"; //$NON-NLS-1$
- colPre = new MyColumnPresentation(newColumnIds);
+ colPre = new MyColumnPresentation(newColumnIds);
makeModel(colPre, "m3"); //$NON-NLS-1$
- // verify user resized widths are used instead of the initial widths from IColumnPresentation2
- columns = fViewer.getTree().getColumns();
- for (int i = 0; i < columns.length; i++) {
- assertEquals(newColumnIds[i], columns[i].getText());
- }
- }
+ // verify user resized widths are used instead of the initial widths from IColumnPresentation2
+ columns = fViewer.getTree().getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ assertEquals(newColumnIds[i], columns[i].getText());
+ }
+ }
private Function<AbstractDebugTest, String> createColumnsErrorMessage() {
return t -> "Unexpected columns number: " + fViewer.getTree().getColumns().length;
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ContentTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ContentTests.java
index 01f93cbdc..64a38b7fa 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ContentTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ContentTests.java
@@ -50,111 +50,111 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
}
public void testSimpleSingleLevel() throws Exception {
- // Create the model with test data
- TestModel model = TestModel.simpleSingleLevel();
+ // Create the model with test data
+ TestModel model = TestModel.simpleSingleLevel();
- // Make sure that all elements are expanded
- fViewer.setAutoExpandLevel(-1);
+ // Make sure that all elements are expanded
+ fViewer.setAutoExpandLevel(-1);
- // Create the agent which forces the tree to populate
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ // Create the agent which forces the tree to populate
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- // Create the listener which determines when the view is finished updating.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
+ // Create the listener which determines when the view is finished updating.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
- // Set the viewer input (and trigger updates).
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input (and trigger updates).
+ fViewer.setInput(model.getRootElement());
- // Wait for the updates to complete.
+ // Wait for the updates to complete.
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
- }
+ assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
+ }
public void testSimpleMultiLevel() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
- fViewer.setInput(model.getRootElement());
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 3) );
- }
+ assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 3) );
+ }
- /**
- * Modified test model that optionally captures (i.e. doesn't compete)
- * udpates after filling in their data.
- */
- class TestModelWithCapturedUpdates extends TestModel {
+ /**
+ * Modified test model that optionally captures (i.e. doesn't compete)
+ * udpates after filling in their data.
+ */
+ class TestModelWithCapturedUpdates extends TestModel {
- boolean fCaptureLabelUpdates = false;
- boolean fCaptureChildrenUpdates = false;
+ boolean fCaptureLabelUpdates = false;
+ boolean fCaptureChildrenUpdates = false;
List<IViewerUpdate> fCapturedUpdates = Collections.synchronizedList(new ArrayList<IViewerUpdate>());
- @Override
+ @Override
public void update(IChildrenUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- TestElement element = (TestElement)updates[i].getElement();
- int endOffset = updates[i].getOffset() + updates[i].getLength();
- for (int j = updates[i].getOffset(); j < endOffset; j++) {
- if (j < element.getChildren().length) {
- updates[i].setChild(element.getChildren()[j], j);
- }
- }
- if (fCaptureChildrenUpdates) {
- fCapturedUpdates.add(updates[i]);
- } else {
- updates[i].done();
- }
- }
- }
-
- @Override
+ for (int i = 0; i < updates.length; i++) {
+ TestElement element = (TestElement)updates[i].getElement();
+ int endOffset = updates[i].getOffset() + updates[i].getLength();
+ for (int j = updates[i].getOffset(); j < endOffset; j++) {
+ if (j < element.getChildren().length) {
+ updates[i].setChild(element.getChildren()[j], j);
+ }
+ }
+ if (fCaptureChildrenUpdates) {
+ fCapturedUpdates.add(updates[i]);
+ } else {
+ updates[i].done();
+ }
+ }
+ }
+
+ @Override
public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- TestElement element = (TestElement)updates[i].getElement();
- updates[i].setLabel(element.getLabel(), 0);
- if (updates[i] instanceof ICheckUpdate &&
- Boolean.TRUE.equals(updates[i].getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
- {
- ((ICheckUpdate)updates[i]).setChecked(element.getChecked(), element.getGrayed());
- }
- if (fCaptureLabelUpdates) {
- fCapturedUpdates.add(updates[i]);
- } else {
- updates[i].done();
- }
- }
- }
- }
-
- /**
- * Test to make sure that label provider cancels stale updates and doesn't
- * use data from stale updates to populate the viewer.<br>
- * See bug 210027
- */
+ for (int i = 0; i < updates.length; i++) {
+ TestElement element = (TestElement)updates[i].getElement();
+ updates[i].setLabel(element.getLabel(), 0);
+ if (updates[i] instanceof ICheckUpdate &&
+ Boolean.TRUE.equals(updates[i].getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
+ {
+ ((ICheckUpdate)updates[i]).setChecked(element.getChecked(), element.getGrayed());
+ }
+ if (fCaptureLabelUpdates) {
+ fCapturedUpdates.add(updates[i]);
+ } else {
+ updates[i].done();
+ }
+ }
+ }
+ }
+
+ /**
+ * Test to make sure that label provider cancels stale updates and doesn't
+ * use data from stale updates to populate the viewer.<br>
+ * See bug 210027
+ */
public void testLabelUpdatesCompletedOutOfSequence1() throws Exception {
- TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
- model.fCaptureLabelUpdates = true;
+ TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
+ model.fCaptureLabelUpdates = true;
model.setRoot(new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
- }) );
+ }) );
- // Set input into the view to update it, but block children updates.
- // Wait for view to start retrieving content.
- fViewer.setInput(model.getRootElement());
+ // Set input into the view to update it, but block children updates.
+ // Wait for view to start retrieving content.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> model.fCapturedUpdates.size() < model.getRootElement().fChildren.length, createModelErrorMessage(model));
@@ -164,145 +164,145 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
// // Change the model and run another update set.
model.getElement(model.findElement("1")).setLabelAppendix(" - changed"); //$NON-NLS-1$ //$NON-NLS-2$
model.getElement(model.findElement("2")).setLabelAppendix(" - changed"); //$NON-NLS-1$ //$NON-NLS-2$
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> model.fCapturedUpdates.size() < model.getRootElement().fChildren.length, createModelErrorMessage(model));
- // Complete the second set of children updates
- for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
- ((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
- }
+ // Complete the second set of children updates
+ for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
+ ((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
+ }
- // Then complete the first set.
- for (int i = 0; i < firstUpdates.size(); i++) {
- ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
- assertTrue(capturedUpdate.isCanceled());
- capturedUpdate.done();
- }
+ // Then complete the first set.
+ for (int i = 0; i < firstUpdates.size(); i++) {
+ ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
+ assertTrue(capturedUpdate.isCanceled());
+ capturedUpdate.done();
+ }
waitWhile(t -> !fListener.isFinished(CHILDREN_UPDATES), createListenerErrorMessage());
- // Check viewer data
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ // Check viewer data
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
private Function<AbstractDebugTest, String> createModelErrorMessage(TestModelWithCapturedUpdates model) {
return t -> "Unxexpected model state: captured updates: " + model.fCapturedUpdates + ", root children: " + Arrays.toString(model.getRootElement().fChildren);
}
- /**
- * Test to make sure that label provider cancels stale updates and doesn't
- * use data from stale updates to populate the viewer.<br>
- * This version of the test changes the elements in the view, and not just
- * the elements' labels. In this case, the view should still cancel stale
- * updates.<br>
- * See bug 210027
- */
+ /**
+ * Test to make sure that label provider cancels stale updates and doesn't
+ * use data from stale updates to populate the viewer.<br>
+ * This version of the test changes the elements in the view, and not just
+ * the elements' labels. In this case, the view should still cancel stale
+ * updates.<br>
+ * See bug 210027
+ */
public void testLabelUpdatesCompletedOutOfSequence2() throws Exception {
- TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
- model.fCaptureLabelUpdates = true;
+ TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
+ model.fCaptureLabelUpdates = true;
model.setRoot(new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
- }) );
+ }) );
- // Set input into the view to update it, but block children updates.
- // Wait for view to start retrieving content.
- fViewer.setInput(model.getRootElement());
+ // Set input into the view to update it, but block children updates.
+ // Wait for view to start retrieving content.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> model.fCapturedUpdates.size() < model.getRootElement().fChildren.length, createModelErrorMessage(model));
List<IViewerUpdate> firstUpdates = model.fCapturedUpdates;
model.fCapturedUpdates = Collections.synchronizedList(new ArrayList<IViewerUpdate>(2));
- // Change the model and run another update set.
+ // Change the model and run another update set.
model.setElementChildren(TreePath.EMPTY, new TestElement[] {
new TestElement(model, "1-new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2-new", new TestElement[0]), //$NON-NLS-1$
- });
+ });
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> model.fCapturedUpdates.size() < model.getRootElement().fChildren.length, createModelErrorMessage(model));
- // Complete the second set of children updates
- for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
- ((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
- }
+ // Complete the second set of children updates
+ for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
+ ((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
+ }
- // Then complete the first set.
- for (int i = 0; i < firstUpdates.size(); i++) {
- ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
- assertTrue(capturedUpdate.isCanceled());
- capturedUpdate.done();
- }
+ // Then complete the first set.
+ for (int i = 0; i < firstUpdates.size(); i++) {
+ ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
+ assertTrue(capturedUpdate.isCanceled());
+ capturedUpdate.done();
+ }
waitWhile(t -> !fListener.isFinished(CHILDREN_UPDATES), createListenerErrorMessage());
- // Check viewer data
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- /**
- * Test to make sure that content provider cancels stale updates and doesn't
- * use data from stale updates to populate the viewer.<br>
- * Note: this test is disabled because currently the viewer will not issue
- * a new update for an until the previous update is completed. This is even
- * if the previous update is canceled. If this behavior is changed at some
- * point, then this test should be re-enabled.<br>
- * See bug 210027
- */
+ // Check viewer data
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
+
+ /**
+ * Test to make sure that content provider cancels stale updates and doesn't
+ * use data from stale updates to populate the viewer.<br>
+ * Note: this test is disabled because currently the viewer will not issue
+ * a new update for an until the previous update is completed. This is even
+ * if the previous update is canceled. If this behavior is changed at some
+ * point, then this test should be re-enabled.<br>
+ * See bug 210027
+ */
public void _x_testChildrenUpdatesCompletedOutOfSequence() throws Exception {
- TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
- model.fCaptureChildrenUpdates = true;
+ TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
+ model.fCaptureChildrenUpdates = true;
model.setRoot(new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
- }) );
+ }) );
- // Set input into the view to update it, but block children updates.
- // Wait for view to start retrieving content.
- fViewer.setInput(model.getRootElement());
+ // Set input into the view to update it, but block children updates.
+ // Wait for view to start retrieving content.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !areCapturedChildrenUpdatesComplete(model.fCapturedUpdates, model.getRootElement().fChildren.length), createModelErrorMessage(model));
- IChildrenUpdate[] firstUpdates = model.fCapturedUpdates.toArray(new IChildrenUpdate[0]);
- model.fCapturedUpdates.clear();
+ IChildrenUpdate[] firstUpdates = model.fCapturedUpdates.toArray(new IChildrenUpdate[0]);
+ model.fCapturedUpdates.clear();
- // Change the model and run another update set.
- model.setElementChildren(TreePath.EMPTY, new TestElement[] {
+ // Change the model and run another update set.
+ model.setElementChildren(TreePath.EMPTY, new TestElement[] {
new TestElement(model, "1-new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2-new", new TestElement[0]), //$NON-NLS-1$
- });
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ });
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !areCapturedChildrenUpdatesComplete(model.fCapturedUpdates, model.getRootElement().fChildren.length), createModelErrorMessage(model));
- // Complete the second set of children updates
- for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
- ((IChildrenUpdate)model.fCapturedUpdates.get(i)).done();
- }
+ // Complete the second set of children updates
+ for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
+ ((IChildrenUpdate)model.fCapturedUpdates.get(i)).done();
+ }
- // Then complete the first set.
- for (int i = 0; i < firstUpdates.length; i++) {
- firstUpdates[i].done();
- }
+ // Then complete the first set.
+ for (int i = 0; i < firstUpdates.length; i++) {
+ firstUpdates[i].done();
+ }
waitWhile(t -> !fListener.isFinished(CHILDREN_UPDATES), createListenerErrorMessage());
- // Check viewer data
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ // Check viewer data
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
private boolean areCapturedChildrenUpdatesComplete(List<IViewerUpdate> capturedUpdates, int childCount) {
List<Integer> expectedChildren = new ArrayList<>();
- for (int i = 0; i < childCount; i++) {
- expectedChildren.add(Integer.valueOf(i));
- }
- IChildrenUpdate[] updates = capturedUpdates.toArray(new IChildrenUpdate[0]);
- for (int i = 0; i < updates.length; i++) {
- for (int j = 0; j < updates[i].getLength(); j++) {
- expectedChildren.remove( Integer.valueOf(updates[i].getOffset() + j) );
- }
- }
- return expectedChildren.isEmpty();
- }
+ for (int i = 0; i < childCount; i++) {
+ expectedChildren.add(Integer.valueOf(i));
+ }
+ IChildrenUpdate[] updates = capturedUpdates.toArray(new IChildrenUpdate[0]);
+ for (int i = 0; i < updates.length; i++) {
+ for (int j = 0; j < updates[i].getLength(); j++) {
+ expectedChildren.remove( Integer.valueOf(updates[i].getOffset() + j) );
+ }
+ }
+ return expectedChildren.isEmpty();
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DeltaTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DeltaTests.java
index 63b9d8860..e6c25d01e 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DeltaTests.java
@@ -31,9 +31,9 @@ import org.eclipse.jface.viewers.TreePath;
*/
abstract public class DeltaTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public DeltaTests(String name) {
- super(name);
- }
+ public DeltaTests(String name) {
+ super(name);
+ }
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
@@ -41,656 +41,656 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
}
public void testUpdateLabel() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
+ // Update the model
+ TestElement element = model.getRootElement().getChildren()[0];
+ TreePath elementPath = new TreePath(new Object[] { element });
ModelDelta delta = model.appendElementLabel(elementPath, "-modified"); //$NON-NLS-1$
- fListener.reset(elementPath, element, -1, true, false);
- model.postDelta(delta);
+ fListener.reset(elementPath, element, -1, true, false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(LABEL_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testRefreshStruct() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
- TestElement[] newChildren = new TestElement[] {
+ // Update the model
+ TestElement element = model.getRootElement().getChildren()[0];
+ TreePath elementPath = new TreePath(new Object[] { element });
+ TestElement[] newChildren = new TestElement[] {
new TestElement(model, "1.1 - new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "1.2 - new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "1.3 - new", new TestElement[0]), //$NON-NLS-1$
- };
- ModelDelta delta = model.setElementChildren(elementPath, newChildren);
+ };
+ ModelDelta delta = model.setElementChildren(elementPath, newChildren);
- fListener.reset(elementPath, element, -1, true, false);
- model.postDelta(delta);
+ fListener.reset(elementPath, element, -1, true, false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testRefreshStruct2() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
String prefix = "new - "; //$NON-NLS-1$
- model.setElementChildren(TreePath.EMPTY, new TestElement[] {
+ model.setElementChildren(TreePath.EMPTY, new TestElement[] {
new TestElement(model, prefix + "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "2", true, false, new TestElement[] { //$NON-NLS-1$
new TestElement(model, prefix + "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
- }),
+ }),
new TestElement(model, prefix + "3", new TestElement[] { //$NON-NLS-1$
new TestElement(model, prefix + "3.1", new TestElement[] { //$NON-NLS-1$
new TestElement(model, prefix + "3.1.1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "3.1.2", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "3.1.3", new TestElement[0]), //$NON-NLS-1$
- }),
+ }),
new TestElement(model, prefix + "3.2", new TestElement[] { //$NON-NLS-1$
new TestElement(model, prefix + "3.2.1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "3.2.2", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "3.2.3", new TestElement[0]), //$NON-NLS-1$
- }),
+ }),
new TestElement(model, prefix + "3.3", new TestElement[] { //$NON-NLS-1$
new TestElement(model, prefix + "3.3.1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "3.3.2", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, prefix + "3.3.3", new TestElement[0]), //$NON-NLS-1$
- }),
- })
- });
+ }),
+ })
+ });
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
+ TestElement element = model.getRootElement();
+ fListener.reset(TreePath.EMPTY, element, -1, false, false);
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
+ model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testRefreshCoalesceStruct() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- // Create a single level model and add a single child to each element.
- TestModel model = TestModel.simpleSingleLevel();
- TestElement[] rootChildren = model.getRootElement().getChildren();
- for (int i = 0; i < rootChildren.length; i++) {
- model.setElementChildren(
- new TreePath(new Object[] { rootChildren[i]} ),
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+
+ // Create a single level model and add a single child to each element.
+ TestModel model = TestModel.simpleSingleLevel();
+ TestElement[] rootChildren = model.getRootElement().getChildren();
+ for (int i = 0; i < rootChildren.length; i++) {
+ model.setElementChildren(
+ new TreePath(new Object[] { rootChildren[i]} ),
new TestElement[] { new TestElement(model, i + ".1", new TestElement[0]) }); //$NON-NLS-1$
- }
+ }
- fViewer.setAutoExpandLevel(-1);
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
+ }
public void testInsert() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
+ // Update the model
TestElement element = new TestElement(model, "7", new TestElement[0]); //$NON-NLS-1$
- TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.insertElementChild(TreePath.EMPTY, 6, element);
-
- // Insert causes the update of element's data, label and children.
- // TODO: update of element's data after insert seems redundant
- // but it's probably not a big inefficiency
- fListener.reset();
- fListener.addChildreUpdate(TreePath.EMPTY, 6);
- fListener.addHasChildrenUpdate(elementPath);
- fListener.addLabelUpdate(elementPath);
- // TODO: redundant label updates on insert!
- fListener.setFailOnRedundantUpdates(false);
- model.postDelta(delta);
+ TreePath elementPath = new TreePath(new Object[] { element });
+ ModelDelta delta = model.insertElementChild(TreePath.EMPTY, 6, element);
+
+ // Insert causes the update of element's data, label and children.
+ // TODO: update of element's data after insert seems redundant
+ // but it's probably not a big inefficiency
+ fListener.reset();
+ fListener.addChildreUpdate(TreePath.EMPTY, 6);
+ fListener.addHasChildrenUpdate(elementPath);
+ fListener.addLabelUpdate(elementPath);
+ // TODO: redundant label updates on insert!
+ fListener.setFailOnRedundantUpdates(false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
- /**
- * This test checks that insert and select delta flags are processed in correct order:
- * insert then select.
- */
+ /**
+ * This test checks that insert and select delta flags are processed in correct order:
+ * insert then select.
+ */
public void testInsertAndSelect() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- // Insert two new elements at once
+ // Update the model
+ // Insert two new elements at once
TestElement element0 = new TestElement(model, "00", new TestElement[] {}); //$NON-NLS-1$
TestElement element1 = new TestElement(model, "01", new TestElement[] {}); //$NON-NLS-1$
- TreePath elementPath0 = new TreePath(new Object[] { element0 });
- TreePath elementPath1 = new TreePath(new Object[] { element1 });
- ModelDelta rootDelta = model.insertElementChild(TreePath.EMPTY, 0, element0);
- rootDelta = model.insertElementChild(rootDelta, TreePath.EMPTY, 1, element1);
+ TreePath elementPath0 = new TreePath(new Object[] { element0 });
+ TreePath elementPath1 = new TreePath(new Object[] { element1 });
+ ModelDelta rootDelta = model.insertElementChild(TreePath.EMPTY, 0, element0);
+ rootDelta = model.insertElementChild(rootDelta, TreePath.EMPTY, 1, element1);
- // Set the select flag on the first added node.
- ModelDelta delta0 = rootDelta.getChildDelta(element0);
- delta0.setFlags(delta0.getFlags() | IModelDelta.SELECT);
+ // Set the select flag on the first added node.
+ ModelDelta delta0 = rootDelta.getChildDelta(element0);
+ delta0.setFlags(delta0.getFlags() | IModelDelta.SELECT);
- fListener.reset();
- fListener.addHasChildrenUpdate(elementPath0);
- fListener.addHasChildrenUpdate(elementPath1);
- fListener.addLabelUpdate(elementPath0);
- fListener.addLabelUpdate(elementPath1);
+ fListener.reset();
+ fListener.addHasChildrenUpdate(elementPath0);
+ fListener.addHasChildrenUpdate(elementPath1);
+ fListener.addLabelUpdate(elementPath0);
+ fListener.addLabelUpdate(elementPath1);
- // TODO: list full set of expected updates.
- fListener.setFailOnRedundantUpdates(false);
+ // TODO: list full set of expected updates.
+ fListener.setFailOnRedundantUpdates(false);
- model.postDelta(rootDelta);
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
- /**
- * This test checks that insert and remove deltas are processed in correct order:
- * remove deltas are processed first then insert deltas.
- */
+ /**
+ * This test checks that insert and remove deltas are processed in correct order:
+ * remove deltas are processed first then insert deltas.
+ */
public void testInsertAndRemove() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- fViewer.setInput(model.getRootElement());
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- // Remove one element then insert a new one
- IModelDelta removeDelta = model.removeElementChild(TreePath.EMPTY, 3).getChildDeltas()[0];
+ // Update the model
+ // Remove one element then insert a new one
+ IModelDelta removeDelta = model.removeElementChild(TreePath.EMPTY, 3).getChildDeltas()[0];
- // Insert new elements at once
+ // Insert new elements at once
TestElement element = new TestElement(model, "00", new TestElement[] {}); //$NON-NLS-1$
- TreePath elementPath = new TreePath(new Object[] { element });
- IModelDelta insertDelta = model.insertElementChild(TreePath.EMPTY, 1, element).getChildDeltas()[0];
+ TreePath elementPath = new TreePath(new Object[] { element });
+ IModelDelta insertDelta = model.insertElementChild(TreePath.EMPTY, 1, element).getChildDeltas()[0];
- // Create a combined delta where the insert child delta is first and the remove child delta is second.
- ModelDelta combinedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE, 0, model.getRootElement().getChildren().length);
- combinedDelta.addNode(insertDelta.getElement(), insertDelta.getIndex(), insertDelta.getFlags(), insertDelta.getChildCount());
- combinedDelta.addNode(removeDelta.getElement(), removeDelta.getIndex(), removeDelta.getFlags(), removeDelta.getChildCount());
+ // Create a combined delta where the insert child delta is first and the remove child delta is second.
+ ModelDelta combinedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE, 0, model.getRootElement().getChildren().length);
+ combinedDelta.addNode(insertDelta.getElement(), insertDelta.getIndex(), insertDelta.getFlags(), insertDelta.getChildCount());
+ combinedDelta.addNode(removeDelta.getElement(), removeDelta.getIndex(), removeDelta.getFlags(), removeDelta.getChildCount());
- // Set the select flag on the first added node.
- fListener.reset();
- fListener.addHasChildrenUpdate(elementPath);
- fListener.addLabelUpdate(elementPath);
+ // Set the select flag on the first added node.
+ fListener.reset();
+ fListener.addHasChildrenUpdate(elementPath);
+ fListener.addLabelUpdate(elementPath);
- // TODO: list full set of expected updates.
- fListener.setFailOnRedundantUpdates(false);
+ // TODO: list full set of expected updates.
+ fListener.setFailOnRedundantUpdates(false);
- model.postDelta(combinedDelta);
+ model.postDelta(combinedDelta);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testAddElement() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
+ // Update the model
TestElement element = new TestElement(model, "7", new TestElement[0]); //$NON-NLS-1$
- TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, 6, element);
-
- // Add causes the update of parent child count and element's children.
- fListener.reset(elementPath, element, -1, true, false);
- fListener.addChildreUpdate(TreePath.EMPTY, 6);
- // TODO: redundant updates on add!
- fListener.setFailOnRedundantUpdates(false);
- model.postDelta(delta);
+ TreePath elementPath = new TreePath(new Object[] { element });
+ ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, 6, element);
+
+ // Add causes the update of parent child count and element's children.
+ fListener.reset(elementPath, element, -1, true, false);
+ fListener.addChildreUpdate(TreePath.EMPTY, 6);
+ // TODO: redundant updates on add!
+ fListener.setFailOnRedundantUpdates(false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
- // This test currently fails. When (if) bug 311442 gets address we should re-enable it.
+ // This test currently fails. When (if) bug 311442 gets address we should re-enable it.
public void _x_testAddUnexpandedElement() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Turn off auto-expansion
- fViewer.setAutoExpandLevel(0);
+ // Turn off auto-expansion
+ fViewer.setAutoExpandLevel(0);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- // Update the model
+ // Update the model
TreePath parentPath = model.findElement("1"); //$NON-NLS-1$
ModelDelta rootDelta = model.addElementChild(parentPath, null, 0, new TestElement(model, "1.1", new TestElement[0])); //$NON-NLS-1$
model.addElementChild(parentPath, rootDelta, 1, new TestElement(model, "1.2", new TestElement[0])); //$NON-NLS-1$
model.addElementChild(parentPath, rootDelta, 2, new TestElement(model, "1.3", new TestElement[0])); //$NON-NLS-1$
model.addElementChild(parentPath, rootDelta, 3, new TestElement(model, "1.4", new TestElement[0])); //$NON-NLS-1$
- // Add causes the update of parent child count and element's children.
- fListener.reset();
- fListener.setFailOnRedundantUpdates(false);
- model.postDelta(rootDelta);
+ // Add causes the update of parent child count and element's children.
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Update the elements that were added.
- fListener.reset();
- fListener.addUpdates(fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
- rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
+ // Update the elements that were added.
+ fListener.reset();
+ fListener.addUpdates(fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
model.getElementDelta(rootDelta, model.findElement("1.1"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("1.2"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("1.3"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("1.4"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
- model.postDelta(rootDelta);
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
- fViewer.expandToLevel(parentPath, 1);
+ fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
+ fViewer.expandToLevel(parentPath, 1);
waitWhile(t -> fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, parentPath);
- }
+ model.validateData(fViewer, parentPath);
+ }
public void _x_testRefreshUnexpandedElementsChildren() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Turn off auto-expansion
- fViewer.setAutoExpandLevel(0);
+ // Turn off auto-expansion
+ fViewer.setAutoExpandLevel(0);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- // Expand elment "2"
+ // Expand elment "2"
TreePath parentPath = model.findElement("2"); //$NON-NLS-1$
- fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
- fViewer.expandToLevel(parentPath, 1);
+ fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
+ fViewer.expandToLevel(parentPath, 1);
waitWhile(t -> fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Collapse back element "2"
- fViewer.setExpandedState(parentPath, false);
+ // Collapse back element "2"
+ fViewer.setExpandedState(parentPath, false);
- // Update the children of element "2".
- fListener.reset();
- fListener.addUpdates(fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
- ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
+ // Update the children of element "2".
+ fListener.reset();
+ fListener.addUpdates(fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
model.getElementDelta(rootDelta, model.findElement("2.1"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("2.2"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("2.3"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
- model.postDelta(rootDelta);
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Expand back element "2"
- fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
- fViewer.expandToLevel(parentPath, 1);
+ // Expand back element "2"
+ fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
+ fViewer.expandToLevel(parentPath, 1);
waitWhile(t -> fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, parentPath, true);
- }
+ model.validateData(fViewer, parentPath, true);
+ }
public void testRemove() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 5);
+ // Update the model
+ ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 5);
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
+ // Remove delta should generate no new updates, but we still need to wait for the event to
+ // be processed.
+ fListener.reset();
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testExpandAndSelect() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Create the delta
- fListener.reset();
- // TODO Investigate: there seem to be unnecessary updates being issued
- // by the viewer. These include the updates that are commented out:
- // For now disable checking for extra updates.
- fListener.setFailOnRedundantUpdates(false);
- TestElement element = model.getRootElement();
- TreePath path_root = TreePath.EMPTY;
- ModelDelta delta= new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
- ModelDelta deltaRoot = delta;
- element = element.getChildren()[2];
- TreePath path_root_3 = path_root.createChildPath(element);
- delta = delta.addNode(element, 2, IModelDelta.EXPAND, element.fChildren.length);
- fListener.addChildreUpdate(path_root_3, 0);
- TreePath path_root_3_1 = path_root_3.createChildPath(element.getChildren()[0]);
- fListener.addHasChildrenUpdate(path_root_3_1);
- fListener.addLabelUpdate(path_root_3_1);
- TreePath path_root_3_3 = path_root_3.createChildPath(element.getChildren()[2]);
- fListener.addHasChildrenUpdate(path_root_3_3);
- fListener.addLabelUpdate(path_root_3_3);
- //TODO unnecessary update: fListener.addChildreUpdate(path1, 1);
- fListener.addChildreUpdate(path_root_3, 2);
- element = element.getChildren()[1];
- TreePath path_root_3_2 = path_root_3.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.EXPAND, element.fChildren.length);
- fListener.addLabelUpdate(path_root_3_2);
- TreePath path_root_3_2_1 = path_root_3_2.createChildPath(element.getChildren()[0]);
- fListener.addHasChildrenUpdate(path_root_3_2_1);
- fListener.addLabelUpdate(path_root_3_2_1);
- TreePath path_root_3_2_3 = path_root_3_2.createChildPath(element.getChildren()[2]);
- fListener.addHasChildrenUpdate(path_root_3_2_3);
- fListener.addLabelUpdate(path_root_3_2_3);
- // TODO unnecessary update: fListener.addChildreCountUpdate(path2);
- fListener.addChildreUpdate(path_root_3_2, 0);
- // TODO unnecessary update: fListener.addChildreUpdate(path2, 1);
- fListener.addChildreUpdate(path_root_3_2, 2);
- element = element.getChildren()[1];
- TreePath path_root_3_2_2 = path_root_3_2.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.SELECT, element.fChildren.length);
- fListener.addLabelUpdate(path_root_3_2_2);
- fListener.addHasChildrenUpdate(path_root_3_2_2);
-
- // Validate the expansion state BEFORE posting the delta.
-
- IInternalTreeModelViewer contentProviderViewer = fViewer;
- assertFalse(contentProviderViewer.getExpandedState(path_root_3));
- assertFalse(contentProviderViewer.getExpandedState(path_root_3_2));
- assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
-
- model.postDelta(deltaRoot);
+ model.validateData(fViewer, TreePath.EMPTY, true);
+
+ // Create the delta
+ fListener.reset();
+ // TODO Investigate: there seem to be unnecessary updates being issued
+ // by the viewer. These include the updates that are commented out:
+ // For now disable checking for extra updates.
+ fListener.setFailOnRedundantUpdates(false);
+ TestElement element = model.getRootElement();
+ TreePath path_root = TreePath.EMPTY;
+ ModelDelta delta= new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
+ ModelDelta deltaRoot = delta;
+ element = element.getChildren()[2];
+ TreePath path_root_3 = path_root.createChildPath(element);
+ delta = delta.addNode(element, 2, IModelDelta.EXPAND, element.fChildren.length);
+ fListener.addChildreUpdate(path_root_3, 0);
+ TreePath path_root_3_1 = path_root_3.createChildPath(element.getChildren()[0]);
+ fListener.addHasChildrenUpdate(path_root_3_1);
+ fListener.addLabelUpdate(path_root_3_1);
+ TreePath path_root_3_3 = path_root_3.createChildPath(element.getChildren()[2]);
+ fListener.addHasChildrenUpdate(path_root_3_3);
+ fListener.addLabelUpdate(path_root_3_3);
+ //TODO unnecessary update: fListener.addChildreUpdate(path1, 1);
+ fListener.addChildreUpdate(path_root_3, 2);
+ element = element.getChildren()[1];
+ TreePath path_root_3_2 = path_root_3.createChildPath(element);
+ delta = delta.addNode(element, 1, IModelDelta.EXPAND, element.fChildren.length);
+ fListener.addLabelUpdate(path_root_3_2);
+ TreePath path_root_3_2_1 = path_root_3_2.createChildPath(element.getChildren()[0]);
+ fListener.addHasChildrenUpdate(path_root_3_2_1);
+ fListener.addLabelUpdate(path_root_3_2_1);
+ TreePath path_root_3_2_3 = path_root_3_2.createChildPath(element.getChildren()[2]);
+ fListener.addHasChildrenUpdate(path_root_3_2_3);
+ fListener.addLabelUpdate(path_root_3_2_3);
+ // TODO unnecessary update: fListener.addChildreCountUpdate(path2);
+ fListener.addChildreUpdate(path_root_3_2, 0);
+ // TODO unnecessary update: fListener.addChildreUpdate(path2, 1);
+ fListener.addChildreUpdate(path_root_3_2, 2);
+ element = element.getChildren()[1];
+ TreePath path_root_3_2_2 = path_root_3_2.createChildPath(element);
+ delta = delta.addNode(element, 1, IModelDelta.SELECT, element.fChildren.length);
+ fListener.addLabelUpdate(path_root_3_2_2);
+ fListener.addHasChildrenUpdate(path_root_3_2_2);
+
+ // Validate the expansion state BEFORE posting the delta.
+
+ IInternalTreeModelViewer contentProviderViewer = fViewer;
+ assertFalse(contentProviderViewer.getExpandedState(path_root_3));
+ assertFalse(contentProviderViewer.getExpandedState(path_root_3_2));
+ assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
+
+ model.postDelta(deltaRoot);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Validate the expansion state AFTER posting the delta.
- assertTrue(contentProviderViewer.getExpandedState(path_root_3));
- assertTrue(contentProviderViewer.getExpandedState(path_root_3_2));
- assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
+ // Validate the expansion state AFTER posting the delta.
+ assertTrue(contentProviderViewer.getExpandedState(path_root_3));
+ assertTrue(contentProviderViewer.getExpandedState(path_root_3_2));
+ assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
- // Verify selection
- ISelection selection = fViewer.getSelection();
- if (selection instanceof ITreeSelection) {
+ // Verify selection
+ ISelection selection = fViewer.getSelection();
+ if (selection instanceof ITreeSelection) {
List<TreePath> selectionPathsList = Arrays.asList(((ITreeSelection) selection).getPaths());
- assertTrue(selectionPathsList.contains(path_root_3_2_2));
- } else {
+ assertTrue(selectionPathsList.contains(path_root_3_2_2));
+ } else {
fail("Not a tree selection"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * This test verifies that expand and select updates are being ignored.
- */
+ /**
+ * This test verifies that expand and select updates are being ignored.
+ */
public void testExpandAndSelect_simple() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Create the delta
- fListener.reset();
- // TODO Investigate: there seem to be unnecessary updates being issued
- // by the viewer. These include the updates that are commented out:
- // For now disable checking for extra updates.
- fListener.setFailOnRedundantUpdates(false);
- TestElement element = model.getRootElement();
- TreePath path_root = TreePath.EMPTY;
- ModelDelta delta= new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
- ModelDelta deltaRoot = delta;
- element = element.getChildren()[2];
- TreePath path_root_3 = path_root.createChildPath(element);
- delta.addNode(element, 2, IModelDelta.SELECT | IModelDelta.EXPAND, element.fChildren.length);
-
- // Validate the expansion state BEFORE posting the delta.
-
- IInternalTreeModelViewer contentProviderViewer = fViewer;
- assertFalse(contentProviderViewer.getExpandedState(path_root_3));
-
- model.postDelta(deltaRoot);
+ model.validateData(fViewer, TreePath.EMPTY, true);
+
+ // Create the delta
+ fListener.reset();
+ // TODO Investigate: there seem to be unnecessary updates being issued
+ // by the viewer. These include the updates that are commented out:
+ // For now disable checking for extra updates.
+ fListener.setFailOnRedundantUpdates(false);
+ TestElement element = model.getRootElement();
+ TreePath path_root = TreePath.EMPTY;
+ ModelDelta delta= new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
+ ModelDelta deltaRoot = delta;
+ element = element.getChildren()[2];
+ TreePath path_root_3 = path_root.createChildPath(element);
+ delta.addNode(element, 2, IModelDelta.SELECT | IModelDelta.EXPAND, element.fChildren.length);
+
+ // Validate the expansion state BEFORE posting the delta.
+
+ IInternalTreeModelViewer contentProviderViewer = fViewer;
+ assertFalse(contentProviderViewer.getExpandedState(path_root_3));
+
+ model.postDelta(deltaRoot);
TestUtil.processUIEvents();
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Validate the expansion state AFTER posting the delta.
- assertTrue(contentProviderViewer.getExpandedState(path_root_3));
+ // Validate the expansion state AFTER posting the delta.
+ assertTrue(contentProviderViewer.getExpandedState(path_root_3));
- // Verify selection
- ISelection selection = fViewer.getSelection();
- if (selection instanceof ITreeSelection) {
+ // Verify selection
+ ISelection selection = fViewer.getSelection();
+ if (selection instanceof ITreeSelection) {
List<TreePath> selectionPathsList = Arrays.asList(((ITreeSelection) selection).getPaths());
- assertTrue(selectionPathsList.contains(path_root_3));
- } else {
+ assertTrue(selectionPathsList.contains(path_root_3));
+ } else {
fail("Not a tree selection"); //$NON-NLS-1$
- }
- }
+ }
+ }
public void testCompositeModelRefreshStruct() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.compositeMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.compositeMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- // TODO: redundant updates on install deltas
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ // TODO: redundant updates on install deltas
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Update the model
+ // Update the model
TreePath m4_2_1Path = model.findElement("m4.2.1"); //$NON-NLS-1$
- TestElement m4_2_1 = model.getElement(m4_2_1Path);
- TestModel m4 = m4_2_1.getModel();
- TestElement[] newChildren = new TestElement[] {
+ TestElement m4_2_1 = model.getElement(m4_2_1Path);
+ TestModel m4 = m4_2_1.getModel();
+ TestElement[] newChildren = new TestElement[] {
new TestElement(m4, "4.2.1.new-1", new TestElement[0]), //$NON-NLS-1$
new TestElement(m4, "4.2.1.new-2", new TestElement[0]), //$NON-NLS-1$
new TestElement(m4, "4.2.1.new-3", new TestElement[0]), //$NON-NLS-1$
- };
+ };
- ModelDelta delta = m4.setElementChildren(m4_2_1Path, newChildren);
+ ModelDelta delta = m4.setElementChildren(m4_2_1Path, newChildren);
- fListener.reset(m4_2_1Path, m4_2_1, -1, true, false);
- model.postDelta(delta);
+ fListener.reset(m4_2_1Path, m4_2_1, -1, true, false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testCompositeModelAddElement() throws Exception {
- TestModel model = TestModel.compositeMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.compositeMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- // TODO: redundant updates on install deltas
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ // TODO: redundant updates on install deltas
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
TreePath m3_1Path = model.findElement("m3.1"); //$NON-NLS-1$
- TestElement m3_1 = model.getElement(m3_1Path);
- TestModel m3 = m3_1.getModel();
+ TestElement m3_1 = model.getElement(m3_1Path);
+ TestModel m3 = m3_1.getModel();
TestElement m3_1_new = new TestElement(m3, "m3.1-new", new TestElement[0]); //$NON-NLS-1$
- TreePath m3_1_newPath = m3_1Path.createChildPath(m3_1_new);
- ModelDelta delta = m3.addElementChild(m3_1Path, null, 0, m3_1_new);
+ TreePath m3_1_newPath = m3_1Path.createChildPath(m3_1_new);
+ ModelDelta delta = m3.addElementChild(m3_1Path, null, 0, m3_1_new);
- fListener.reset(m3_1_newPath, m3_1_new, -1, true, false);
- fListener.addChildreUpdate(m3_1Path, 0);
- fListener.setFailOnRedundantUpdates(false);
+ fListener.reset(m3_1_newPath, m3_1_new, -1, true, false);
+ fListener.addChildreUpdate(m3_1Path, 0);
+ fListener.setFailOnRedundantUpdates(false);
- m3.postDelta(delta);
+ m3.postDelta(delta);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
public void testBug292322() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Update the model: remove one child of an un-expanded element, then
- // make sure that the number of children is correct.
+ // Update the model: remove one child of an un-expanded element, then
+ // make sure that the number of children is correct.
TreePath parentPath = model.findElement("2"); //$NON-NLS-1$
- TestElement parentElement = model.getElement(parentPath);
- ModelDelta delta = model.removeElementChild(parentPath, 0);
+ TestElement parentElement = model.getElement(parentPath);
+ ModelDelta delta = model.removeElementChild(parentPath, 0);
- // Update the viewer
- fListener.reset(parentPath, parentElement, 0, false, false);
- //fListener.addChildreCountUpdate(parentPath);
- model.postDelta(delta);
+ // Update the viewer
+ fListener.reset(parentPath, parentElement, 0, false, false);
+ //fListener.addChildreCountUpdate(parentPath);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE), createListenerErrorMessage());
- // Validate the viewer data.
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate the viewer data.
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Update the model: remove the remaining children and make sure that
- // the element children are updated to false.
- model.removeElementChild(parentPath, 0);
+ // Update the model: remove the remaining children and make sure that
+ // the element children are updated to false.
+ model.removeElementChild(parentPath, 0);
- // Update the viewer
- fListener.reset(parentPath, parentElement, 0, false, false);
- model.postDelta(delta);
+ // Update the viewer
+ fListener.reset(parentPath, parentElement, 0, false, false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE), createListenerErrorMessage());
- // Validate the viewer data.
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate the viewer data.
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Update the model: remove the remaining children and make sure that
- // the element children are updated to false.
- model.removeElementChild(parentPath, 0);
+ // Update the model: remove the remaining children and make sure that
+ // the element children are updated to false.
+ model.removeElementChild(parentPath, 0);
- // Update the viewer
- fListener.reset(parentPath, parentElement, 0, false, false);
- model.postDelta(delta);
+ // Update the viewer
+ fListener.reset(parentPath, parentElement, 0, false, false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE), createListenerErrorMessage());
- // Validate the viewer data.
- model.validateData(fViewer, TreePath.EMPTY, true);
- }
+ // Validate the viewer data.
+ model.validateData(fViewer, TreePath.EMPTY, true);
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTests.java
index b4928569c..fb958178a 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTests.java
@@ -37,326 +37,326 @@ import org.eclipse.jface.viewers.ViewerFilter;
*/
abstract public class FilterTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public FilterTests(String name) {
- super(name);
- }
+ public FilterTests(String name) {
+ super(name);
+ }
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, true, true);
}
- protected IInternalTreeModelViewer getInternalViewer() {
- return fViewer;
- }
+ protected IInternalTreeModelViewer getInternalViewer() {
+ return fViewer;
+ }
- class TestViewerFilter extends ViewerFilter {
+ class TestViewerFilter extends ViewerFilter {
- Pattern fPattern;
- TestViewerFilter(String pattern) {
- fPattern = Pattern.compile(pattern);
- }
+ Pattern fPattern;
+ TestViewerFilter(String pattern) {
+ fPattern = Pattern.compile(pattern);
+ }
- @Override
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof TestElement) {
- TestElement te = (TestElement)element;
- return !fPattern.matcher(te.getLabel()).find();
- }
-
- return true;
- }
- }
-
- class TestTMVFilter extends TreeModelViewerFilter {
- Pattern fPattern;
- Object fParentElement;
- TestTMVFilter(String pattern, Object parentElement) {
- fPattern = Pattern.compile(pattern);
- fParentElement = parentElement;
- }
-
- @Override
+ if (element instanceof TestElement) {
+ TestElement te = (TestElement)element;
+ return !fPattern.matcher(te.getLabel()).find();
+ }
+
+ return true;
+ }
+ }
+
+ class TestTMVFilter extends TreeModelViewerFilter {
+ Pattern fPattern;
+ Object fParentElement;
+ TestTMVFilter(String pattern, Object parentElement) {
+ fPattern = Pattern.compile(pattern);
+ fParentElement = parentElement;
+ }
+
+ @Override
public boolean isApplicable(ITreeModelViewer viewer, Object parentElement) {
- if (fParentElement != null) {
- return fParentElement.equals(parentElement);
- }
+ if (fParentElement != null) {
+ return fParentElement.equals(parentElement);
+ }
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof TestElement) {
- TestElement te = (TestElement)element;
- return !fPattern.matcher(te.getLabel()).find();
- }
+ if (element instanceof TestElement) {
+ TestElement te = (TestElement)element;
+ return !fPattern.matcher(te.getLabel()).find();
+ }
- return true;
- }
- }
+ return true;
+ }
+ }
public void testSimpleSingleLevel() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
+ TestModel model = TestModel.simpleSingleLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
- }
+ }
public void testSimpleSingleLevelWithTMVFilter() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
+ TestModel model = TestModel.simpleSingleLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()) }); //$NON-NLS-1$
- }
+ }
public void testSimpleSingleLevelWithMixedFilters() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
+ TestModel model = TestModel.simpleSingleLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()), new TestViewerFilter("1") }); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
public void testSimpleMultiLevel() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") }); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
public void testSimpleMultiLevelWithTMVFilter() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
public void testSimpleMultiLevelWithMixedFilters() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
private void doTestSimpleLevel(TestModel model, ViewerFilter[] filters) throws Exception {
- // Make sure that all elements are expanded
- fViewer.setAutoExpandLevel(-1);
+ // Make sure that all elements are expanded
+ fViewer.setAutoExpandLevel(-1);
- fViewer.setFilters(filters);
+ fViewer.setFilters(filters);
- // Create the listener which determines when the view is finished updating.
- // fListener.reset(TreePath.EMPTY, model.getRootElement(), filters, -1, false, false);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), filters, -1, true, true);
+ // Create the listener which determines when the view is finished updating.
+ // fListener.reset(TreePath.EMPTY, model.getRootElement(), filters, -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), filters, -1, true, true);
- // Set the viewer input (and trigger updates).
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input (and trigger updates).
+ fViewer.setInput(model.getRootElement());
- // Wait for the updates to complete.
+ // Wait for the updates to complete.
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, false, filters);
- }
+ model.validateData(fViewer, TreePath.EMPTY, false, filters);
+ }
public void testLargeSingleLevel() throws Exception {
doTestLargeSingleLevel(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
- }
+ }
public void testLargeSingleLevelWithTMVFilter() throws Exception {
doTestLargeSingleLevel(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
- }
+ }
private void doTestLargeSingleLevel(ViewerFilter[] filters) throws Exception {
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 3000, "model.")); //$NON-NLS-1$
- // Set filters
- fViewer.setFilters(filters);
+ // Set filters
+ fViewer.setFilters(filters);
- fListener.setFailOnRedundantUpdates(false);
- //fListener.setFailOnMultipleLabelUpdateSequences(false);
- fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+ //fListener.setFailOnMultipleLabelUpdateSequences(false);
+ fListener.reset();
- fViewer.setInput(model.getRootElement());
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- }
+ }
- /**
- * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
- * Fire REPLACE delta.
- */
+ /**
+ * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
+ * Fire REPLACE delta.
+ */
public void testReplacedUnrealizedFilteredElement() throws Exception {
doTestReplacedUnrealizedFilteredElement(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
- }
+ }
- /**
- * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
- * Fire REPLACE delta.
- */
+ /**
+ * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
+ * Fire REPLACE delta.
+ */
public void testReplacedUnrealizedFilteredElementWithTMVFilter() throws Exception {
doTestReplacedUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
- }
+ }
private void doTestReplacedUnrealizedFilteredElement(ViewerFilter[] filters) throws Exception {
- // Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
- TestModel model = new TestModel();
+ // Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 300, "model.")); //$NON-NLS-1$
- fViewer.setFilters(filters);
+ fViewer.setFilters(filters);
- fListener.setFailOnRedundantUpdates(false);
- fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+ fListener.reset();
- // Populate the view (all elements containing a "2" will be filtered out.
- fViewer.setInput(model.getRootElement());
+ // Populate the view (all elements containing a "2" will be filtered out.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Switch out element "201" which is filtered out, with a "replaced element" which should NOT be
- // filtered out.
+ // Switch out element "201" which is filtered out, with a "replaced element" which should NOT be
+ // filtered out.
TestElement replacedElement = new TestElement(model, "replaced element", new TestElement[0]); //$NON-NLS-1$
- IModelDelta replaceDelta = model.replaceElementChild(TreePath.EMPTY, 200, replacedElement);
- fListener.reset();
- model.postDelta(replaceDelta);
+ IModelDelta replaceDelta = model.replaceElementChild(TreePath.EMPTY, 200, replacedElement);
+ fListener.reset();
+ model.postDelta(replaceDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Reposition the viewer to make element 100 the top element, making the replaced element visible.
- fListener.reset();
- fViewer.reveal(TreePath.EMPTY, 150);
+ // Reposition the viewer to make element 100 the top element, making the replaced element visible.
+ fListener.reset();
+ fViewer.reveal(TreePath.EMPTY, 150);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Verify that the replaced element is in viewer now (i.e. it's not filtered out.
- TreePath[] replacedElementPaths = fViewer.getElementPaths(replacedElement);
- assertTrue(replacedElementPaths.length != 0);
- }
+ // Verify that the replaced element is in viewer now (i.e. it's not filtered out.
+ TreePath[] replacedElementPaths = fViewer.getElementPaths(replacedElement);
+ assertTrue(replacedElementPaths.length != 0);
+ }
public void testRefreshUnrealizedFilteredElement() throws Exception {
doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
- }
+ }
public void testRefreshUnrealizedFilteredElementWithTMVFilter() throws Exception {
doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
- }
+ }
- /**
- * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
- * Fire CONTENT delta on parent.
- */
+ /**
+ * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
+ * Fire CONTENT delta on parent.
+ */
private void doTestRefreshUnrealizedFilteredElement(ViewerFilter[] filters) throws Exception {
- // Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
- TestModel model = new TestModel();
+ // Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 300, "model.")); //$NON-NLS-1$
- fViewer.setFilters(filters);
+ fViewer.setFilters(filters);
- fListener.setFailOnRedundantUpdates(false);
- fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+ fListener.reset();
- // Populate the view (all elements containing a "2" will be filtered out.
- fViewer.setInput(model.getRootElement());
+ // Populate the view (all elements containing a "2" will be filtered out.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Switch out element "201" which is filtered out, with a "replaced element" which should NOT be
- // filtered out.
+ // Switch out element "201" which is filtered out, with a "replaced element" which should NOT be
+ // filtered out.
TestElement replacedElement = new TestElement(model, "replaced element", new TestElement[0]); //$NON-NLS-1$
- model.replaceElementChild(TreePath.EMPTY, 200, replacedElement);
- fListener.reset();
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ model.replaceElementChild(TreePath.EMPTY, 200, replacedElement);
+ fListener.reset();
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Reposition the viewer to make element 100 the top element, making the replaced element visible.
- fListener.reset();
- fViewer.reveal(TreePath.EMPTY, 150);
+ // Reposition the viewer to make element 100 the top element, making the replaced element visible.
+ fListener.reset();
+ fViewer.reveal(TreePath.EMPTY, 150);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Verify that the replaced element is in viewer now (i.e. it's not filtered out.
- TreePath[] replacedElementPaths = fViewer.getElementPaths(replacedElement);
- assertTrue(replacedElementPaths.length != 0);
- }
+ // Verify that the replaced element is in viewer now (i.e. it's not filtered out.
+ TreePath[] replacedElementPaths = fViewer.getElementPaths(replacedElement);
+ assertTrue(replacedElementPaths.length != 0);
+ }
public void testRefreshToUnfilterElements() throws Exception {
doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") }); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
public void testRefreshToUnfilterElementsWithTMVFilter() throws Exception {
doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
public void testRefreshToUnfilterElementsWithMixedFilters() throws Exception {
doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
- /**
- * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
- * Fire CONTENT delta on parent.
- */
+ /**
+ * Replace an element that is not visible but filtered out. With an element that is NOT filtered out.
+ * Fire CONTENT delta on parent.
+ */
private void doTestRefreshToUnfilterElements(ViewerFilter[] filters) throws Exception {
ViewerFilter[] filters1 = filters;
- // Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
- TestModel model = TestModel.simpleMultiLevel();
+ // Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
+ TestModel model = TestModel.simpleMultiLevel();
- fViewer.setFilters(filters);
+ fViewer.setFilters(filters);
- fListener.setFailOnRedundantUpdates(false);
- fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+ fListener.reset();
- // Make sure that all elements are expanded
- fViewer.setAutoExpandLevel(-1);
+ // Make sure that all elements are expanded
+ fViewer.setAutoExpandLevel(-1);
- // Populate the view (all elements containing a "2" will be filtered out.
- fViewer.setInput(model.getRootElement());
+ // Populate the view (all elements containing a "2" will be filtered out.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Turn off filters and refresh.
+ // Turn off filters and refresh.
filters1 = new ViewerFilter[0];
fViewer.setFilters(filters1);
- fListener.reset();
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ fListener.reset();
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
model.validateData(fViewer, TreePath.EMPTY, false, filters1);
- }
+ }
public void testPreserveExpandedOnMultLevelContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = StateTests.alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = StateTests.alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- StateTests.expandAlternateElements(fListener, model, true);
+ StateTests.expandAlternateElements(fListener, model, true);
- // Set a selection in view
- // Set a selection in view
- TreeSelection originalSelection = new TreeSelection(
+ // Set a selection in view
+ // Set a selection in view
+ TreeSelection originalSelection = new TreeSelection(
new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fViewer.setSelection(originalSelection);
- assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ fViewer.setSelection(originalSelection);
+ assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Set a filter to remove element "1"
+ // Set a filter to remove element "1"
ViewerFilter[] filters = new ViewerFilter[] { new TestViewerFilter("^1$") }; //$NON-NLS-1$
- fViewer.setFilters(filters);
+ fViewer.setFilters(filters);
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), filters, -1, ALL_UPDATES_COMPLETE);
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), filters, -1, ALL_UPDATES_COMPLETE);
- // Post the refresh delta
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Post the refresh delta
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true, filters);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true, filters);
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -364,24 +364,24 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Note: in past it was observed sub-optimal coalescing in this test due
- // to scattered update requests from viewer.
- assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
+ // Note: in past it was observed sub-optimal coalescing in this test due
+ // to scattered update requests from viewer.
+ assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
- // Clear the filter, to re-add the element
- filters = new ViewerFilter[0];
- fViewer.setFilters(filters);
+ // Clear the filter, to re-add the element
+ filters = new ViewerFilter[0];
+ fViewer.setFilters(filters);
- // Refresh again to get the filtered element back
- fListener.reset();
- fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), filters, -1, ALL_UPDATES_COMPLETE);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh again to get the filtered element back
+ fListener.reset();
+ fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), filters, -1, ALL_UPDATES_COMPLETE);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true, filters);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true, filters);
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -389,8 +389,8 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java
index d195e59fd..332723b61 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java
@@ -20,35 +20,35 @@ package org.eclipse.debug.tests.viewer.model;
*/
public interface ITestModelUpdatesListenerConstants {
- int LABEL_SEQUENCE_COMPLETE = 0X00000001;
- int CONTENT_SEQUENCE_COMPLETE = 0X00000002;
- int CONTENT_SEQUENCE_STARTED = 0X00020000;
- int LABEL_UPDATES = 0X00000004;
- int LABEL_SEQUENCE_STARTED = 0X00040000;
- int HAS_CHILDREN_UPDATES = 0X00000008;
- int HAS_CHILDREN_UPDATES_STARTED = 0X00080000;
- int CHILD_COUNT_UPDATES = 0X00000010;
- int CHILD_COUNT_UPDATES_STARTED = 0X00100000;
- int CHILDREN_UPDATES = 0X00000020;
- int CHILDREN_UPDATES_STARTED = 0X00200000;
- int CHILDREN_UPDATES_RUNNING = 0X00400000;
- int MODEL_CHANGED_COMPLETE = 0X00000040;
- int MODEL_PROXIES_INSTALLED = 0X00000080;
- int STATE_SAVE_COMPLETE = 0X00000100;
- int STATE_SAVE_STARTED = 0X01000000;
- int STATE_RESTORE_COMPLETE = 0X00000200;
- int STATE_RESTORE_STARTED = 0X02000000;
- int STATE_UPDATES = 0X00000400;
- int STATE_UPDATES_STARTED = 0X04000000;
+ int LABEL_SEQUENCE_COMPLETE = 0X00000001;
+ int CONTENT_SEQUENCE_COMPLETE = 0X00000002;
+ int CONTENT_SEQUENCE_STARTED = 0X00020000;
+ int LABEL_UPDATES = 0X00000004;
+ int LABEL_SEQUENCE_STARTED = 0X00040000;
+ int HAS_CHILDREN_UPDATES = 0X00000008;
+ int HAS_CHILDREN_UPDATES_STARTED = 0X00080000;
+ int CHILD_COUNT_UPDATES = 0X00000010;
+ int CHILD_COUNT_UPDATES_STARTED = 0X00100000;
+ int CHILDREN_UPDATES = 0X00000020;
+ int CHILDREN_UPDATES_STARTED = 0X00200000;
+ int CHILDREN_UPDATES_RUNNING = 0X00400000;
+ int MODEL_CHANGED_COMPLETE = 0X00000040;
+ int MODEL_PROXIES_INSTALLED = 0X00000080;
+ int STATE_SAVE_COMPLETE = 0X00000100;
+ int STATE_SAVE_STARTED = 0X01000000;
+ int STATE_RESTORE_COMPLETE = 0X00000200;
+ int STATE_RESTORE_STARTED = 0X02000000;
+ int STATE_UPDATES = 0X00000400;
+ int STATE_UPDATES_STARTED = 0X04000000;
- int VIEWER_UPDATES_RUNNING = 0X00001000;
- int LABEL_UPDATES_RUNNING = 0X00002000;
+ int VIEWER_UPDATES_RUNNING = 0X00001000;
+ int LABEL_UPDATES_RUNNING = 0X00002000;
- int ALL_VIEWER_UPDATES_STARTED = HAS_CHILDREN_UPDATES_STARTED | CHILD_COUNT_UPDATES_STARTED | CHILDREN_UPDATES_STARTED;
+ int ALL_VIEWER_UPDATES_STARTED = HAS_CHILDREN_UPDATES_STARTED | CHILD_COUNT_UPDATES_STARTED | CHILDREN_UPDATES_STARTED;
- int LABEL_COMPLETE = LABEL_SEQUENCE_COMPLETE | LABEL_UPDATES | LABEL_UPDATES_RUNNING;
- int CONTENT_COMPLETE =
- CONTENT_SEQUENCE_COMPLETE | HAS_CHILDREN_UPDATES | CHILD_COUNT_UPDATES | CHILDREN_UPDATES | VIEWER_UPDATES_RUNNING;
+ int LABEL_COMPLETE = LABEL_SEQUENCE_COMPLETE | LABEL_UPDATES | LABEL_UPDATES_RUNNING;
+ int CONTENT_COMPLETE =
+ CONTENT_SEQUENCE_COMPLETE | HAS_CHILDREN_UPDATES | CHILD_COUNT_UPDATES | CHILDREN_UPDATES | VIEWER_UPDATES_RUNNING;
- int ALL_UPDATES_COMPLETE = LABEL_COMPLETE | CONTENT_COMPLETE | MODEL_PROXIES_INSTALLED | LABEL_UPDATES_RUNNING | VIEWER_UPDATES_RUNNING;
+ int ALL_UPDATES_COMPLETE = LABEL_COMPLETE | CONTENT_COMPLETE | MODEL_PROXIES_INSTALLED | LABEL_UPDATES_RUNNING | VIEWER_UPDATES_RUNNING;
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerCheckTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerCheckTests.java
index c596da581..21e849d19 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerCheckTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerCheckTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerCheckTests extends CheckTests {
- public JFaceViewerCheckTests(String name) {
- super(name);
- }
+ public JFaceViewerCheckTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.CHECK, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerContentTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerContentTests.java
index 85b8f32ca..53feebda2 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerContentTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerContentTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerContentTests extends ContentTests {
- public JFaceViewerContentTests(String name) {
- super(name);
- }
+ public JFaceViewerContentTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerDeltaTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerDeltaTests.java
index 356c20a46..5bfa72a37 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerDeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerDeltaTests.java
@@ -26,19 +26,19 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerDeltaTests extends DeltaTests {
- public JFaceViewerDeltaTests(String name) {
- super(name);
- }
+ public JFaceViewerDeltaTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
- /**
- * TODO: remove this method when bug 292322 gets fixed in TreeViewer
- */
- @Override
+ /**
+ * TODO: remove this method when bug 292322 gets fixed in TreeViewer
+ */
+ @Override
public void testBug292322() {
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerFilterTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerFilterTests.java
index e4d8d8d6a..e120aa4c9 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerFilterTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerFilterTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerFilterTests extends FilterTests {
- public JFaceViewerFilterTests(String name) {
- super(name);
- }
+ public JFaceViewerFilterTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerLazyTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerLazyTests.java
index 271c9f2a3..9d042f74b 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerLazyTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerLazyTests.java
@@ -25,12 +25,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerLazyTests extends LazyTests {
- public JFaceViewerLazyTests(String name) {
- super(name);
- }
+ public JFaceViewerLazyTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
index 9a855265d..ed4b6815f 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
@@ -25,17 +25,17 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerPerformanceTests extends PerformanceTests {
- public JFaceViewerPerformanceTests(String name) {
- super(name);
- }
+ public JFaceViewerPerformanceTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
protected int getTestModelDepth() {
- return 5;
- }
+ return 5;
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPopupTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPopupTests.java
index 221e68def..eda0e22a3 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPopupTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerPopupTests extends PopupTests {
- public JFaceViewerPopupTests(String name) {
- super(name);
- }
+ public JFaceViewerPopupTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell, int style) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | style, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerSelectionTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerSelectionTests.java
index e60f5cadb..b520b9b31 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerSelectionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerSelectionTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerSelectionTests extends SelectionTests {
- public JFaceViewerSelectionTests(String name) {
- super(name);
- }
+ public JFaceViewerSelectionTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerStateTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerStateTests.java
index 46e1fd6b2..ef8b08746 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerStateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerStateTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerStateTests extends StateTests {
- public JFaceViewerStateTests(String name) {
- super(name);
- }
+ public JFaceViewerStateTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerTopIndexTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
index 05415e6c2..d0ffc8645 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
@@ -35,9 +35,9 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public JFaceViewerTopIndexTests(String name) {
- super(name);
- }
+ public JFaceViewerTopIndexTests(String name) {
+ super(name);
+ }
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
@@ -46,445 +46,445 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
protected final TreeModelViewer getCTargetViewer() {
return (TreeModelViewer) fViewer;
- }
-
- /**
- * @param display the display
- * @param shell the shell
- * @return the new viewer
- */
- @Override
+ }
+
+ /**
+ * @param display the display
+ * @param shell the shell
+ * @return the new viewer
+ */
+ @Override
protected TreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
- /**
- * Restore REVEAL on simple model with elements without children.
- *
- */
+ /**
+ * Restore REVEAL on simple model with elements without children.
+ *
+ */
public void testRestoreTopIndex() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
- TestElement[] elements = new TestElement[8];
- for (int i = 0; i < elements.length; i++) {
- String text = Integer.toString(i + 1);
- // elements don't have children
- elements[i] =
- new TestElement(model, text, new TestElement[0] );
+ TestElement[] elements = new TestElement[8];
+ for (int i = 0; i < elements.length; i++) {
+ String text = Integer.toString(i + 1);
+ // elements don't have children
+ elements[i] =
+ new TestElement(model, text, new TestElement[0] );
- }
+ }
model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Stop forcing view updates.
- autopopulateAgent.dispose();
+ // Stop forcing view updates.
+ autopopulateAgent.dispose();
- // scroll to the 5th element
- int indexRevealElem = 4;
- getCTargetViewer().reveal(TreePath.EMPTY, indexRevealElem);
+ // scroll to the 5th element
+ int indexRevealElem = 4;
+ getCTargetViewer().reveal(TreePath.EMPTY, indexRevealElem);
TestUtil.processUIEvents();
- final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
+ final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
- // Bug 116105: On a Mac the reveal call is not reliable. Use the viewer returned path instead.
- // assertEquals(elements[indexRevealElem], originalTopPath.getLastSegment());
+ // Bug 116105: On a Mac the reveal call is not reliable. Use the viewer returned path instead.
+ // assertEquals(elements[indexRevealElem], originalTopPath.getLastSegment());
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
- fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(true, false);
+ fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
- // Set the viewer input back to the model to trigger RESTORE operation.
- fListener.reset(false, false);
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model to trigger RESTORE operation.
+ fListener.reset(false, false);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
TestUtil.processUIEvents();
- // check if REVEAL was restored OK
- final TreePath topPath = getCTargetViewer().getTopElementPath();
+ // check if REVEAL was restored OK
+ final TreePath topPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
- TreePathWrapper.assertEqual(originalTopPath, topPath);
- }
-
- /**
- * Restore REVEAL when having also to restore an expanded element
- * that is just above the REVEAL element.
- *
- * See bug 324100
- */
+ TreePathWrapper.assertEqual(originalTopPath, topPath);
+ }
+
+ /**
+ * Restore REVEAL when having also to restore an expanded element
+ * that is just above the REVEAL element.
+ *
+ * See bug 324100
+ */
public void testRestoreTopAndExpand() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
- TestElement[] elements = new TestElement[10];
- for (int i = 0; i < elements.length; i++) {
- String text = Integer.toString(i + 1);
- // first element has 2 children
- if (i == 0) {
- elements[i] =
- new TestElement(model, text, new TestElement[] {
+ TestElement[] elements = new TestElement[10];
+ for (int i = 0; i < elements.length; i++) {
+ String text = Integer.toString(i + 1);
+ // first element has 2 children
+ if (i == 0) {
+ elements[i] =
+ new TestElement(model, text, new TestElement[] {
new TestElement(model, text + ".1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, text + ".2", new TestElement[0]) //$NON-NLS-1$
- });
- } else {
- // rest of elements don't have children
- elements[i] =
- new TestElement(model, text, new TestElement[0] );
- }
-
- }
+ });
+ } else {
+ // rest of elements don't have children
+ elements[i] =
+ new TestElement(model, text, new TestElement[0] );
+ }
+
+ }
model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Expand first element
- fListener.reset();
- fListener.setFailOnRedundantUpdates(false);
- int indexFirstElem = 0;
- TestElement firstElem = elements[indexFirstElem];
- ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- ModelDelta delta = model.getBaseDelta(rootDelta);
- TreePath firstElemPath = model.findElement(firstElem.getLabel());
- fListener.addUpdates(
- firstElemPath, firstElem, 1,
- CHILD_COUNT_UPDATES | CHILDREN_UPDATES );
- delta.addNode(firstElem, indexFirstElem, IModelDelta.EXPAND, firstElem.getChildren().length);
-
- model.postDelta(rootDelta);
+ model.validateData(fViewer, TreePath.EMPTY, true);
+
+ // Expand first element
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+ int indexFirstElem = 0;
+ TestElement firstElem = elements[indexFirstElem];
+ ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ ModelDelta delta = model.getBaseDelta(rootDelta);
+ TreePath firstElemPath = model.findElement(firstElem.getLabel());
+ fListener.addUpdates(
+ firstElemPath, firstElem, 1,
+ CHILD_COUNT_UPDATES | CHILDREN_UPDATES );
+ delta.addNode(firstElem, indexFirstElem, IModelDelta.EXPAND, firstElem.getChildren().length);
+
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Validate that the first node is expanded
- assertTrue(getCTargetViewer().getExpandedState(firstElemPath) == true);
+ // Validate that the first node is expanded
+ assertTrue(getCTargetViewer().getExpandedState(firstElemPath) == true);
- // Stop forcing view updates.
- autopopulateAgent.dispose();
+ // Stop forcing view updates.
+ autopopulateAgent.dispose();
- // scroll to the 2nd element
- getCTargetViewer().reveal(TreePath.EMPTY, 1);
+ // scroll to the 2nd element
+ getCTargetViewer().reveal(TreePath.EMPTY, 1);
TestUtil.processUIEvents();
- final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
+ final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
- // Bug 116105: On a Mac the reveal call is not reliable. Use the viewer returned path instead.
- //assertEquals(elements[1], originalTopPath.getLastSegment());
+ // Bug 116105: On a Mac the reveal call is not reliable. Use the viewer returned path instead.
+ //assertEquals(elements[1], originalTopPath.getLastSegment());
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
- fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(true, false);
+ fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE), createListenerErrorMessage());
- // Set the viewer input back to the model
- fListener.reset(false, false);
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model
+ fListener.reset(false, false);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
TestUtil.processUIEvents();
- // check if REVEAL was restored OK
- final TreePath topPath = getCTargetViewer().getTopElementPath();
+ // check if REVEAL was restored OK
+ final TreePath topPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
- TreePathWrapper.assertEqual(originalTopPath, topPath);
- }
-
- /**
- * Restore REVEAL when this operation triggers restoring of an expanded
- * element.
- *
- * See bug 324100
- */
+ TreePathWrapper.assertEqual(originalTopPath, topPath);
+ }
+
+ /**
+ * Restore REVEAL when this operation triggers restoring of an expanded
+ * element.
+ *
+ * See bug 324100
+ */
public void testRestoreTopTriggersExpand() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
- TestElement[] elements = new TestElement[10];
- for (int i = 0; i < elements.length; i++) {
- String text = Integer.toString(i + 1);
- // last element has 2 children
- if (i == elements.length - 1) {
- elements[i] =
- new TestElement(model, text, new TestElement[] {
+ TestElement[] elements = new TestElement[10];
+ for (int i = 0; i < elements.length; i++) {
+ String text = Integer.toString(i + 1);
+ // last element has 2 children
+ if (i == elements.length - 1) {
+ elements[i] =
+ new TestElement(model, text, new TestElement[] {
new TestElement(model, text + ".1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, text + ".2", new TestElement[0]) //$NON-NLS-1$
- });
- } else {
- // rest of elements don't have children
- elements[i] =
- new TestElement(model, text, new TestElement[0] );
- }
+ });
+ } else {
+ // rest of elements don't have children
+ elements[i] =
+ new TestElement(model, text, new TestElement[0] );
+ }
- }
+ }
- fViewer.setAutoExpandLevel(-1);
+ fViewer.setAutoExpandLevel(-1);
model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- int indexLastElem = elements.length-1;
- TestElement lastElem = elements[indexLastElem];
- TreePath lastElemePath = model.findElement(lastElem.getLabel());
+ int indexLastElem = elements.length-1;
+ TestElement lastElem = elements[indexLastElem];
+ TreePath lastElemePath = model.findElement(lastElem.getLabel());
- // Validate that the last node is expanded
- assertTrue(getCTargetViewer().getExpandedState(lastElemePath) == true);
+ // Validate that the last node is expanded
+ assertTrue(getCTargetViewer().getExpandedState(lastElemePath) == true);
- // Stop forcing view updates.
- fViewer.setAutoExpandLevel(0);
- autopopulateAgent.dispose();
+ // Stop forcing view updates.
+ fViewer.setAutoExpandLevel(0);
+ autopopulateAgent.dispose();
- // scroll to the element before last element
- getCTargetViewer().reveal(TreePath.EMPTY, indexLastElem-1);
+ // scroll to the element before last element
+ getCTargetViewer().reveal(TreePath.EMPTY, indexLastElem-1);
TestUtil.processUIEvents();
- final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
+ final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
- fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(true, false);
+ fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
- // Set the viewer input back to the model.
- fListener.reset(false, false);
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model.
+ fListener.reset(false, false);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
TestUtil.processUIEvents();
- // check if REVEAL was restored OK
- final TreePath topPath = getCTargetViewer().getTopElementPath();
+ // check if REVEAL was restored OK
+ final TreePath topPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
- TreePathWrapper.assertEqual(originalTopPath, topPath);
- }
-
- /**
- * Test for bug 326965.<br>
- * This test verifies that canceling a reveal pending state delta is
- * properly handled when a new reveal delta is received from the model.
- */
+ TreePathWrapper.assertEqual(originalTopPath, topPath);
+ }
+
+ /**
+ * Test for bug 326965.<br>
+ * This test verifies that canceling a reveal pending state delta is
+ * properly handled when a new reveal delta is received from the model.
+ */
public void testRestoreRevealAfterRevealCancel() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Stop autopopulating the view.
- autopopulateAgent.dispose();
+ // Stop autopopulating the view.
+ autopopulateAgent.dispose();
- // Set top index of view to element "3" and wait for view to repaint.
- getCTargetViewer().reveal(TreePath.EMPTY, 2);
+ // Set top index of view to element "3" and wait for view to repaint.
+ getCTargetViewer().reveal(TreePath.EMPTY, 2);
TestUtil.processUIEvents();
- // Trigger save of state.
- fListener.reset();
- fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ // Trigger save of state.
+ fListener.reset();
+ fViewer.setInput(null);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
Thread.sleep(0);
}
- // Set input back to root element.
- // Note: Wait only for the processing of the delta and the start of state restore, not for all updates
- fListener.reset();
+ // Set input back to root element.
+ // Note: Wait only for the processing of the delta and the start of state restore, not for all updates
+ fListener.reset();
TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
- fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 1, STATE_UPDATES);
- fViewer.setInput(model.getRootElement());
+ fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 1, STATE_UPDATES);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
- // Update the viewer with new selection delta to something new in the view
+ // Update the viewer with new selection delta to something new in the view
ModelDelta revealDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.REVEAL); //$NON-NLS-1$
- // Wait for the second model delta to process
- fListener.reset();
- model.postDelta(revealDelta);
+ // Wait for the second model delta to process
+ fListener.reset();
+ model.postDelta(revealDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Clear view then reset it again.
- fListener.reset();
- fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ // Clear view then reset it again.
+ fListener.reset();
+ fViewer.setInput(null);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
Thread.sleep(0);
}
autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
- fViewer.setInput(model.getRootElement());
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- autopopulateAgent.dispose();
- }
-
- /**
- * Test for bug 326965.<br>
- * This test verifies that canceling a reveal pending state delta is
- * properly handled when a new reveal delta is received from the model.
- */
+ autopopulateAgent.dispose();
+ }
+
+ /**
+ * Test for bug 326965.<br>
+ * This test verifies that canceling a reveal pending state delta is
+ * properly handled when a new reveal delta is received from the model.
+ */
public void testRestoreRevealAfterRevealCancel2() throws Exception {
- if (Platform.getOS().equals(Platform.OS_MACOSX)) {
- // skip this test on Mac - see bug 327557
- return;
- }
+ if (Platform.getOS().equals(Platform.OS_MACOSX)) {
+ // skip this test on Mac - see bug 327557
+ return;
+ }
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Stop auto-populating and auto-expanding the view.
- fViewer.setAutoExpandLevel(0);
- autopopulateAgent.dispose();
+ // Stop auto-populating and auto-expanding the view.
+ fViewer.setAutoExpandLevel(0);
+ autopopulateAgent.dispose();
- // Set top index of view to element "3" and wait for view to repaint.
- getCTargetViewer().reveal(TreePath.EMPTY, 2);
+ // Set top index of view to element "3" and wait for view to repaint.
+ getCTargetViewer().reveal(TreePath.EMPTY, 2);
TestUtil.processUIEvents();
- // Trigger save of state.
- fListener.reset();
- fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ // Trigger save of state.
+ fListener.reset();
+ fViewer.setInput(null);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
Thread.sleep(0);
}
- // Set input back to root element.
- // Note: Wait only for the processing of the delta and the start of state restore, not for all updates
- fListener.reset();
+ // Set input back to root element.
+ // Note: Wait only for the processing of the delta and the start of state restore, not for all updates
+ fListener.reset();
TreePath elementPath = model.findElement("2"); //$NON-NLS-1$
- fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 1, STATE_UPDATES | CHILDREN_UPDATES | LABEL_UPDATES);
+ fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 1, STATE_UPDATES | CHILDREN_UPDATES | LABEL_UPDATES);
elementPath = model.findElement("3"); //$NON-NLS-1$
- fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 0, STATE_UPDATES);
- fViewer.setInput(model.getRootElement());
+ fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 0, STATE_UPDATES);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(STATE_UPDATES), createListenerErrorMessage());
- // Update the viewer with new selection delta to something new in the view
+ // Update the viewer with new selection delta to something new in the view
TreePath pathToBeRevealed = model.findElement("2.1"); //$NON-NLS-1$
- ModelDelta revealDelta = model.makeElementDelta(pathToBeRevealed, IModelDelta.REVEAL);
- revealDelta.accept(new IModelDeltaVisitor() {
+ ModelDelta revealDelta = model.makeElementDelta(pathToBeRevealed, IModelDelta.REVEAL);
+ revealDelta.accept(new IModelDeltaVisitor() {
- @Override
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- ((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.EXPAND);
- return true;
- }
- });
+ ((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.EXPAND);
+ return true;
+ }
+ });
- // Wait for the second model delta to process
- model.postDelta(revealDelta);
+ // Wait for the second model delta to process
+ model.postDelta(revealDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES | LABEL_UPDATES), createListenerErrorMessage());
- // check if REVEAL was triggered by the delta and not by the
- // state restore operation
- TreePath topPath = getCTargetViewer().getTopElementPath();
+ // check if REVEAL was triggered by the delta and not by the
+ // state restore operation
+ TreePath topPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
- TreePathWrapper.assertEqual(pathToBeRevealed, topPath);
- }
+ TreePathWrapper.assertEqual(pathToBeRevealed, topPath);
+ }
- /**
- * Restore REVEAL when having also to restore an expanded element
- * that is just above the REVEAL element.
- *
- * See bug 324100
- */
+ /**
+ * Restore REVEAL when having also to restore an expanded element
+ * that is just above the REVEAL element.
+ *
+ * See bug 324100
+ */
public void testRestoreDeepTreeAndReveal() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
- TestModel model = TestModel.simpleDeepMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleDeepMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Stop forcing view updates.
- autopopulateAgent.dispose();
+ // Stop forcing view updates.
+ autopopulateAgent.dispose();
- // Scroll down to the last part of the tree.
+ // Scroll down to the last part of the tree.
getCTargetViewer().reveal(model.findElement("3.6.3.16.16.16.16.16"), 1); //$NON-NLS-1$
TestUtil.processUIEvents();
- final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
+ final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
- fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(true, false);
+ fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE), createListenerErrorMessage());
- // Set the viewer input back to the model
- fListener.reset(false, false);
- fListener.addUpdates(getCTargetViewer(), originalTopPath, (TestElement)originalTopPath.getLastSegment(), 0, STATE_UPDATES);
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model
+ fListener.reset(false, false);
+ fListener.addUpdates(getCTargetViewer(), originalTopPath, (TestElement)originalTopPath.getLastSegment(), 0, STATE_UPDATES);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(STATE_UPDATES | CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
TestUtil.processUIEvents();
- // check if REVEAL was restored OK
- final TreePath topPath = getCTargetViewer().getTopElementPath();
+ // check if REVEAL was restored OK
+ final TreePath topPath = getCTargetViewer().getTopElementPath();
assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
- TreePathWrapper.assertEqual(originalTopPath, topPath);
+ TreePathWrapper.assertEqual(originalTopPath, topPath);
- }
+ }
/**
* This test verifies that a revealed node does not get scrolled away due to
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerUpdateTests.java
index 67193e40d..4a1d39f9e 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerUpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerUpdateTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerUpdateTests extends UpdateTests {
- public JFaceViewerUpdateTests(String name) {
- super(name);
- }
+ public JFaceViewerUpdateTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/LazyTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/LazyTests.java
index d874b6625..2819182c2 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/LazyTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/LazyTests.java
@@ -30,187 +30,187 @@ import org.eclipse.jface.viewers.TreeSelection;
*/
abstract public class LazyTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public LazyTests(String name) {
- super(name);
- }
+ public LazyTests(String name) {
+ super(name);
+ }
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, true, true);
}
- /**
- * Creates a model in the pattern of:
- *
- * root
- * 1
- * 1.1
- * 1.2
- * 1.3
- * ...
- * 1.(size)
- */
- private TestModel largeSubtreeModel(int size) {
- TestModel model = new TestModel();
- TestElement[] children = new TestElement[size];
- for (int i = 0; i < size; i++) {
+ /**
+ * Creates a model in the pattern of:
+ *
+ * root
+ * 1
+ * 1.1
+ * 1.2
+ * 1.3
+ * ...
+ * 1.(size)
+ */
+ private TestModel largeSubtreeModel(int size) {
+ TestModel model = new TestModel();
+ TestElement[] children = new TestElement[size];
+ for (int i = 0; i < size; i++) {
children[i] = new TestElement(model, "1." + i, new TestElement[0]); //$NON-NLS-1$
- }
+ }
TestElement element = new TestElement(model, "1", children); //$NON-NLS-1$
model.setRoot(new TestElement(model, "root", new TestElement[] { element })); //$NON-NLS-1$
- return model;
- }
+ return model;
+ }
- /**
- * Test to make sure that if an element is expanded its children are
- * not automatically materialized.
- * (bug 305739 and bug 304277)
- */
+ /**
+ * Test to make sure that if an element is expanded its children are
+ * not automatically materialized.
+ * (bug 305739 and bug 304277)
+ */
public void testExpandLargeSubTree() throws Exception {
- // Create test model with lots of children.
- TestModel model = largeSubtreeModel(1000);
+ // Create test model with lots of children.
+ TestModel model = largeSubtreeModel(1000);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Populate initial view content
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, true);
- fViewer.setInput(model.getRootElement());
+ // Populate initial view content
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, true);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Create delta to expand the "1" element.
- TestElement rootElement = model.getRootElement();
- ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
- ModelDelta expandDelta = model.getBaseDelta(rootDelta);
- TestElement expandElement = rootElement.getChildren()[0];
- expandDelta.addNode(expandElement, 0, IModelDelta.EXPAND, expandElement.getChildren().length);
+ // Create delta to expand the "1" element.
+ TestElement rootElement = model.getRootElement();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
+ ModelDelta expandDelta = model.getBaseDelta(rootDelta);
+ TestElement expandElement = rootElement.getChildren()[0];
+ expandDelta.addNode(expandElement, 0, IModelDelta.EXPAND, expandElement.getChildren().length);
- // Add first 250 elements as acceptable to materialize
- fListener.reset();
- fListener.setFailOnRedundantUpdates(true);
+ // Add first 250 elements as acceptable to materialize
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(true);
TreePath expandElementPath = model.findElement("1"); //$NON-NLS-1$
- fListener.addChildreCountUpdate(expandElementPath);
- fListener.addLabelUpdate(expandElementPath); // TODO: not sure why label is updated upon expand?
- for (int i = 0; i < 250; i++) {
- fListener.addChildreUpdate(expandElementPath, i);
- TreePath childPath = expandElementPath.createChildPath(expandElement.getChildren()[i]);
- fListener.addLabelUpdate(childPath);
- fListener.addHasChildrenUpdate(childPath);
- }
- model.postDelta(rootDelta);
+ fListener.addChildreCountUpdate(expandElementPath);
+ fListener.addLabelUpdate(expandElementPath); // TODO: not sure why label is updated upon expand?
+ for (int i = 0; i < 250; i++) {
+ fListener.addChildreUpdate(expandElementPath, i);
+ TreePath childPath = expandElementPath.createChildPath(expandElement.getChildren()[i]);
+ fListener.addLabelUpdate(childPath);
+ fListener.addHasChildrenUpdate(childPath);
+ }
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE | LABEL_SEQUENCE_COMPLETE), createListenerErrorMessage());
- }
+ }
- /**
- * Test to make sure that if an element that is previously selected, is
- * then selected and replaced, that no extra elements are retrieved.
- * (bug 304277 comment #24, and bug 305739 comment #9).
- */
+ /**
+ * Test to make sure that if an element that is previously selected, is
+ * then selected and replaced, that no extra elements are retrieved.
+ * (bug 304277 comment #24, and bug 305739 comment #9).
+ */
public void testReplaceAndSelectInSubTreeTree() throws Exception {
- // Create test model with lots of children.
- TestModel model = largeSubtreeModel(1000);
-
- // Expand all children
- fViewer.setAutoExpandLevel(-1);
-
- // Populate initial view content, watch for all updates but only wait
- // for the content update sequence to finish (elements off screen will
- // not be updated).
- // TODO: child count for element 1 is updated multiple times.
- fListener.reset();
- fListener.setFailOnMultipleModelUpdateSequences(true);
- fListener.setFailOnRedundantUpdates(false);
- fViewer.setInput(model.getRootElement());
+ // Create test model with lots of children.
+ TestModel model = largeSubtreeModel(1000);
+
+ // Expand all children
+ fViewer.setAutoExpandLevel(-1);
+
+ // Populate initial view content, watch for all updates but only wait
+ // for the content update sequence to finish (elements off screen will
+ // not be updated).
+ // TODO: child count for element 1 is updated multiple times.
+ fListener.reset();
+ fListener.setFailOnMultipleModelUpdateSequences(true);
+ fListener.setFailOnRedundantUpdates(false);
+ fViewer.setInput(model.getRootElement());
fListener.addLabelUpdate(model.findElement("1.0")); //$NON-NLS-1$
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_COMPLETE), createListenerErrorMessage());
- // Set selection so that the initial selection is not empty
+ // Set selection so that the initial selection is not empty
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("1.0") })); //$NON-NLS-1$
- // Create delta to select the "1" element.
- TestElement rootElement = model.getRootElement();
- ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = model.getBaseDelta(rootDelta);
- TestElement _1Element = rootElement.getChildren()[0];
- ModelDelta _1Delta = baseDelta.addNode(_1Element, 0, IModelDelta.NO_CHANGE, _1Element.getChildren().length);
+ // Create delta to select the "1" element.
+ TestElement rootElement = model.getRootElement();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = model.getBaseDelta(rootDelta);
+ TestElement _1Element = rootElement.getChildren()[0];
+ ModelDelta _1Delta = baseDelta.addNode(_1Element, 0, IModelDelta.NO_CHANGE, _1Element.getChildren().length);
- // Add the delta to select the "1.1" element.
+ // Add the delta to select the "1.1" element.
TestElement _1_0_newElement = new TestElement(model, "1.0 - new", new TestElement[0]); //$NON-NLS-1$
TreePath _1ElementPath = model.findElement("1"); //$NON-NLS-1$
- model.replaceElementChild(_1ElementPath, 0, _1_0_newElement);
- _1Delta.addNode(_1_0_newElement, 0, IModelDelta.SELECT);
+ model.replaceElementChild(_1ElementPath, 0, _1_0_newElement);
+ _1Delta.addNode(_1_0_newElement, 0, IModelDelta.SELECT);
- // Add element label update and post the delta
- fListener.reset();
- fListener.setFailOnRedundantUpdates(true);
+ // Add element label update and post the delta
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(true);
TreePath _1_0_newElementPath = model.findElement("1.0 - new"); //$NON-NLS-1$
- fListener.addLabelUpdate(_1_0_newElementPath);
- model.postDelta(rootDelta);
+ fListener.addLabelUpdate(_1_0_newElementPath);
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | LABEL_COMPLETE), createListenerErrorMessage());
- assertEquals(((IStructuredSelection)fViewer.getSelection()).getFirstElement(), _1_0_newElement);
- }
+ assertEquals(((IStructuredSelection)fViewer.getSelection()).getFirstElement(), _1_0_newElement);
+ }
- /**
- */
+ /**
+ */
public void testContentRefresh() throws Exception {
- // Create test model with lots of children.
- TestModel model = largeSubtreeModel(1000);
+ // Create test model with lots of children.
+ TestModel model = largeSubtreeModel(1000);
- // Expand children all
- fViewer.setAutoExpandLevel(-1);
+ // Expand children all
+ fViewer.setAutoExpandLevel(-1);
- // Populate initial view content
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
- fViewer.setInput(model.getRootElement());
+ // Populate initial view content
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Turn off autoexpand
- fViewer.setAutoExpandLevel(0);
+ // Turn off autoexpand
+ fViewer.setAutoExpandLevel(0);
- // Reposition the viewer to middle of list
- fListener.reset();
- fListener.setFailOnRedundantUpdates(false);
+ // Reposition the viewer to middle of list
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
fViewer.reveal(model.findElement("1"), 500); //$NON-NLS-1$
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Create delta to refresh the "1" element.
- TestElement rootElement = model.getRootElement();
- ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
- ModelDelta expandDelta = model.getBaseDelta(rootDelta);
- TestElement expandElement = rootElement.getChildren()[0];
- expandDelta.addNode(expandElement, 0, IModelDelta.CONTENT, expandElement.getChildren().length);
-
- // Rinse and repeast. The refresh in bug 335734 is only triggered
- // only on the second time.
- for (int repeatCount = 0; repeatCount < 3; repeatCount++) {
- // Add first 250 elements (after element 500) as acceptable to materialize
- fListener.reset();
- fListener.setFailOnRedundantUpdates(true);
+ // Create delta to refresh the "1" element.
+ TestElement rootElement = model.getRootElement();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
+ ModelDelta expandDelta = model.getBaseDelta(rootDelta);
+ TestElement expandElement = rootElement.getChildren()[0];
+ expandDelta.addNode(expandElement, 0, IModelDelta.CONTENT, expandElement.getChildren().length);
+
+ // Rinse and repeast. The refresh in bug 335734 is only triggered
+ // only on the second time.
+ for (int repeatCount = 0; repeatCount < 3; repeatCount++) {
+ // Add first 250 elements (after element 500) as acceptable to materialize
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(true);
TreePath refreshElementPath = model.findElement("1"); //$NON-NLS-1$
- fListener.addRedundantExceptionChildCount(refreshElementPath);
- fListener.addRedundantExceptionLabel(refreshElementPath);
- fListener.addChildreUpdate(TreePath.EMPTY, 0);
- fListener.addHasChildrenUpdate(refreshElementPath);
- fListener.addChildreCountUpdate(refreshElementPath);
- fListener.addLabelUpdate(refreshElementPath); // TODO: not sure why label is updated upon expand?
- for (int i = 499; i < 750; i++) {
- fListener.addChildreUpdate(refreshElementPath, i);
- TreePath childPath = refreshElementPath.createChildPath(expandElement.getChildren()[i]);
- fListener.addLabelUpdate(childPath);
- fListener.addHasChildrenUpdate(childPath);
- }
- model.postDelta(rootDelta);
-
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ fListener.addRedundantExceptionChildCount(refreshElementPath);
+ fListener.addRedundantExceptionLabel(refreshElementPath);
+ fListener.addChildreUpdate(TreePath.EMPTY, 0);
+ fListener.addHasChildrenUpdate(refreshElementPath);
+ fListener.addChildreCountUpdate(refreshElementPath);
+ fListener.addLabelUpdate(refreshElementPath); // TODO: not sure why label is updated upon expand?
+ for (int i = 499; i < 750; i++) {
+ fListener.addChildreUpdate(refreshElementPath, i);
+ TreePath childPath = refreshElementPath.createChildPath(expandElement.getChildren()[i]);
+ fListener.addLabelUpdate(childPath);
+ fListener.addHasChildrenUpdate(childPath);
+ }
+ model.postDelta(rootDelta);
+
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
- }
- }
+ }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PerformanceTests.java
index df7de31e3..148291e7e 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PerformanceTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PerformanceTests.java
@@ -32,11 +32,11 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
protected VisibleVirtualItemValidator fVirtualItemValidator;
- public PerformanceTests(String name) {
- super(name);
- }
+ public PerformanceTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
}
@@ -45,287 +45,287 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
protected void setUp() throws Exception {
super.setUp();
fVirtualItemValidator = new VisibleVirtualItemValidator(0, Integer.MAX_VALUE);
- }
+ }
- /**
- * Depth (size) of the test model to be used in the tests. This number allows
- * the jface based tests to use a small enough model to fit on the screen, and
- * for the virtual viewer to exercise the content provider to a greater extent.
- */
- abstract protected int getTestModelDepth();
+ /**
+ * Depth (size) of the test model to be used in the tests. This number allows
+ * the jface based tests to use a small enough model to fit on the screen, and
+ * for the virtual viewer to exercise the content provider to a greater extent.
+ */
+ abstract protected int getTestModelDepth();
public void testRefreshStruct() throws Exception {
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "model.")); //$NON-NLS-1$
- fViewer.setAutoExpandLevel(-1);
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 10; i++) {
- // Update the model
+ Performance perf = Performance.getDefault();
+ PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ try {
+ for (int i = 0; i < 10; i++) {
+ // Update the model
model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
+ TestElement element = model.getRootElement();
+ fListener.reset(TreePath.EMPTY, element, -1, false, false);
- meter.start();
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
+ meter.start();
+ model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- meter.stop();
- System.gc();
- }
-
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
- }
+ meter.stop();
+ System.gc();
+ }
+
+ meter.commit();
+ perf.assertPerformance(meter);
+ } finally {
+ meter.dispose();
+ }
+ }
public void testRefreshStruct2() throws Exception {
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements2(model, new int[] { 2, 3000, 1 }, "model.")); //$NON-NLS-1$
- fViewer.setAutoExpandLevel(2);
- // Create the listener
- //fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- fListener.reset();
+ fViewer.setAutoExpandLevel(2);
+ // Create the listener
+ //fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset();
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- fVirtualItemValidator.setVisibleRange(0, 50);
+ fVirtualItemValidator.setVisibleRange(0, 50);
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 100; i++) {
- // Update the model
+ Performance perf = Performance.getDefault();
+ PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ try {
+ for (int i = 0; i < 100; i++) {
+ // Update the model
model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
- TestElement element = model.getRootElement();
- //fListener.reset(TreePath.EMPTY, element, -1, false, false);
- fListener.reset();
+ TestElement element = model.getRootElement();
+ //fListener.reset(TreePath.EMPTY, element, -1, false, false);
+ fListener.reset();
- meter.start();
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
+ meter.start();
+ model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
+ model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- meter.stop();
- System.gc();
- }
-
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
- }
+ meter.stop();
+ System.gc();
+ }
+
+ meter.commit();
+ perf.assertPerformance(meter);
+ } finally {
+ meter.dispose();
+ }
+ }
public void testRefreshStructReplaceElements() throws Exception {
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "model.")); //$NON-NLS-1$
- fViewer.setAutoExpandLevel(-1);
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 100; i++) {
- // Update the model
+ Performance perf = Performance.getDefault();
+ PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ try {
+ for (int i = 0; i < 100; i++) {
+ // Update the model
model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "pass " + i + ".")); //$NON-NLS-1$ //$NON-NLS-2$
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
+ TestElement element = model.getRootElement();
+ fListener.reset(TreePath.EMPTY, element, -1, false, false);
- meter.start();
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
+ meter.start();
+ model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- meter.stop();
- System.gc();
- }
-
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
- }
+ meter.stop();
+ System.gc();
+ }
+
+ meter.commit();
+ perf.assertPerformance(meter);
+ } finally {
+ meter.dispose();
+ }
+ }
public void testRefreshList() throws Exception {
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
- int numElements = (int)Math.pow(2, getTestModelDepth());
+ int numElements = (int)Math.pow(2, getTestModelDepth());
model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, numElements, "model.")); //$NON-NLS-1$
- fViewer.setAutoExpandLevel(-1);
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 100; i++) {
- // Update the model
+ Performance perf = Performance.getDefault();
+ PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ try {
+ for (int i = 0; i < 100; i++) {
+ // Update the model
model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
+ TestElement element = model.getRootElement();
+ fListener.reset(TreePath.EMPTY, element, -1, false, false);
- meter.start();
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
+ meter.start();
+ model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- meter.stop();
- System.gc();
- }
-
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
- }
+ meter.stop();
+ System.gc();
+ }
+
+ meter.commit();
+ perf.assertPerformance(meter);
+ } finally {
+ meter.dispose();
+ }
+ }
public void testSaveAndRestore() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // expand all elements
- fViewer.setAutoExpandLevel(-1);
+ // expand all elements
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Set a selection in view
+ // Set a selection in view
fViewer.setSelection(new TreeSelection(model.findElement("3.2.3"))); //$NON-NLS-1$
- // Turn off the auto-expand now since we want to text the auto-expand logic
- fViewer.setAutoExpandLevel(-1);
+ // Turn off the auto-expand now since we want to text the auto-expand logic
+ fViewer.setAutoExpandLevel(-1);
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 100; i++) {
- // Update the model
+ Performance perf = Performance.getDefault();
+ PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ try {
+ for (int i = 0; i < 100; i++) {
+ // Update the model
model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(true, false);
- meter.start();
- fViewer.setInput(null);
+ meter.start();
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE), createListenerErrorMessage());
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // TODO: add state updates somehow?
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ // TODO: add state updates somehow?
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- meter.stop();
- System.gc();
- }
+ meter.stop();
+ System.gc();
+ }
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
+ meter.commit();
+ perf.assertPerformance(meter);
+ } finally {
+ meter.dispose();
+ }
- }
+ }
public void testRefreshListFiltered() throws Exception {
- TestModel model = new TestModel();
+ TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
- int numElements = (int)Math.pow(2, getTestModelDepth());
+ int numElements = (int)Math.pow(2, getTestModelDepth());
model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, numElements, "model.")); //$NON-NLS-1$
- fViewer.setAutoExpandLevel(-1);
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- fViewer.addFilter(new ViewerFilter() {
- @Override
+ fViewer.addFilter(new ViewerFilter() {
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof TestElement) {
- String id = ((TestElement)element).getID();
+ if (element instanceof TestElement) {
+ String id = ((TestElement)element).getID();
if (id.startsWith("model.")) { //$NON-NLS-1$
id = id.substring("model.".length()); //$NON-NLS-1$
- }
- if (id.length() >= 2 && (id.charAt(1) == '1' || id.charAt(1) == '3' || id.charAt(1) == '5' || id.charAt(1) == '7' || id.charAt(1) == '9')) {
- return false;
- }
- }
- return true;
- }
- });
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ }
+ if (id.length() >= 2 && (id.charAt(1) == '1' || id.charAt(1) == '3' || id.charAt(1) == '5' || id.charAt(1) == '7' || id.charAt(1) == '9')) {
+ return false;
+ }
+ }
+ return true;
+ }
+ });
+
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 100; i++) {
- // Update the model
+ Performance perf = Performance.getDefault();
+ PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ try {
+ for (int i = 0; i < 100; i++) {
+ // Update the model
model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
+ TestElement element = model.getRootElement();
+ fListener.reset(TreePath.EMPTY, element, -1, false, false);
- meter.start();
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
+ meter.start();
+ model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- meter.stop();
- System.gc();
- }
-
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
- }
+ meter.stop();
+ System.gc();
+ }
+
+ meter.commit();
+ perf.assertPerformance(meter);
+ } finally {
+ meter.dispose();
+ }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PopupTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PopupTests.java
index 08a44ebcb..d37b2f8b3 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PopupTests.java
@@ -40,18 +40,18 @@ import org.eclipse.swt.widgets.Shell;
*/
abstract public class PopupTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public PopupTests(String name) {
- super(name);
- }
+ public PopupTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
}
- protected IInternalTreeModelViewer getCTargetViewer() {
- return fViewer;
- }
+ protected IInternalTreeModelViewer getCTargetViewer() {
+ return fViewer;
+ }
@Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
@@ -60,152 +60,152 @@ abstract public class PopupTests extends AbstractViewerModelTest implements ITes
abstract protected IInternalTreeModelViewer createViewer(Display display, Shell shell, int style);
- /**
- * This test verifies that content updates are still being performed.
- */
+ /**
+ * This test verifies that content updates are still being performed.
+ */
public void testRefreshStruct() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
- TestElement[] newChildren = new TestElement[] {
+ // Update the model
+ TestElement element = model.getRootElement().getChildren()[0];
+ TreePath elementPath = new TreePath(new Object[] { element });
+ TestElement[] newChildren = new TestElement[] {
new TestElement(model, "1.1 - new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "1.2 - new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "1.3 - new", new TestElement[0]), //$NON-NLS-1$
- };
- ModelDelta delta = model.setElementChildren(elementPath, newChildren);
+ };
+ ModelDelta delta = model.setElementChildren(elementPath, newChildren);
- fListener.reset(elementPath, element, -1, true, false);
- model.postDelta(delta);
+ fListener.reset(elementPath, element, -1, true, false);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
- /**
- * This test verifies that expand and select updates are being ignored.
- */
+ /**
+ * This test verifies that expand and select updates are being ignored.
+ */
public void testExpandAndSelect() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Create the delta
- fListener.reset();
- // TODO Investigate: there seem to be unnecessary updates being issued
- // by the viewer. These include the updates that are commented out:
- // For now disable checking for extra updates.
- fListener.setFailOnRedundantUpdates(false);
- TestElement element = model.getRootElement();
- TreePath path_root = TreePath.EMPTY;
- ModelDelta delta= new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
- ModelDelta deltaRoot = delta;
- element = element.getChildren()[2];
- TreePath path_root_3 = path_root.createChildPath(element);
- delta.addNode(element, 2, IModelDelta.SELECT | IModelDelta.EXPAND, element.fChildren.length);
-
- // Validate the expansion state BEFORE posting the delta.
-
- IInternalTreeModelViewer contentProviderViewer = fViewer;
- assertFalse(contentProviderViewer.getExpandedState(path_root_3));
-
- model.postDelta(deltaRoot);
+ model.validateData(fViewer, TreePath.EMPTY, true);
+
+ // Create the delta
+ fListener.reset();
+ // TODO Investigate: there seem to be unnecessary updates being issued
+ // by the viewer. These include the updates that are commented out:
+ // For now disable checking for extra updates.
+ fListener.setFailOnRedundantUpdates(false);
+ TestElement element = model.getRootElement();
+ TreePath path_root = TreePath.EMPTY;
+ ModelDelta delta= new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
+ ModelDelta deltaRoot = delta;
+ element = element.getChildren()[2];
+ TreePath path_root_3 = path_root.createChildPath(element);
+ delta.addNode(element, 2, IModelDelta.SELECT | IModelDelta.EXPAND, element.fChildren.length);
+
+ // Validate the expansion state BEFORE posting the delta.
+
+ IInternalTreeModelViewer contentProviderViewer = fViewer;
+ assertFalse(contentProviderViewer.getExpandedState(path_root_3));
+
+ model.postDelta(deltaRoot);
TestUtil.processUIEvents();
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE)
&& (fListener.isFinished(CONTENT_SEQUENCE_STARTED)
|| !fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)),
createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Validate the expansion state AFTER posting the delta.
- assertFalse(contentProviderViewer.getExpandedState(path_root_3));
+ // Validate the expansion state AFTER posting the delta.
+ assertFalse(contentProviderViewer.getExpandedState(path_root_3));
- // Verify selection
- ISelection selection = fViewer.getSelection();
- if (selection instanceof ITreeSelection) {
+ // Verify selection
+ ISelection selection = fViewer.getSelection();
+ if (selection instanceof ITreeSelection) {
List<TreePath> selectionPathsList = Arrays.asList(((ITreeSelection) selection).getPaths());
- assertFalse(selectionPathsList.contains(path_root_3));
- } else {
+ assertFalse(selectionPathsList.contains(path_root_3));
+ } else {
fail("Not a tree selection"); //$NON-NLS-1$
- }
- }
+ }
+ }
public void testPreserveExpandedOnSubTreeContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener,
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener,
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Turn off auto-expansion
- fViewer.setAutoExpandLevel(0);
+ // Turn off auto-expansion
+ fViewer.setAutoExpandLevel(0);
- // Set a selection in view
+ // Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("3.3.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
+ fViewer.setSelection(originalSelection);
- // Update the model
+ // Update the model
model.addElementChild(model.findElement("3"), null, 0, new TestElement(model, "3.0 - new", new TestElement[0])); //$NON-NLS-1$ //$NON-NLS-2$
- // Create the delta for element "3" with content update.
+ // Create the delta for element "3" with content update.
TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
- ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- ModelDelta elementDelta = model.getElementDelta(rootDelta, elementPath, true);
- elementDelta.setFlags(IModelDelta.CONTENT);
+ ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ ModelDelta elementDelta = model.getElementDelta(rootDelta, elementPath, true);
+ elementDelta.setFlags(IModelDelta.CONTENT);
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getCTargetViewer(), elementPath, model.getElement(elementPath), -1, ALL_UPDATES_COMPLETE);
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ fListener.addUpdates(getCTargetViewer(), elementPath, model.getElement(elementPath), -1, ALL_UPDATES_COMPLETE);
- // Post the sub-tree update
- model.postDelta(rootDelta);
+ // Post the sub-tree update
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
- // On windows, getExpandedState() may return true for an element with no children:
- // assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.0 - new")) == false);
+ // On windows, getExpandedState() may return true for an element with no children:
+ // assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.0 - new")) == false);
assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.2")) == true); //$NON-NLS-1$
assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.3")) == true); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
- private boolean areTreeSelectionsEqual(ITreeSelection sel1, ITreeSelection sel2) {
+ private boolean areTreeSelectionsEqual(ITreeSelection sel1, ITreeSelection sel2) {
Set<TreePath> sel1Set = new HashSet<>();
- sel1Set.addAll( Arrays.asList(sel1.getPaths()) );
+ sel1Set.addAll( Arrays.asList(sel1.getPaths()) );
Set<TreePath> sel2Set = new HashSet<>();
- sel2Set.addAll( Arrays.asList(sel2.getPaths()) );
+ sel2Set.addAll( Arrays.asList(sel2.getPaths()) );
- return sel1Set.equals(sel2Set);
- }
+ return sel1Set.equals(sel2Set);
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java
index fa6f7f15d..901d62105 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java
@@ -27,14 +27,14 @@ import org.eclipse.ui.XMLMemento;
*/
public class PresentationContextTests extends AbstractDebugTest {
- public PresentationContextTests(String name) {
- super(name);
- }
+ public PresentationContextTests(String name) {
+ super(name);
+ }
- /**
- * Tests saving and restoring presentation context properties.
- */
- public void testSaveRestore () {
+ /**
+ * Tests saving and restoring presentation context properties.
+ */
+ public void testSaveRestore () {
PresentationContext context = new PresentationContext("test"); //$NON-NLS-1$
context.setProperty("string", "string"); //$NON-NLS-1$ //$NON-NLS-2$
context.setProperty("integer", Integer.valueOf(1)); //$NON-NLS-1$
@@ -42,15 +42,15 @@ public class PresentationContextTests extends AbstractDebugTest {
context.setProperty("persistable", ResourcesPlugin.getWorkspace().getRoot().getAdapter(IPersistableElement.class)); //$NON-NLS-1$
final XMLMemento memento = XMLMemento.createWriteRoot("TEST"); //$NON-NLS-1$
- context.saveProperites(memento);
+ context.saveProperites(memento);
context = new PresentationContext("test"); //$NON-NLS-1$
- context.initProperties(memento);
+ context.initProperties(memento);
assertEquals("Wrong value restored", "string", context.getProperty("string")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
assertEquals("Wrong value restored", Integer.valueOf(1), context.getProperty("integer")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Wrong value restored", Boolean.TRUE, context.getProperty("boolean")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Wrong value restored", ResourcesPlugin.getWorkspace().getRoot(), context.getProperty("persistable")); //$NON-NLS-1$ //$NON-NLS-2$
- context.dispose();
- }
+ context.dispose();
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/SelectionTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/SelectionTests.java
index 56230cc4c..e73e9c96f 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/SelectionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/SelectionTests.java
@@ -33,212 +33,212 @@ import org.eclipse.jface.viewers.TreeSelection;
*/
abstract public class SelectionTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public SelectionTests(String name) {
- super(name);
- }
+ public SelectionTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
}
- private static class SelectionListener implements ISelectionChangedListener {
+ private static class SelectionListener implements ISelectionChangedListener {
private final List<SelectionChangedEvent> fEvents = new ArrayList<>(1);
- @Override
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- fEvents.add(event);
- }
- }
+ fEvents.add(event);
+ }
+ }
private TestModel makeMultiLevelModel() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- fViewer.setInput(model.getRootElement());
+ TestModel model = TestModel.simpleMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- return model;
- }
-
- /**
- * In this test:
- * - set selection to an element deep in the model
- * - verify that selection chagned listener is called
- * - verify that the selection is in the viewer is correct
- */
+ model.validateData(fViewer, TreePath.EMPTY);
+ return model;
+ }
+
+ /**
+ * In this test:
+ * - set selection to an element deep in the model
+ * - verify that selection chagned listener is called
+ * - verify that the selection is in the viewer is correct
+ */
public void testSimpleSetSelection() throws Exception {
- // Create the model and populate the view.
- TestModel model = makeMultiLevelModel();
+ // Create the model and populate the view.
+ TestModel model = makeMultiLevelModel();
- // Create a selection object to the deepest part of the tree.
- SelectionListener listener = new SelectionListener();
- fViewer.addSelectionChangedListener(listener);
+ // Create a selection object to the deepest part of the tree.
+ SelectionListener listener = new SelectionListener();
+ fViewer.addSelectionChangedListener(listener);
- // Set the selection and verify that the listener is called.
+ // Set the selection and verify that the listener is called.
TreeSelection selection = new TreeSelection(model.findElement("3.3.3")); //$NON-NLS-1$
- fViewer.setSelection(selection, true, false);
- assertTrue(listener.fEvents.size() == 1);
-
- // Check that the new selection is what was requested.
- ISelection viewerSelection = fViewer.getSelection();
- assertEquals(selection, viewerSelection);
- }
-
- /**
- * In this test verify that selection policy can prevent selection
- * from being set and verify that a FORCE flag can override the selection
- * policy.
- */
+ fViewer.setSelection(selection, true, false);
+ assertTrue(listener.fEvents.size() == 1);
+
+ // Check that the new selection is what was requested.
+ ISelection viewerSelection = fViewer.getSelection();
+ assertEquals(selection, viewerSelection);
+ }
+
+ /**
+ * In this test verify that selection policy can prevent selection
+ * from being set and verify that a FORCE flag can override the selection
+ * policy.
+ */
public void testSelectionPolicy() throws Exception {
- // Create the model and populate the view.
- final TestModel model = makeMultiLevelModel();
+ // Create the model and populate the view.
+ final TestModel model = makeMultiLevelModel();
- // Set the selection and verify it.
+ // Set the selection and verify it.
TreeSelection selection_3_3_3 = new TreeSelection(model.findElement("3.3.3")); //$NON-NLS-1$
- fViewer.setSelection(selection_3_3_3, true, false);
- assertEquals(selection_3_3_3, fViewer.getSelection());
+ fViewer.setSelection(selection_3_3_3, true, false);
+ assertEquals(selection_3_3_3, fViewer.getSelection());
- model.setSelectionPolicy(new IModelSelectionPolicy() {
+ model.setSelectionPolicy(new IModelSelectionPolicy() {
- @Override
+ @Override
public ISelection replaceInvalidSelection(ISelection invalidSelection, ISelection newSelection) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean overrides(ISelection existing, ISelection candidate, IPresentationContext context) {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean isSticky(ISelection selection, IPresentationContext context) {
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public boolean contains(ISelection selection, IPresentationContext context) {
- return true;
- }
- });
+ return true;
+ }
+ });
- // Attempt to change selection and verify that old selection is still valid.
+ // Attempt to change selection and verify that old selection is still valid.
TreeSelection selection_3_3_1 = new TreeSelection(model.findElement("3.3.1")); //$NON-NLS-1$
- fViewer.setSelection(selection_3_3_1, true, false);
- assertEquals(selection_3_3_3, fViewer.getSelection());
+ fViewer.setSelection(selection_3_3_1, true, false);
+ assertEquals(selection_3_3_3, fViewer.getSelection());
- // Now attempt to *force* selection and verify that new selection was set.
- fViewer.setSelection(selection_3_3_1, true, true);
- assertEquals(selection_3_3_1, fViewer.getSelection());
+ // Now attempt to *force* selection and verify that new selection was set.
+ fViewer.setSelection(selection_3_3_1, true, true);
+ assertEquals(selection_3_3_1, fViewer.getSelection());
- // Create the an update delta to attempt to change selection back to
- // 3.3.3 and verify that selection did not get overriden.
+ // Create the an update delta to attempt to change selection back to
+ // 3.3.3 and verify that selection did not get overriden.
TreePath path_3_3_3 = model.findElement("3.3.3"); //$NON-NLS-1$
- ModelDelta baseDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- ModelDelta delta_3_3_3 = model.getElementDelta(baseDelta, path_3_3_3, false);
- delta_3_3_3.setFlags(IModelDelta.SELECT);
- fViewer.updateViewer(baseDelta);
+ ModelDelta baseDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ ModelDelta delta_3_3_3 = model.getElementDelta(baseDelta, path_3_3_3, false);
+ delta_3_3_3.setFlags(IModelDelta.SELECT);
+ fViewer.updateViewer(baseDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- assertEquals(selection_3_3_1, fViewer.getSelection());
+ assertEquals(selection_3_3_1, fViewer.getSelection());
- // Add the *force* flag to the selection delta and update viewer again.
- // Verify that selection did change.
- delta_3_3_3.setFlags(IModelDelta.SELECT | IModelDelta.FORCE);
- fViewer.updateViewer(baseDelta);
+ // Add the *force* flag to the selection delta and update viewer again.
+ // Verify that selection did change.
+ delta_3_3_3.setFlags(IModelDelta.SELECT | IModelDelta.FORCE);
+ fViewer.updateViewer(baseDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- assertEquals(selection_3_3_3, fViewer.getSelection());
- }
+ assertEquals(selection_3_3_3, fViewer.getSelection());
+ }
- /**
- * In this test:
- * - set a seleciton to an element
- * - then remove that element
- * - update the view with remove delta
- * -> The selection should be re-set to empty.
- */
+ /**
+ * In this test:
+ * - set a seleciton to an element
+ * - then remove that element
+ * - update the view with remove delta
+ * -> The selection should be re-set to empty.
+ */
public void testSelectRemove() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- // Create the model and populate the view.
- TestModel model = makeMultiLevelModel();
+ // Create the model and populate the view.
+ TestModel model = makeMultiLevelModel();
- // Create a selection object to the deepest part of the tree.
+ // Create a selection object to the deepest part of the tree.
TreePath elementPath = model.findElement("3.3.3"); //$NON-NLS-1$
- TreeSelection selection = new TreeSelection(elementPath);
+ TreeSelection selection = new TreeSelection(elementPath);
- // Set the selection.
- fViewer.setSelection(selection, true, false);
+ // Set the selection.
+ fViewer.setSelection(selection, true, false);
- // Remove the element
+ // Remove the element
TreePath removePath = model.findElement("3"); //$NON-NLS-1$
- TreePath parentPath = removePath.getParentPath();
- int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
- ModelDelta delta = model.removeElementChild(removePath.getParentPath(), removeIndex);
-
- // Configure a selection listener
- SelectionListener listener = new SelectionListener();
- fViewer.addSelectionChangedListener(listener);
-
- // Reset the listener and update the viewer. With a remove
- // delta only wait for the delta to be processed.
- fListener.reset();
- model.postDelta(delta);
+ TreePath parentPath = removePath.getParentPath();
+ int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
+ ModelDelta delta = model.removeElementChild(removePath.getParentPath(), removeIndex);
+
+ // Configure a selection listener
+ SelectionListener listener = new SelectionListener();
+ fViewer.addSelectionChangedListener(listener);
+
+ // Reset the listener and update the viewer. With a remove
+ // delta only wait for the delta to be processed.
+ fListener.reset();
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(ITestModelUpdatesListenerConstants.MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Check to make sure the selection was made
- //assertTrue(listener.fEvents.size() == 1);
+ // Check to make sure the selection was made
+ //assertTrue(listener.fEvents.size() == 1);
- // Check that the new selection is empty
- ISelection viewerSelection = fViewer.getSelection();
- assertTrue(viewerSelection.isEmpty());
- }
+ // Check that the new selection is empty
+ ISelection viewerSelection = fViewer.getSelection();
+ assertTrue(viewerSelection.isEmpty());
+ }
- /**
- * In this test:
- * - set a selection to an element
- * - then remove that element
- * - then refresh the view.
- * -> The selection should be re-set to empty.
- */
+ /**
+ * In this test:
+ * - set a selection to an element
+ * - then remove that element
+ * - then refresh the view.
+ * -> The selection should be re-set to empty.
+ */
public void testSelectRemoveRefreshStruct() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- // Create the model and populate the view.
- TestModel model = makeMultiLevelModel();
+ // Create the model and populate the view.
+ TestModel model = makeMultiLevelModel();
- // Create a selection object to the deepest part of the tree.
+ // Create a selection object to the deepest part of the tree.
TreePath elementPath = model.findElement("3.3.3"); //$NON-NLS-1$
- TreeSelection selection = new TreeSelection(elementPath);
+ TreeSelection selection = new TreeSelection(elementPath);
- // Set the selection.
- fViewer.setSelection(selection, true, false);
+ // Set the selection.
+ fViewer.setSelection(selection, true, false);
- // Remove the element
+ // Remove the element
TreePath removePath = model.findElement("3"); //$NON-NLS-1$
- TreePath parentPath = removePath.getParentPath();
- int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
- model.removeElementChild(removePath.getParentPath(), removeIndex);
+ TreePath parentPath = removePath.getParentPath();
+ int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
+ model.removeElementChild(removePath.getParentPath(), removeIndex);
- // Configure a selection listener
- SelectionListener listener = new SelectionListener();
- fViewer.addSelectionChangedListener(listener);
+ // Configure a selection listener
+ SelectionListener listener = new SelectionListener();
+ fViewer.addSelectionChangedListener(listener);
- // Reset the listener to ignore redundant updates. When elements are removed
- // the viewer may still request updates for those elements.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Reset the listener to ignore redundant updates. When elements are removed
+ // the viewer may still request updates for those elements.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Refresh the viewer
- model.postDelta( new ModelDelta(model.getRootElement(), IModelDelta.CONTENT) );
+ // Refresh the viewer
+ model.postDelta( new ModelDelta(model.getRootElement(), IModelDelta.CONTENT) );
waitWhile(t -> !fListener.isFinished(ITestModelUpdatesListenerConstants.ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Check to make sure the selection was made
- // Commented out until JFace bug 219887 is fixed.
- //assertTrue(listener.fEvents.size() == 1);
+ // Check to make sure the selection was made
+ // Commented out until JFace bug 219887 is fixed.
+ //assertTrue(listener.fEvents.size() == 1);
- // Check that the new selection is empty
- ISelection viewerSelection = fViewer.getSelection();
- assertTrue(viewerSelection.isEmpty());
- }
+ // Check that the new selection is empty
+ ISelection viewerSelection = fViewer.getSelection();
+ assertTrue(viewerSelection.isEmpty());
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/StateTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/StateTests.java
index aed68f6ad..5e858848f 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/StateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/StateTests.java
@@ -35,208 +35,208 @@ import org.eclipse.jface.viewers.TreeSelection;
*/
abstract public class StateTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public StateTests(String name) {
- super(name);
- }
+ public StateTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
}
- protected IInternalTreeModelViewer getInternalViewer() {
- return fViewer;
- }
+ protected IInternalTreeModelViewer getInternalViewer() {
+ return fViewer;
+ }
public void testUpdateViewer() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ TestModel model = TestModel.simpleMultiLevel();
- // Create the listener
- fListener.reset();
- fListener.addChildreUpdate(TreePath.EMPTY, 0);
- fListener.addChildreUpdate(TreePath.EMPTY, 1);
- fListener.addChildreUpdate(TreePath.EMPTY, 2);
+ // Create the listener
+ fListener.reset();
+ fListener.addChildreUpdate(TreePath.EMPTY, 0);
+ fListener.addChildreUpdate(TreePath.EMPTY, 1);
+ fListener.addChildreUpdate(TreePath.EMPTY, 2);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Create the update delta
- TestElement element = model.getRootElement();
- TreePath path0 = TreePath.EMPTY;
- ModelDelta delta = new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
- ModelDelta updateDelta = delta;
- element = element.getChildren()[2];
- TreePath path1 = path0.createChildPath(element);
- delta = delta.addNode(element, 2, IModelDelta.EXPAND, element.fChildren.length);
- element = element.getChildren()[1];
- TreePath path2 = path1.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.EXPAND, element.fChildren.length);
- element = element.getChildren()[1];
- TreePath path3 = path2.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.SELECT);
-
- fListener.reset(false, false);
-
- fListener.addChildreUpdate(path0, 2);
- fListener.addHasChildrenUpdate(path1);
- fListener.addChildreCountUpdate(path1);
- fListener.addLabelUpdate(path1);
- fListener.addChildreUpdate(path1, 1);
- fListener.addHasChildrenUpdate(path2);
- fListener.addChildreCountUpdate(path2);
- fListener.addLabelUpdate(path2);
- fListener.addHasChildrenUpdate(path2);
- fListener.addChildreCountUpdate(path2);
- fListener.addChildreUpdate(path2, 1);
- fListener.addHasChildrenUpdate(path3);
- fListener.addLabelUpdate(path3);
-
- fViewer.updateViewer(updateDelta);
+ model.validateData(fViewer, TreePath.EMPTY, true);
+
+ // Create the update delta
+ TestElement element = model.getRootElement();
+ TreePath path0 = TreePath.EMPTY;
+ ModelDelta delta = new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
+ ModelDelta updateDelta = delta;
+ element = element.getChildren()[2];
+ TreePath path1 = path0.createChildPath(element);
+ delta = delta.addNode(element, 2, IModelDelta.EXPAND, element.fChildren.length);
+ element = element.getChildren()[1];
+ TreePath path2 = path1.createChildPath(element);
+ delta = delta.addNode(element, 1, IModelDelta.EXPAND, element.fChildren.length);
+ element = element.getChildren()[1];
+ TreePath path3 = path2.createChildPath(element);
+ delta = delta.addNode(element, 1, IModelDelta.SELECT);
+
+ fListener.reset(false, false);
+
+ fListener.addChildreUpdate(path0, 2);
+ fListener.addHasChildrenUpdate(path1);
+ fListener.addChildreCountUpdate(path1);
+ fListener.addLabelUpdate(path1);
+ fListener.addChildreUpdate(path1, 1);
+ fListener.addHasChildrenUpdate(path2);
+ fListener.addChildreCountUpdate(path2);
+ fListener.addLabelUpdate(path2);
+ fListener.addHasChildrenUpdate(path2);
+ fListener.addChildreCountUpdate(path2);
+ fListener.addChildreUpdate(path2, 1);
+ fListener.addHasChildrenUpdate(path3);
+ fListener.addLabelUpdate(path3);
+
+ fViewer.updateViewer(updateDelta);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_UPDATES), createListenerErrorMessage());
- // Extract the new state from viewer
- ModelDelta savedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(path0, savedDelta, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the new state from viewer
+ ModelDelta savedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(path0, savedDelta, IModelDelta.EXPAND | IModelDelta.SELECT);
- if (!deltaMatches(updateDelta, savedDelta) ) {
+ if (!deltaMatches(updateDelta, savedDelta) ) {
fail("Expected:\n" + updateDelta.toString() + "\nGot:\n" + savedDelta); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- boolean deltaMatches(ModelDelta requested, ModelDelta received) {
- if ( requested.getElement().equals(received.getElement()) &&
- requested.getFlags() == received.getFlags() &&
- ( requested.getChildCount() == -1 || requested.getChildCount() == received.getChildCount() )&&
- ( requested.getIndex() == -1 || requested.getIndex() == received.getIndex()) &&
- ((requested.getReplacementElement() != null && requested.getReplacementElement().equals(received.getReplacementElement())) ||
- (requested.getReplacementElement() == null && received.getReplacementElement() == null)) &&
- requested.getChildDeltas().length == received.getChildDeltas().length)
- {
- for (int i = 0; i < requested.getChildDeltas().length; i++) {
- ModelDelta requestedChildDelta = (ModelDelta)requested.getChildDeltas()[i];
- ModelDelta receivedChildDelta = received.getChildDelta(requestedChildDelta.getElement());
- if ( receivedChildDelta == null || !deltaMatches(requestedChildDelta, receivedChildDelta) ) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * Creates a model in the pattern of:
- *
- * root
- * 1
- * 1.1
- * 1.1.1
- * 2
- * 2.1
- * 2.1.1
- * 3
- * 3.1
- * 3.1.1
- * ...
- * (size)
- * (size).1
- * (size).1.1
- */
- static TestModel alternatingSubsreesModel(int size) {
- TestModel model = new TestModel();
-
- TestElement[] elements = new TestElement[size];
- for (int i = 0; i < size; i++) {
- String text = Integer.toString(i + 1);
- elements[i] =
- new TestElement(model, text, new TestElement[] {
+ }
+ }
+
+ boolean deltaMatches(ModelDelta requested, ModelDelta received) {
+ if ( requested.getElement().equals(received.getElement()) &&
+ requested.getFlags() == received.getFlags() &&
+ ( requested.getChildCount() == -1 || requested.getChildCount() == received.getChildCount() )&&
+ ( requested.getIndex() == -1 || requested.getIndex() == received.getIndex()) &&
+ ((requested.getReplacementElement() != null && requested.getReplacementElement().equals(received.getReplacementElement())) ||
+ (requested.getReplacementElement() == null && received.getReplacementElement() == null)) &&
+ requested.getChildDeltas().length == received.getChildDeltas().length)
+ {
+ for (int i = 0; i < requested.getChildDeltas().length; i++) {
+ ModelDelta requestedChildDelta = (ModelDelta)requested.getChildDeltas()[i];
+ ModelDelta receivedChildDelta = received.getChildDelta(requestedChildDelta.getElement());
+ if ( receivedChildDelta == null || !deltaMatches(requestedChildDelta, receivedChildDelta) ) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Creates a model in the pattern of:
+ *
+ * root
+ * 1
+ * 1.1
+ * 1.1.1
+ * 2
+ * 2.1
+ * 2.1.1
+ * 3
+ * 3.1
+ * 3.1.1
+ * ...
+ * (size)
+ * (size).1
+ * (size).1.1
+ */
+ static TestModel alternatingSubsreesModel(int size) {
+ TestModel model = new TestModel();
+
+ TestElement[] elements = new TestElement[size];
+ for (int i = 0; i < size; i++) {
+ String text = Integer.toString(i + 1);
+ elements[i] =
+ new TestElement(model, text, new TestElement[] {
new TestElement(model, text + ".1", new TestElement[] { //$NON-NLS-1$
new TestElement(model, text + ".1.1", new TestElement[0]) //$NON-NLS-1$
- })
- });
- }
+ })
+ });
+ }
model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
- return model;
- }
+ return model;
+ }
- static boolean areTreeSelectionsEqual(ITreeSelection sel1, ITreeSelection sel2) {
+ static boolean areTreeSelectionsEqual(ITreeSelection sel1, ITreeSelection sel2) {
Set<TreePath> sel1Set = new HashSet<>();
- sel1Set.addAll( Arrays.asList(sel1.getPaths()) );
+ sel1Set.addAll( Arrays.asList(sel1.getPaths()) );
Set<TreePath> sel2Set = new HashSet<>();
- sel2Set.addAll( Arrays.asList(sel2.getPaths()) );
+ sel2Set.addAll( Arrays.asList(sel2.getPaths()) );
- return sel1Set.equals(sel2Set);
- }
+ return sel1Set.equals(sel2Set);
+ }
static void expandAlternateElements(TestModelUpdatesListener listener, TestModel model, boolean waitForAllUpdates) throws Exception {
- listener.reset();
- listener.setFailOnRedundantUpdates(false);
-
- TestElement rootElement = model.getRootElement();
- TestElement[] children = rootElement.getChildren();
- ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
- ModelDelta expandDelta = model.getBaseDelta(rootDelta);
- for (int i = 0; i < children.length; i++) {
- // Expand only odd children
- if (i % 2 == 1) {
- continue;
- }
-
- // Expand the element and the first child of each sub-element
- TestElement element = children[i];
- ModelDelta delta = expandDelta;
- int index = i;
- while (element.getChildren().length != 0) {
- TreePath elementPath = model.findElement(element.getLabel());
- listener.addUpdates(
- elementPath, element, 1,
- CHILD_COUNT_UPDATES | (waitForAllUpdates ? CHILDREN_UPDATES : 0) );
- delta = delta.addNode(element, index, IModelDelta.EXPAND, element.getChildren().length);
- element = element.getChildren()[0];
- index = 0;
- }
- }
- model.postDelta(rootDelta);
+ listener.reset();
+ listener.setFailOnRedundantUpdates(false);
+
+ TestElement rootElement = model.getRootElement();
+ TestElement[] children = rootElement.getChildren();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
+ ModelDelta expandDelta = model.getBaseDelta(rootDelta);
+ for (int i = 0; i < children.length; i++) {
+ // Expand only odd children
+ if (i % 2 == 1) {
+ continue;
+ }
+
+ // Expand the element and the first child of each sub-element
+ TestElement element = children[i];
+ ModelDelta delta = expandDelta;
+ int index = i;
+ while (element.getChildren().length != 0) {
+ TreePath elementPath = model.findElement(element.getLabel());
+ listener.addUpdates(
+ elementPath, element, 1,
+ CHILD_COUNT_UPDATES | (waitForAllUpdates ? CHILDREN_UPDATES : 0) );
+ delta = delta.addNode(element, index, IModelDelta.EXPAND, element.getChildren().length);
+ element = element.getChildren()[0];
+ index = 0;
+ }
+ }
+ model.postDelta(rootDelta);
TestUtil.waitWhile(t -> !listener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE), null, 30000, t -> "Listener not finished: " + listener);
- }
+ }
public void testPreserveExpandedOnRemove() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- expandAlternateElements(fListener, model, true);
+ expandAlternateElements(fListener, model, true);
- // Set a selection in view
+ // Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
+ fViewer.setSelection(originalSelection);
- // Update the model
- ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 0);
+ // Update the model
+ ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 0);
- // Remove delta should not generate any new updates
- fListener.reset();
- model.postDelta(delta);
+ // Remove delta should not generate any new updates
+ fListener.reset();
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -244,42 +244,42 @@ abstract public class StateTests extends AbstractViewerModelTest implements ITes
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
public void testPreserveExpandedOnInsert() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- expandAlternateElements(fListener, model, true);
+ expandAlternateElements(fListener, model, true);
- // Set a selection in view
+ // Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
+ fViewer.setSelection(originalSelection);
- // Update the model
+ // Update the model
ModelDelta delta = model.insertElementChild(TreePath.EMPTY, 0, new TestElement(model, "0 - new", new TestElement[0])); //$NON-NLS-1$
- // Insert delta should generate updates only for the new element
+ // Insert delta should generate updates only for the new element
TreePath path = model.findElement("0 - new"); //$NON-NLS-1$
- // Note: redundant label updates on insert.
- fListener.reset(path, (TestElement)path.getLastSegment(), 0, false, false);
- fListener.addChildreUpdate(TreePath.EMPTY, 0);
- model.postDelta(delta);
+ // Note: redundant label updates on insert.
+ fListener.reset(path, (TestElement)path.getLastSegment(), 0, false, false);
+ fListener.addChildreUpdate(TreePath.EMPTY, 0);
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
@@ -289,50 +289,50 @@ abstract public class StateTests extends AbstractViewerModelTest implements ITes
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
public void testPreserveExpandedOnMultLevelContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- expandAlternateElements(fListener, model, true);
+ expandAlternateElements(fListener, model, true);
- // Set a selection in view
- // Set a selection in view
- TreeSelection originalSelection = new TreeSelection(
+ // Set a selection in view
+ // Set a selection in view
+ TreeSelection originalSelection = new TreeSelection(
new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fViewer.setSelection(originalSelection);
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ fViewer.setSelection(originalSelection);
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Update the model
- model.removeElementChild(TreePath.EMPTY, 0);
+ // Update the model
+ model.removeElementChild(TreePath.EMPTY, 0);
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
- // Create the delta which has nodes with CONTENT flag set at multiple levels.
- ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
+ // Create the delta which has nodes with CONTENT flag set at multiple levels.
+ ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
ModelDelta elementDelta = model.getElementDelta(rootDelta, model.findElement("3.1.1"), true); //$NON-NLS-1$
- elementDelta.setFlags(IModelDelta.CONTENT);
+ elementDelta.setFlags(IModelDelta.CONTENT);
- // Post the multi-content update delta
- model.postDelta(rootDelta);
+ // Post the multi-content update delta
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -340,101 +340,101 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Note: in past it was observed sub-optimal coalescing in this test due
- // to scattered update requests from viewer.
- assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 5) );
- }
+ // Note: in past it was observed sub-optimal coalescing in this test due
+ // to scattered update requests from viewer.
+ assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 5) );
+ }
public void testPreserveExpandedOnSubTreeContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener,
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener,
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Turn off auto-expansion
- fViewer.setAutoExpandLevel(0);
+ // Turn off auto-expansion
+ fViewer.setAutoExpandLevel(0);
- // Set a selection in view
+ // Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("3.3.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
+ fViewer.setSelection(originalSelection);
- // Update the model
+ // Update the model
model.addElementChild(model.findElement("3"), null, 0, new TestElement(model, "3.0 - new", new TestElement[0])); //$NON-NLS-1$ //$NON-NLS-2$
- // Create the delta for element "3" with content update.
+ // Create the delta for element "3" with content update.
TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
- ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- ModelDelta elementDelta = model.getElementDelta(rootDelta, elementPath, true);
- elementDelta.setFlags(IModelDelta.CONTENT);
+ ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ ModelDelta elementDelta = model.getElementDelta(rootDelta, elementPath, true);
+ elementDelta.setFlags(IModelDelta.CONTENT);
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getInternalViewer(), elementPath, model.getElement(elementPath), -1, ALL_UPDATES_COMPLETE);
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ fListener.addUpdates(getInternalViewer(), elementPath, model.getElement(elementPath), -1, ALL_UPDATES_COMPLETE);
- // Post the sub-tree update
- model.postDelta(rootDelta);
+ // Post the sub-tree update
+ model.postDelta(rootDelta);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
- // On windows, getExpandedState() may return true for an element with no children:
- // assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.0 - new")) == false);
+ // On windows, getExpandedState() may return true for an element with no children:
+ // assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.0 - new")) == false);
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.2")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.3")) == true); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
public void testPreserveExpandedOnContentStress() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- expandAlternateElements(fListener, model, true);
+ expandAlternateElements(fListener, model, true);
- // Set a selection in view
+ // Set a selection in view
// TreeSelection originalSelection = new TreeSelection(
// new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") });
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
-
- // Run this test ten times as we've seen intermittent failures related
- // to timing in it.
- for (int i = 0; i < 10; i++) {
- // Update the model
- model.removeElementChild(TreePath.EMPTY, 0);
-
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ fViewer.setSelection(originalSelection);
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+
+ // Run this test ten times as we've seen intermittent failures related
+ // to timing in it.
+ for (int i = 0; i < 10; i++) {
+ // Update the model
+ model.removeElementChild(TreePath.EMPTY, 0);
+
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -442,19 +442,19 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Update the model again
+ // Update the model again
model.addElementChild(TreePath.EMPTY, null, 0, new TestElement(model, "1", new TestElement[0])); //$NON-NLS-1$
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
+ // Validate data
+ model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -462,40 +462,40 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
- }
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
+ }
public void testPreserveLargeModelOnContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(100);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(100);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset();
+ // Create the listener, only check the first level
+ fListener.reset();
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- expandAlternateElements(fListener, model, false);
+ expandAlternateElements(fListener, model, false);
- // Set a selection in view
+ // Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ fViewer.setSelection(originalSelection);
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Update the model
- model.removeElementChild(TreePath.EMPTY, 0);
+ // Update the model
+ model.removeElementChild(TreePath.EMPTY, 0);
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Validate data
+ // Validate data
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -503,17 +503,17 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Update the model again
+ // Update the model again
model.addElementChild(TreePath.EMPTY, null, 0, new TestElement(model, "1", new TestElement[0])); //$NON-NLS-1$
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Note: Re-expanding nodes causes redundant updates.
+ fListener.reset(false, false);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Validate data
+ // Validate data
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
@@ -521,88 +521,88 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
-
- /**
- * This test verifies that if the model selects a new element
- * following a content refresh, the state restore logic will
- * not override the selection requested by the model.
- */
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
+
+ /**
+ * This test verifies that if the model selects a new element
+ * following a content refresh, the state restore logic will
+ * not override the selection requested by the model.
+ */
public void testPreserveSelectionDeltaAfterContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Set a selection in view
+ // Set a selection in view
fViewer.setSelection(new TreeSelection(model.findElement("3.1.1"))); //$NON-NLS-1$
- // Reset the listener (ignore redundant updates)
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Reset the listener (ignore redundant updates)
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Refresh content.
- // Note: Wait only for the processing of the delta, not for all updates
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh content.
+ // Note: Wait only for the processing of the delta, not for all updates
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Update the viewer with new selection delta to something new in the view
+ // Update the viewer with new selection delta to something new in the view
ModelDelta selectDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.SELECT); //$NON-NLS-1$
- // Wait for the second model delta to process
- fListener.resetModelChanged();
- model.postDelta(selectDelta);
+ // Wait for the second model delta to process
+ fListener.resetModelChanged();
+ model.postDelta(selectDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Wait for all the updates to complete (note: we're not resetting the listener.
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Wait for all the updates to complete (note: we're not resetting the listener.
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Check to make sure that the state restore didn't change the selection.
+ // Check to make sure that the state restore didn't change the selection.
assertEquals(new TreeSelection(model.findElement("2.1")), fViewer.getSelection()); //$NON-NLS-1$
- }
+ }
public void testPreserveCollapseDeltaAfterContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Turn off auto-expand
- fViewer.setAutoExpandLevel(0);
+ // Turn off auto-expand
+ fViewer.setAutoExpandLevel(0);
- // Reset the listener (ignore redundant updates)
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Reset the listener (ignore redundant updates)
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Refresh content.
- // Note: Wait only for the processing of the delta, not for all updates
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh content.
+ // Note: Wait only for the processing of the delta, not for all updates
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Update the viewer to collapse an element
+ // Update the viewer to collapse an element
ModelDelta collapseDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.COLLAPSE); //$NON-NLS-1$
- // Remove updates for the collapsed element from listener, because they
- // will never happen if the element remains collapsed.
- fListener.resetModelChanged();
+ // Remove updates for the collapsed element from listener, because they
+ // will never happen if the element remains collapsed.
+ fListener.resetModelChanged();
fListener.removeLabelUpdate(model.findElement("3.1.1")); //$NON-NLS-1$
fListener.removeLabelUpdate(model.findElement("3.1.2")); //$NON-NLS-1$
fListener.removeLabelUpdate(model.findElement("3.1.3")); //$NON-NLS-1$
@@ -614,284 +614,284 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
fListener.removeChildrenUpdate(model.findElement("3.1"), 1); //$NON-NLS-1$
fListener.removeChildrenUpdate(model.findElement("3.1"), 2); //$NON-NLS-1$
- // Wait for the second model delta to process
- model.postDelta(collapseDelta);
+ // Wait for the second model delta to process
+ model.postDelta(collapseDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Wait for all the updates to complete (note: we're not resetting the listener.
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Wait for all the updates to complete (note: we're not resetting the listener.
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Check to make sure that the state restore didn't change the selection.
+ // Check to make sure that the state restore didn't change the selection.
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == false); //$NON-NLS-1$
- }
+ }
public void testPreserveExpandDeltaAfterContent() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // Note: Do not auto-expand!
+ // Note: Do not auto-expand!
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Reset the listener (ignore redundant updates)
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ // Reset the listener (ignore redundant updates)
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // Refresh content.
- // Note: Wait only for the processing of the delta, not for all updates
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh content.
+ // Note: Wait only for the processing of the delta, not for all updates
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Update the viewer to expand an element
+ // Update the viewer to expand an element
ModelDelta expandDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.EXPAND); //$NON-NLS-1$
- // Wait for the second model delta to process
- fListener.resetModelChanged();
- model.postDelta(expandDelta);
+ // Wait for the second model delta to process
+ fListener.resetModelChanged();
+ model.postDelta(expandDelta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Wait for all the updates to complete (note: we're not resetting the listener.
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Wait for all the updates to complete (note: we're not resetting the listener.
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Check to make sure that the state restore didn't change the selection.
+ // Check to make sure that the state restore didn't change the selection.
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
- }
+ }
public void testSaveAndRestore1() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Expand some, but not all elements
- expandAlternateElements(fListener, model, true);
+ // Expand some, but not all elements
+ expandAlternateElements(fListener, model, true);
- // Set a selection in view
+ // Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("5.1"), model.findElement("5.1.1"), model.findElement("6.1.1") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(false, false);
- fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(false, false);
+ fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // TODO: add state updates somehow?
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ // TODO: add state updates somehow?
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- // Extract the restored state from viewer
- ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the restored state from viewer
+ ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
- if (!deltaMatches(originalState, restoredState)) {
+ if (!deltaMatches(originalState, restoredState)) {
fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ }
+ }
public void testSaveAndRestore2() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // expand all elements
- fViewer.setAutoExpandLevel(-1);
+ // expand all elements
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Set a selection in view
+ // Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("3.2"), model.findElement("3.2.1"), model.findElement("2") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fViewer.setSelection(new TreeSelection(model.findElement("3.2.3"))); //$NON-NLS-1$
- // Turn off the auto-expand now since we want to text the auto-expand logic
- fViewer.setAutoExpandLevel(-1);
+ // Turn off the auto-expand now since we want to text the auto-expand logic
+ fViewer.setAutoExpandLevel(-1);
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
- fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(true, false);
+ fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // TODO: add state updates somehow?
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ // TODO: add state updates somehow?
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- // Extract the restored state from viewer
- ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the restored state from viewer
+ ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
- if (!deltaMatches(originalState, restoredState)) {
+ if (!deltaMatches(originalState, restoredState)) {
fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ }
+ }
public void testSaveAndRestoreInputInstance() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Expand some, but not all elements
- expandAlternateElements(fListener, model, true);
+ // Expand some, but not all elements
+ expandAlternateElements(fListener, model, true);
- // Set a selection in view
+ // Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("5.1"), model.findElement("5.1.1"), model.findElement("6.1.1") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Do not reset to null, just reset input to the same object.
+ // Do not reset to null, just reset input to the same object.
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- // Extract the restored state from viewer
- ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the restored state from viewer
+ ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
- if (!deltaMatches(originalState, restoredState)) {
+ if (!deltaMatches(originalState, restoredState)) {
fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ }
+ }
public void testSaveAndRestoreInputInstanceEquals() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(6);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(6);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ // Create the listener, only check the first level
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // Expand some, but not all elements
- expandAlternateElements(fListener, model, true);
+ // Expand some, but not all elements
+ expandAlternateElements(fListener, model, true);
- // Set a selection in view
+ // Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("5.1"), model.findElement("5.1.1"), model.findElement("6.1.1") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Create a copy of the input object and set it to model.
- TestElement newRoot = new TestElement(model, model.getRootElement().getID(), model.getRootElement().getChildren());
- model.setRoot(newRoot);
+ // Create a copy of the input object and set it to model.
+ TestElement newRoot = new TestElement(model, model.getRootElement().getID(), model.getRootElement().getChildren());
+ model.setRoot(newRoot);
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- fViewer.setInput(model.getRootElement());
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- // Extract the restored state from viewer
- ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the restored state from viewer
+ ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
- if (!deltaMatches(originalState, restoredState)) {
+ if (!deltaMatches(originalState, restoredState)) {
fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ }
+ }
public void testSaveAndRestoreLarge() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(100);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(100);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset();
+ // Create the listener, only check the first level
+ fListener.reset();
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- expandAlternateElements(fListener, model, false);
+ expandAlternateElements(fListener, model, false);
- // Set a selection in view
+ // Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ fViewer.setSelection(originalSelection);
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset();
- fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset();
+ fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ fViewer.setInput(null);
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset();
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset();
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- // Validate data (only select visible elements).
+ // Validate data (only select visible elements).
assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
@@ -901,64 +901,64 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
-
- /**
- * This test saves state of a large tree. Then the tree is modified
- * to contain much fewer elements. The restore logic should discard the
- * rest of the saved state delta once all the elements are visible.
- */
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
+
+ /**
+ * This test saves state of a large tree. Then the tree is modified
+ * to contain much fewer elements. The restore logic should discard the
+ * rest of the saved state delta once all the elements are visible.
+ */
public void testSaveAndRestorePartialStateLarge() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel(100);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = alternatingSubsreesModel(100);
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
- // Create the listener, only check the first level
- fListener.reset();
+ // Create the listener, only check the first level
+ fListener.reset();
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
- expandAlternateElements(fListener, model, false);
+ expandAlternateElements(fListener, model, false);
- // Set a selection in view
+ // Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
- fViewer.setSelection(originalSelection);
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ fViewer.setSelection(originalSelection);
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
+ // Extract the original state from viewer
+ ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset();
- fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset();
+ fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
- fViewer.setInput(null);
+ fViewer.setInput(null);
TestUtil.waitForJobs(getName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
- TestElement[] elements = model.getRootElement().getChildren();
- TestElement[] newElements = new TestElement[10];
- System.arraycopy(elements, 0, newElements, 0, newElements.length);
- model.setElementChildren(TreePath.EMPTY, newElements);
+ TestElement[] elements = model.getRootElement().getChildren();
+ TestElement[] newElements = new TestElement[10];
+ System.arraycopy(elements, 0, newElements, 0, newElements.length);
+ model.setElementChildren(TreePath.EMPTY, newElements);
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset();
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset();
+ fViewer.setInput(model.getRootElement());
TestUtil.waitForJobs(getName(), 300, 5000);
- // MONITOR FOR THE STATE RESTORE TO COMPLETE
+ // MONITOR FOR THE STATE RESTORE TO COMPLETE
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Validate data
+ // Validate data
assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
@@ -968,134 +968,134 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
- assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- }
+ assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
+ }
public void testPreserveCollapseAndSelectDeltaAfterSaveAndRestore() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
fViewer.setSelection(new TreeSelection(model.findElement("3"))); //$NON-NLS-1$
- // Turn off auto-expand
- fViewer.setAutoExpandLevel(0);
+ // Turn off auto-expand
+ fViewer.setAutoExpandLevel(0);
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(false, false);
- fViewer.setInput(null);
+ // Set the viewer input to null. This will trigger the view to save the viewer state.
+ fListener.reset(false, false);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE), createListenerErrorMessage());
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- fViewer.setInput(model.getRootElement());
+ // Set the viewer input back to the model. When view updates are complete
+ // the viewer
+ // Note: disable redundant updates because the reveal delta triggers one.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
+ fViewer.setInput(model.getRootElement());
TreePath path = model.findElement("2"); //$NON-NLS-1$
- fListener.addUpdates(null, path, (TestElement)path.getLastSegment(), 0, STATE_UPDATES);
+ fListener.addUpdates(null, path, (TestElement)path.getLastSegment(), 0, STATE_UPDATES);
path = model.findElement("3"); //$NON-NLS-1$
- fListener.addUpdates(null, path, (TestElement)path.getLastSegment(), 0, STATE_UPDATES);
+ fListener.addUpdates(null, path, (TestElement)path.getLastSegment(), 0, STATE_UPDATES);
- // Wait till we restore state of elements we want to collapse and select
- // Bug 372619 - Need to wait until proxy installed delta is processed before
- // posting the next delta.
+ // Wait till we restore state of elements we want to collapse and select
+ // Bug 372619 - Need to wait until proxy installed delta is processed before
+ // posting the next delta.
waitWhile(t -> !fListener.isFinished(STATE_RESTORE_STARTED | STATE_UPDATES | CHILDREN_UPDATES | MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Post first collapse delta
- fListener.resetModelChanged();
+ // Post first collapse delta
+ fListener.resetModelChanged();
model.postDelta(model.makeElementDelta(model.findElement("2"), IModelDelta.COLLAPSE)); //$NON-NLS-1$
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Post second collapse delta
- fListener.resetModelChanged();
+ // Post second collapse delta
+ fListener.resetModelChanged();
model.postDelta(model.makeElementDelta(model.findElement("3"), IModelDelta.COLLAPSE)); //$NON-NLS-1$
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Post select delta
+ // Post select delta
model.postDelta(model.makeElementDelta(model.findElement("1"), IModelDelta.SELECT)); //$NON-NLS-1$
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- // Wait for all the updates to complete (note: we're not resetting the listener).
+ // Wait for all the updates to complete (note: we're not resetting the listener).
waitWhile(t -> !fListener.isFinished(STATE_RESTORE_COMPLETE), createListenerErrorMessage());
- // Check to make sure that the state restore didn't change the selection.
+ // Check to make sure that the state restore didn't change the selection.
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == false); //$NON-NLS-1$
assertEquals(new TreeSelection(model.findElement("1")), fViewer.getSelection()); //$NON-NLS-1$
- }
+ }
- /**
- * Test for bug 359859.<br>
- * This test verifies that RESTORE state is handled after SAVE previous state was completed
- */
+ /**
+ * Test for bug 359859.<br>
+ * This test verifies that RESTORE state is handled after SAVE previous state was completed
+ */
public void testSaveRestoreOrder() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
- model.setDelayUpdates(true);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ TestModel model = TestModel.simpleMultiLevel();
+ model.setDelayUpdates(true);
- // Expand all
- fViewer.setAutoExpandLevel(-1);
+ // Expand all
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY, true);
+ model.validateData(fViewer, TreePath.EMPTY, true);
- // a new similar model
- TestModel copyModel = TestModel.simpleMultiLevel();
+ // a new similar model
+ TestModel copyModel = TestModel.simpleMultiLevel();
- // Trigger save - restore sequence.
- fListener.reset();
- fListener.expectRestoreAfterSaveComplete();
- fViewer.setInput(copyModel.getRootElement());
+ // Trigger save - restore sequence.
+ fListener.reset();
+ fListener.expectRestoreAfterSaveComplete();
+ fViewer.setInput(copyModel.getRootElement());
waitWhile(t -> !fListener.isFinished(STATE_RESTORE_STARTED), createListenerErrorMessage());
assertTrue("RESTORE started before SAVE to complete", fListener.isFinished(STATE_SAVE_COMPLETE)); //$NON-NLS-1$
- }
+ }
- /**
- * This test tries to restore a viewer state while input == null.
- * See: Bug 380288 - NPE switching to the Breakpoints View
- */
+ /**
+ * This test tries to restore a viewer state while input == null.
+ * See: Bug 380288 - NPE switching to the Breakpoints View
+ */
public void testUpdateWithNullInput() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- ModelDelta expandedState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, expandedState, IModelDelta.EXPAND);
+ ModelDelta expandedState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
+ fViewer.saveElementState(TreePath.EMPTY, expandedState, IModelDelta.EXPAND);
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- fListener.addChildreCountUpdate(TreePath.EMPTY);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ fListener.addChildreCountUpdate(TreePath.EMPTY);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES), createListenerErrorMessage());
- fViewer.setInput(null);
- fViewer.updateViewer(expandedState);
+ fViewer.setInput(null);
+ fViewer.updateViewer(expandedState);
waitWhile(t -> !fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING), createListenerErrorMessage());
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java
index 572a92ea2..cb4da5b01 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModel.java
@@ -60,891 +60,891 @@ import org.junit.Assert;
*/
public class TestModel implements IElementContentProvider, IElementLabelProvider, IModelProxyFactory2 , IElementMementoProvider, IModelSelectionPolicyFactory {
- public static class TestElement extends PlatformObject {
- private final TestModel fModel;
- private final String fID;
- TestElement[] fChildren;
- String fLabelAppendix = ""; //$NON-NLS-1$
- boolean fExpanded;
- boolean fChecked;
- boolean fGrayed;
-
- public TestElement(TestModel model, String text, TestElement[] children) {
- this (model, text, false, false, children);
- }
-
- public TestElement(TestModel model, String text, boolean checked, boolean grayed, TestElement[] children) {
- fModel = model;
- fID = text;
- fChildren = children;
- fChecked = checked;
- fGrayed = grayed;
- }
-
- public TestModel getModel() {
- return fModel;
- }
+ public static class TestElement extends PlatformObject {
+ private final TestModel fModel;
+ private final String fID;
+ TestElement[] fChildren;
+ String fLabelAppendix = ""; //$NON-NLS-1$
+ boolean fExpanded;
+ boolean fChecked;
+ boolean fGrayed;
+
+ public TestElement(TestModel model, String text, TestElement[] children) {
+ this (model, text, false, false, children);
+ }
+
+ public TestElement(TestModel model, String text, boolean checked, boolean grayed, TestElement[] children) {
+ fModel = model;
+ fID = text;
+ fChildren = children;
+ fChecked = checked;
+ fGrayed = grayed;
+ }
+
+ public TestModel getModel() {
+ return fModel;
+ }
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter.isInstance(fModel)) {
+ if (adapter.isInstance(fModel)) {
return (T) fModel;
- }
- return null;
- }
+ }
+ return null;
+ }
- public String getID() {
- return fID;
- }
+ public String getID() {
+ return fID;
+ }
- public void setLabelAppendix(String appendix) {
- fLabelAppendix = appendix;
- }
+ public void setLabelAppendix(String appendix) {
+ fLabelAppendix = appendix;
+ }
- public String getLabel() {
- return fID + fLabelAppendix;
- }
+ public String getLabel() {
+ return fID + fLabelAppendix;
+ }
- public TestElement[] getChildren() {
- return fChildren;
- }
+ public TestElement[] getChildren() {
+ return fChildren;
+ }
- public boolean isExpanded() {
- return fExpanded;
- }
+ public boolean isExpanded() {
+ return fExpanded;
+ }
- public boolean getGrayed() {
- return fGrayed;
- }
+ public boolean getGrayed() {
+ return fGrayed;
+ }
- public boolean getChecked() {
- return fChecked;
- }
+ public boolean getChecked() {
+ return fChecked;
+ }
- public void setChecked(boolean checked, boolean grayed) {
- fChecked = checked;
- fGrayed = grayed;
- }
+ public void setChecked(boolean checked, boolean grayed) {
+ fChecked = checked;
+ fGrayed = grayed;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof TestElement && fID.equals(((TestElement)obj).fID);
- }
+ return obj instanceof TestElement && fID.equals(((TestElement)obj).fID);
+ }
- @Override
+ @Override
public int hashCode() {
- return fID.hashCode();
- }
+ return fID.hashCode();
+ }
- @Override
+ @Override
public String toString() {
- return getLabel();
- }
+ return getLabel();
+ }
- public int indexOf(TestElement child) {
- return Arrays.asList(fChildren).indexOf(child);
- }
- }
+ public int indexOf(TestElement child) {
+ return Arrays.asList(fChildren).indexOf(child);
+ }
+ }
- private class ModelProxy extends AbstractModelProxy {
- @Override
+ private class ModelProxy extends AbstractModelProxy {
+ @Override
public void installed(Viewer viewer) {
- super.installed(viewer);
- ModelDelta rootDelta = TestModel.this.getBaseDelta(new ModelDelta(fInput, IModelDelta.NO_CHANGE));
- installSubModelProxies(fRootPath, rootDelta);
- fireModelChanged(rootDelta);
- }
-
- private void installSubModelProxies(TreePath path, ModelDelta delta) {
- TestElement element = getElement(path);
- if (element.fModel != TestModel.this) {
- // Found an element from a different model. Install its proxy and return.
- delta.setFlags(delta.getFlags() | IModelDelta.INSTALL);
- } else {
- TestElement[] children = element.getChildren();
-
- for (int i = 0; i < children.length; i++) {
- installSubModelProxies(path.createChildPath(children[i]), delta.addNode(children[i], IModelDelta.NO_CHANGE));
- }
- }
- }
- }
-
- private TestElement fRoot;
- private Object fInput = null;
- private TreePath fRootPath = TreePath.EMPTY;
- private ModelProxy fModelProxy;
- private IModelSelectionPolicy fModelSelectionPolicy;
- private boolean fQueueingUpdates = false;
- private boolean fDelayUpdates = false;
+ super.installed(viewer);
+ ModelDelta rootDelta = TestModel.this.getBaseDelta(new ModelDelta(fInput, IModelDelta.NO_CHANGE));
+ installSubModelProxies(fRootPath, rootDelta);
+ fireModelChanged(rootDelta);
+ }
+
+ private void installSubModelProxies(TreePath path, ModelDelta delta) {
+ TestElement element = getElement(path);
+ if (element.fModel != TestModel.this) {
+ // Found an element from a different model. Install its proxy and return.
+ delta.setFlags(delta.getFlags() | IModelDelta.INSTALL);
+ } else {
+ TestElement[] children = element.getChildren();
+
+ for (int i = 0; i < children.length; i++) {
+ installSubModelProxies(path.createChildPath(children[i]), delta.addNode(children[i], IModelDelta.NO_CHANGE));
+ }
+ }
+ }
+ }
+
+ private TestElement fRoot;
+ private Object fInput = null;
+ private TreePath fRootPath = TreePath.EMPTY;
+ private ModelProxy fModelProxy;
+ private IModelSelectionPolicy fModelSelectionPolicy;
+ private boolean fQueueingUpdates = false;
+ private boolean fDelayUpdates = false;
private List<IViewerUpdate> fQueuedUpdates = new LinkedList<>();
- /**
- * Constructor private. Use static factory methods instead.
- */
- public TestModel() {}
+ /**
+ * Constructor private. Use static factory methods instead.
+ */
+ public TestModel() {}
- public TestElement getRootElement() {
- return fRoot;
- }
+ public TestElement getRootElement() {
+ return fRoot;
+ }
- public void setSelectionPolicy(IModelSelectionPolicy modelSelectionPolicy) {
- fModelSelectionPolicy = modelSelectionPolicy;
- }
+ public void setSelectionPolicy(IModelSelectionPolicy modelSelectionPolicy) {
+ fModelSelectionPolicy = modelSelectionPolicy;
+ }
- @Override
+ @Override
public IModelSelectionPolicy createModelSelectionPolicyAdapter(Object element, IPresentationContext context) {
- return fModelSelectionPolicy;
- }
-
- public ModelDelta getBaseDelta(ModelDelta rootDelta) {
- ModelDelta delta = rootDelta;
- for (int i = 0; i < fRootPath.getSegmentCount(); i++) {
- ModelDelta subDelta = delta.getChildDelta(fRootPath.getSegment(i));
- if (subDelta == null) {
- subDelta = delta.addNode(fRootPath.getSegment(i), IModelDelta.NO_CHANGE);
- }
- delta = subDelta;
- }
- delta.setChildCount(getRootElement().getChildren().length);
- return delta;
- }
-
- public int getModelDepth() {
- return getDepth(getRootElement(), 0);
- }
-
- private int getDepth(TestElement element, int atDepth) {
- TestElement[] children = element.getChildren();
- if (children.length == 0) {
- return atDepth;
- }
- int depth = atDepth + 1;
- for (int i = 0; i < children.length; i++) {
- depth = Math.max(depth, getDepth(children[i], atDepth + 1));
- }
-
- return depth;
- }
-
- public void setQeueueingUpdate(boolean queueingUpdates) {
- fQueueingUpdates = queueingUpdates;
- if (!fQueueingUpdates) {
- processQueuedUpdates();
- }
- }
-
- public void setDelayUpdates(boolean delayUpdates) {
- fDelayUpdates = delayUpdates;
- }
+ return fModelSelectionPolicy;
+ }
+
+ public ModelDelta getBaseDelta(ModelDelta rootDelta) {
+ ModelDelta delta = rootDelta;
+ for (int i = 0; i < fRootPath.getSegmentCount(); i++) {
+ ModelDelta subDelta = delta.getChildDelta(fRootPath.getSegment(i));
+ if (subDelta == null) {
+ subDelta = delta.addNode(fRootPath.getSegment(i), IModelDelta.NO_CHANGE);
+ }
+ delta = subDelta;
+ }
+ delta.setChildCount(getRootElement().getChildren().length);
+ return delta;
+ }
+
+ public int getModelDepth() {
+ return getDepth(getRootElement(), 0);
+ }
+
+ private int getDepth(TestElement element, int atDepth) {
+ TestElement[] children = element.getChildren();
+ if (children.length == 0) {
+ return atDepth;
+ }
+ int depth = atDepth + 1;
+ for (int i = 0; i < children.length; i++) {
+ depth = Math.max(depth, getDepth(children[i], atDepth + 1));
+ }
+
+ return depth;
+ }
+
+ public void setQeueueingUpdate(boolean queueingUpdates) {
+ fQueueingUpdates = queueingUpdates;
+ if (!fQueueingUpdates) {
+ processQueuedUpdates();
+ }
+ }
+
+ public void setDelayUpdates(boolean delayUpdates) {
+ fDelayUpdates = delayUpdates;
+ }
public List<IViewerUpdate> getQueuedUpdates() {
- return fQueuedUpdates;
- }
+ return fQueuedUpdates;
+ }
- public void processQueuedUpdates() {
+ public void processQueuedUpdates() {
List<IViewerUpdate> updates = new ArrayList<>(fQueuedUpdates);
- fQueuedUpdates.clear();
- for (int i = 0; i < updates.size(); i++) {
- processUpdate(updates.get(i));
- }
- }
-
- public void processUpdate(IViewerUpdate update) {
- if (update instanceof IHasChildrenUpdate) {
- doHasChildrenUpdate((IHasChildrenUpdate)update);
- } else if (update instanceof IChildrenCountUpdate) {
- doChildrenCountUpdate((IChildrenCountUpdate)update);
- } else if (update instanceof IChildrenUpdate) {
- doChildrenUpdate((IChildrenUpdate)update);
- } else if (update instanceof ILabelUpdate) {
- doLabelUpdate((ILabelUpdate)update);
- } else if (update instanceof IElementCompareRequest) {
- doCompareElements((IElementCompareRequest)update);
- } else if (update instanceof IElementMementoRequest) {
- doEncodeElements((IElementMementoRequest)update);
- }
- }
-
- private void processUpdates(IViewerUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- processUpdate(updates[i]);
- }
- }
-
- private void doUpdate(final IViewerUpdate[] updates) {
- if (fQueueingUpdates) {
- fQueuedUpdates.addAll(Arrays.asList(updates));
- } else if (fDelayUpdates) {
+ fQueuedUpdates.clear();
+ for (int i = 0; i < updates.size(); i++) {
+ processUpdate(updates.get(i));
+ }
+ }
+
+ public void processUpdate(IViewerUpdate update) {
+ if (update instanceof IHasChildrenUpdate) {
+ doHasChildrenUpdate((IHasChildrenUpdate)update);
+ } else if (update instanceof IChildrenCountUpdate) {
+ doChildrenCountUpdate((IChildrenCountUpdate)update);
+ } else if (update instanceof IChildrenUpdate) {
+ doChildrenUpdate((IChildrenUpdate)update);
+ } else if (update instanceof ILabelUpdate) {
+ doLabelUpdate((ILabelUpdate)update);
+ } else if (update instanceof IElementCompareRequest) {
+ doCompareElements((IElementCompareRequest)update);
+ } else if (update instanceof IElementMementoRequest) {
+ doEncodeElements((IElementMementoRequest)update);
+ }
+ }
+
+ private void processUpdates(IViewerUpdate[] updates) {
+ for (int i = 0; i < updates.length; i++) {
+ processUpdate(updates[i]);
+ }
+ }
+
+ private void doUpdate(final IViewerUpdate[] updates) {
+ if (fQueueingUpdates) {
+ fQueuedUpdates.addAll(Arrays.asList(updates));
+ } else if (fDelayUpdates) {
Display.getDefault().asyncExec(() -> processUpdates(updates));
- } else {
+ } else {
processUpdates(updates);
- }
- }
+ }
+ }
- @Override
+ @Override
public void update(IHasChildrenUpdate[] updates) {
- doUpdate(updates);
- }
+ doUpdate(updates);
+ }
- private void doHasChildrenUpdate(IHasChildrenUpdate update) {
- TestElement element = (TestElement)update.getElement();
- update.setHasChilren(element.getChildren().length > 0);
- update.done();
- }
+ private void doHasChildrenUpdate(IHasChildrenUpdate update) {
+ TestElement element = (TestElement)update.getElement();
+ update.setHasChilren(element.getChildren().length > 0);
+ update.done();
+ }
- @Override
+ @Override
public void update(IChildrenCountUpdate[] updates) {
- doUpdate(updates);
- }
+ doUpdate(updates);
+ }
- private void doChildrenCountUpdate(IChildrenCountUpdate update) {
- TestElement element = (TestElement)update.getElement();
- update.setChildCount(element.getChildren().length);
- update.done();
- }
+ private void doChildrenCountUpdate(IChildrenCountUpdate update) {
+ TestElement element = (TestElement)update.getElement();
+ update.setChildCount(element.getChildren().length);
+ update.done();
+ }
- @Override
+ @Override
public void update(IChildrenUpdate[] updates) {
- doUpdate(updates);
- }
-
- private void doChildrenUpdate(IChildrenUpdate update) {
- TestElement element = (TestElement)update.getElement();
- int endOffset = update.getOffset() + update.getLength();
- for (int j = update.getOffset(); j < endOffset; j++) {
- if (j < element.getChildren().length) {
- update.setChild(element.getChildren()[j], j);
- }
- }
- update.done();
- }
-
- @Override
+ doUpdate(updates);
+ }
+
+ private void doChildrenUpdate(IChildrenUpdate update) {
+ TestElement element = (TestElement)update.getElement();
+ int endOffset = update.getOffset() + update.getLength();
+ for (int j = update.getOffset(); j < endOffset; j++) {
+ if (j < element.getChildren().length) {
+ update.setChild(element.getChildren()[j], j);
+ }
+ }
+ update.done();
+ }
+
+ @Override
public void update(ILabelUpdate[] updates) {
- doUpdate(updates);
- }
-
- private void doLabelUpdate(ILabelUpdate update) {
- TestElement element = (TestElement)update.getElement();
- update.setLabel(element.getLabel(), 0);
- if (update instanceof ICheckUpdate &&
- Boolean.TRUE.equals(update.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
- {
- ((ICheckUpdate)update).setChecked(element.getChecked(), element.getGrayed());
- }
- update.done();
- }
-
- public final static String ELEMENT_MEMENTO_ID = "id"; //$NON-NLS-1$
-
- @Override
+ doUpdate(updates);
+ }
+
+ private void doLabelUpdate(ILabelUpdate update) {
+ TestElement element = (TestElement)update.getElement();
+ update.setLabel(element.getLabel(), 0);
+ if (update instanceof ICheckUpdate &&
+ Boolean.TRUE.equals(update.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
+ {
+ ((ICheckUpdate)update).setChecked(element.getChecked(), element.getGrayed());
+ }
+ update.done();
+ }
+
+ public final static String ELEMENT_MEMENTO_ID = "id"; //$NON-NLS-1$
+
+ @Override
public void compareElements(final IElementCompareRequest[] updates) {
- doUpdate(updates);
- }
+ doUpdate(updates);
+ }
- private void doCompareElements(IElementCompareRequest update) {
- String elementID = ((TestElement)update.getElement()).getID();
- String mementoID = update.getMemento().getString(ELEMENT_MEMENTO_ID);
- update.setEqual( elementID.equals(mementoID) );
- update.done();
- }
+ private void doCompareElements(IElementCompareRequest update) {
+ String elementID = ((TestElement)update.getElement()).getID();
+ String mementoID = update.getMemento().getString(ELEMENT_MEMENTO_ID);
+ update.setEqual( elementID.equals(mementoID) );
+ update.done();
+ }
- @Override
+ @Override
public void encodeElements(IElementMementoRequest[] updates) {
- doUpdate(updates);
- }
-
- private void doEncodeElements(IElementMementoRequest update) {
- String elementID = ((TestElement)update.getElement()).getID();
- update.getMemento().putString(ELEMENT_MEMENTO_ID, elementID);
- update.done();
- }
-
- /**
- * @param context the context
- * @param viewerInput the input
- * @param path the path
- * @param checked the checked state
- */
- public void elementChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
- TestElement element = getElement(path);
- Assert.assertFalse(element.getGrayed());
- element.setChecked(checked, false);
- }
-
- @Override
+ doUpdate(updates);
+ }
+
+ private void doEncodeElements(IElementMementoRequest update) {
+ String elementID = ((TestElement)update.getElement()).getID();
+ update.getMemento().putString(ELEMENT_MEMENTO_ID, elementID);
+ update.done();
+ }
+
+ /**
+ * @param context the context
+ * @param viewerInput the input
+ * @param path the path
+ * @param checked the checked state
+ */
+ public void elementChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
+ TestElement element = getElement(path);
+ Assert.assertFalse(element.getGrayed());
+ element.setChecked(checked, false);
+ }
+
+ @Override
public IModelProxy createTreeModelProxy(Object input, TreePath path, IPresentationContext context) {
- fModelProxy = new ModelProxy();
- fInput = input;
- fRootPath = path;
- return fModelProxy;
- }
-
- public IModelProxy getModelProxy() {
- return fModelProxy;
- }
-
- public TestElement getElement(TreePath path) {
- if (path.getSegmentCount() == 0) {
- return getRootElement();
- } else {
- return (TestElement)path.getLastSegment();
- }
- }
-
- public void setAllExpanded() {
- doSetExpanded(fRoot);
- }
-
- private void doSetExpanded(TestElement element) {
- element.fExpanded = true;
- for (int i = 0; i < element.fChildren.length; i++) {
- doSetExpanded(element.fChildren[i]);
- }
- }
-
- public void setAllAppendix(String appendix) {
- doSetAllAppendix(fRoot, appendix);
- }
-
- private void doSetAllAppendix(TestElement element, String appendix) {
- element.setLabelAppendix(appendix);
- for (int i = 0; i < element.fChildren.length; i++) {
- doSetAllAppendix(element.fChildren[i], appendix);
- }
- }
-
- public void validateData(ITreeModelViewer viewer, TreePath path) {
- validateData(viewer, path, false);
- }
-
- public void validateData(ITreeModelViewer _viewer, TreePath path, boolean expandedElementsOnly) {
- validateData(_viewer, path, expandedElementsOnly, TestModelUpdatesListener.EMPTY_FILTER_ARRAY);
- }
-
- public void validateData(ITreeModelViewer _viewer, TreePath path, boolean expandedElementsOnly, ViewerFilter[] filters) {
- IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)_viewer;
- TestElement element = getElement(path);
- if ( Boolean.TRUE.equals(_viewer.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)) ) {
- Assert.assertTrue(element.getChecked() == viewer.getElementChecked(path));
- Assert.assertTrue(element.getGrayed() == viewer.getElementGrayed(path));
- }
-
- if (!expandedElementsOnly || path.getSegmentCount() == 0 || viewer.getExpandedState(path) ) {
- TestElement[] children = element.getChildren();
-
- int viewerIndex = 0;
- for (int i = 0; i < children.length; i++) {
- if (TestModelUpdatesListener.isFiltered(children[i], filters)) {
- continue;
- }
- Assert.assertEquals(children[i], viewer.getChildElement(path, viewerIndex));
- validateData(viewer, path.createChildPath(children[i]), expandedElementsOnly, filters);
- viewerIndex++;
- }
- Assert.assertEquals(viewerIndex, viewer.getChildCount(path));
- } else if (!viewer.getExpandedState(path)) {
- // If element not expanded, verify the plus sign.
- Assert.assertTrue(viewer.getHasChildren(path) == element.getChildren().length > 0);
- }
- }
-
- public void setRoot(TestElement root) {
- fRoot = root;
- }
-
- public void postDelta(IModelDelta delta) {
- fModelProxy.fireModelChanged(delta);
- }
-
- /** Create or retrieve delta for given path
- * @param combine if then new deltas for the given path are created. If false existing ones are reused.
- */
- public ModelDelta getElementDelta(ModelDelta baseDelta, TreePath path, boolean combine) {
- TestElement element = getRootElement();
- ModelDelta delta = baseDelta;
-
- for (int i = 0; i < path.getSegmentCount(); i++) {
- TestElement[] children = element.getChildren();
- delta.setChildCount(children.length);
- Object segment = path.getSegment(i);
- int j;
- for (j = 0; j < children.length; j++) {
- if (segment.equals(children[j])) {
- element = children[j];
- ModelDelta nextDelta = null;
- if (combine) {
- nextDelta = delta.getChildDelta(element);
- }
- if (nextDelta == null) {
- nextDelta = delta.addNode(element, j, IModelDelta.NO_CHANGE, element.getChildren().length);
- }
- delta = nextDelta;
- break;
- }
- }
- if (j == children.length) {
- throw new IllegalArgumentException("Invalid path"); //$NON-NLS-1$
- }
- }
- return delta;
-
- }
-
- private TreePath getRelativePath(TreePath path) {
- Object[] segments = new Object[path.getSegmentCount() - fRootPath.getSegmentCount()];
- for (int i = fRootPath.getSegmentCount(), _i = 0; i < path.getSegmentCount(); i++, _i++) {
- segments[_i] = path.getSegment(i);
- }
- return new TreePath(segments);
- }
-
- public ModelDelta appendElementLabel(TreePath path, String labelAppendix) {
- org.junit.Assert.assertTrue(path.startsWith(fRootPath, null));
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(path);
- TestElement element = getElement(relativePath);
- ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
- element.setLabelAppendix(labelAppendix);
- delta.setFlags(delta.getFlags() | IModelDelta.STATE);
-
- return rootDelta;
- }
-
- public ModelDelta setElementChecked(TreePath path, boolean checked, boolean grayed) {
- Assert.assertTrue(path.startsWith(fRootPath, null));
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(path);
- TestElement element = getElement(relativePath);
- ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
- element.setChecked(checked, grayed);
- delta.setFlags(delta.getFlags() | IModelDelta.STATE);
-
- return rootDelta;
- }
-
- public ModelDelta setElementChildren(TreePath path, TestElement[] children) {
- Assert.assertTrue(path.startsWith(fRootPath, null));
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(path);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(relativePath);
- ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
-
- // Set the new children array
- element.fChildren = children;
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setFlags(delta.getFlags() | IModelDelta.CONTENT);
- delta.setChildCount(children.length);
-
- return rootDelta;
- }
-
- public ModelDelta replaceElementChild(TreePath parentPath, int index, TestElement child) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(parentPath);
-
- TestElement element = getElement(relativePath);
- ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
- TestElement oldChild = element.fChildren[index];
- element.fChildren[index] = child;
- delta.addNode(oldChild, child, IModelDelta.REPLACED);
- // TODO: set replacement index!?!
-
- return rootDelta;
- }
-
- public ModelDelta addElementChild(TreePath parentPath, ModelDelta rootDelta, int index, TestElement newChild) {
- if (rootDelta == null) {
- rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- }
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(parentPath);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(relativePath);
- ModelDelta delta= getElementDelta(baseDelta, relativePath, true);
-
- // Add the new element
- element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setChildCount(element.getChildren().length);
- delta.addNode(newChild, index, IModelDelta.ADDED);
-
- return rootDelta;
- }
-
- public ModelDelta insertElementChild(TreePath parentPath, int index, TestElement newChild) {
- return insertElementChild(null, parentPath, index, newChild);
- }
-
- public ModelDelta insertElementChild(ModelDelta rootDelta, TreePath parentPath, int index, TestElement newChild) {
- if (rootDelta == null) {
- rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- }
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(parentPath);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(relativePath);
- ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
-
- // Add the new element
- element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setChildCount(element.getChildren().length);
- delta.addNode(newChild, index, IModelDelta.INSERTED);
-
- return rootDelta;
- }
-
- private TestElement[] doInsertElementInArray(TestElement[] children, int index, TestElement newChild) {
- // Create the new children array add the element to it and set it to
- // the parent.
- TestElement[] newChildren = new TestElement[children.length + 1];
- System.arraycopy(children, 0, newChildren, 0, index);
- newChildren[index] = newChild;
- System.arraycopy(children, index, newChildren, index + 1, children.length - index);
- return newChildren;
- }
-
- public ModelDelta removeElementChild(TreePath parentPath, int index) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(parentPath);
- ModelDelta delta= getElementDelta(baseDelta, parentPath, false);
-
- // Create a new child array with the element removed
- TestElement[] children = element.getChildren();
- TestElement childToRemove = children[index];
- TestElement[] newChildren = new TestElement[children.length - 1];
- System.arraycopy(children, 0, newChildren, 0, index);
- System.arraycopy(children, index + 1, newChildren, index, children.length - index - 1);
- element.fChildren = newChildren;
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setChildCount(element.getChildren().length);
- delta.addNode(childToRemove, index, IModelDelta.REMOVED);
-
- return rootDelta;
- }
-
- public ModelDelta makeElementDelta(TreePath path, int flags) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
-
- // Find the element and generate the delta node for it.
- ModelDelta delta= getElementDelta(baseDelta, path, false);
-
- delta.setFlags(flags);
- return rootDelta;
- }
-
- public TreePath findElement(String label) {
- return findElement(TreePath.EMPTY, label);
- }
-
- public TreePath findElement(TreePath startPath, String label) {
- TestElement element = getElement(startPath);
- for (int i = 0; i < element.getChildren().length; i++) {
- TestElement child = element.getChildren()[i];
- TreePath path = startPath.createChildPath(child);
- if ( label.equals(child.getLabel()) ) {
- return path;
- } else {
- TreePath subPath = findElement(path, label);
- if (subPath != null) {
- return subPath;
- }
- }
- }
- return null;
- }
-
- @Override
+ fModelProxy = new ModelProxy();
+ fInput = input;
+ fRootPath = path;
+ return fModelProxy;
+ }
+
+ public IModelProxy getModelProxy() {
+ return fModelProxy;
+ }
+
+ public TestElement getElement(TreePath path) {
+ if (path.getSegmentCount() == 0) {
+ return getRootElement();
+ } else {
+ return (TestElement)path.getLastSegment();
+ }
+ }
+
+ public void setAllExpanded() {
+ doSetExpanded(fRoot);
+ }
+
+ private void doSetExpanded(TestElement element) {
+ element.fExpanded = true;
+ for (int i = 0; i < element.fChildren.length; i++) {
+ doSetExpanded(element.fChildren[i]);
+ }
+ }
+
+ public void setAllAppendix(String appendix) {
+ doSetAllAppendix(fRoot, appendix);
+ }
+
+ private void doSetAllAppendix(TestElement element, String appendix) {
+ element.setLabelAppendix(appendix);
+ for (int i = 0; i < element.fChildren.length; i++) {
+ doSetAllAppendix(element.fChildren[i], appendix);
+ }
+ }
+
+ public void validateData(ITreeModelViewer viewer, TreePath path) {
+ validateData(viewer, path, false);
+ }
+
+ public void validateData(ITreeModelViewer _viewer, TreePath path, boolean expandedElementsOnly) {
+ validateData(_viewer, path, expandedElementsOnly, TestModelUpdatesListener.EMPTY_FILTER_ARRAY);
+ }
+
+ public void validateData(ITreeModelViewer _viewer, TreePath path, boolean expandedElementsOnly, ViewerFilter[] filters) {
+ IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)_viewer;
+ TestElement element = getElement(path);
+ if ( Boolean.TRUE.equals(_viewer.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)) ) {
+ Assert.assertTrue(element.getChecked() == viewer.getElementChecked(path));
+ Assert.assertTrue(element.getGrayed() == viewer.getElementGrayed(path));
+ }
+
+ if (!expandedElementsOnly || path.getSegmentCount() == 0 || viewer.getExpandedState(path) ) {
+ TestElement[] children = element.getChildren();
+
+ int viewerIndex = 0;
+ for (int i = 0; i < children.length; i++) {
+ if (TestModelUpdatesListener.isFiltered(children[i], filters)) {
+ continue;
+ }
+ Assert.assertEquals(children[i], viewer.getChildElement(path, viewerIndex));
+ validateData(viewer, path.createChildPath(children[i]), expandedElementsOnly, filters);
+ viewerIndex++;
+ }
+ Assert.assertEquals(viewerIndex, viewer.getChildCount(path));
+ } else if (!viewer.getExpandedState(path)) {
+ // If element not expanded, verify the plus sign.
+ Assert.assertTrue(viewer.getHasChildren(path) == element.getChildren().length > 0);
+ }
+ }
+
+ public void setRoot(TestElement root) {
+ fRoot = root;
+ }
+
+ public void postDelta(IModelDelta delta) {
+ fModelProxy.fireModelChanged(delta);
+ }
+
+ /** Create or retrieve delta for given path
+ * @param combine if then new deltas for the given path are created. If false existing ones are reused.
+ */
+ public ModelDelta getElementDelta(ModelDelta baseDelta, TreePath path, boolean combine) {
+ TestElement element = getRootElement();
+ ModelDelta delta = baseDelta;
+
+ for (int i = 0; i < path.getSegmentCount(); i++) {
+ TestElement[] children = element.getChildren();
+ delta.setChildCount(children.length);
+ Object segment = path.getSegment(i);
+ int j;
+ for (j = 0; j < children.length; j++) {
+ if (segment.equals(children[j])) {
+ element = children[j];
+ ModelDelta nextDelta = null;
+ if (combine) {
+ nextDelta = delta.getChildDelta(element);
+ }
+ if (nextDelta == null) {
+ nextDelta = delta.addNode(element, j, IModelDelta.NO_CHANGE, element.getChildren().length);
+ }
+ delta = nextDelta;
+ break;
+ }
+ }
+ if (j == children.length) {
+ throw new IllegalArgumentException("Invalid path"); //$NON-NLS-1$
+ }
+ }
+ return delta;
+
+ }
+
+ private TreePath getRelativePath(TreePath path) {
+ Object[] segments = new Object[path.getSegmentCount() - fRootPath.getSegmentCount()];
+ for (int i = fRootPath.getSegmentCount(), _i = 0; i < path.getSegmentCount(); i++, _i++) {
+ segments[_i] = path.getSegment(i);
+ }
+ return new TreePath(segments);
+ }
+
+ public ModelDelta appendElementLabel(TreePath path, String labelAppendix) {
+ org.junit.Assert.assertTrue(path.startsWith(fRootPath, null));
+ ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+ TreePath relativePath = getRelativePath(path);
+ TestElement element = getElement(relativePath);
+ ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
+ element.setLabelAppendix(labelAppendix);
+ delta.setFlags(delta.getFlags() | IModelDelta.STATE);
+
+ return rootDelta;
+ }
+
+ public ModelDelta setElementChecked(TreePath path, boolean checked, boolean grayed) {
+ Assert.assertTrue(path.startsWith(fRootPath, null));
+ ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+ TreePath relativePath = getRelativePath(path);
+ TestElement element = getElement(relativePath);
+ ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
+ element.setChecked(checked, grayed);
+ delta.setFlags(delta.getFlags() | IModelDelta.STATE);
+
+ return rootDelta;
+ }
+
+ public ModelDelta setElementChildren(TreePath path, TestElement[] children) {
+ Assert.assertTrue(path.startsWith(fRootPath, null));
+ ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+ TreePath relativePath = getRelativePath(path);
+
+ // Find the parent element and generate the delta node for it.
+ TestElement element = getElement(relativePath);
+ ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
+
+ // Set the new children array
+ element.fChildren = children;
+
+ // Add the delta flag and update the child count in the parent delta.
+ delta.setFlags(delta.getFlags() | IModelDelta.CONTENT);
+ delta.setChildCount(children.length);
+
+ return rootDelta;
+ }
+
+ public ModelDelta replaceElementChild(TreePath parentPath, int index, TestElement child) {
+ ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+ TreePath relativePath = getRelativePath(parentPath);
+
+ TestElement element = getElement(relativePath);
+ ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
+ TestElement oldChild = element.fChildren[index];
+ element.fChildren[index] = child;
+ delta.addNode(oldChild, child, IModelDelta.REPLACED);
+ // TODO: set replacement index!?!
+
+ return rootDelta;
+ }
+
+ public ModelDelta addElementChild(TreePath parentPath, ModelDelta rootDelta, int index, TestElement newChild) {
+ if (rootDelta == null) {
+ rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ }
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+ TreePath relativePath = getRelativePath(parentPath);
+
+ // Find the parent element and generate the delta node for it.
+ TestElement element = getElement(relativePath);
+ ModelDelta delta= getElementDelta(baseDelta, relativePath, true);
+
+ // Add the new element
+ element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
+
+ // Add the delta flag and update the child count in the parent delta.
+ delta.setChildCount(element.getChildren().length);
+ delta.addNode(newChild, index, IModelDelta.ADDED);
+
+ return rootDelta;
+ }
+
+ public ModelDelta insertElementChild(TreePath parentPath, int index, TestElement newChild) {
+ return insertElementChild(null, parentPath, index, newChild);
+ }
+
+ public ModelDelta insertElementChild(ModelDelta rootDelta, TreePath parentPath, int index, TestElement newChild) {
+ if (rootDelta == null) {
+ rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ }
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+ TreePath relativePath = getRelativePath(parentPath);
+
+ // Find the parent element and generate the delta node for it.
+ TestElement element = getElement(relativePath);
+ ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
+
+ // Add the new element
+ element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
+
+ // Add the delta flag and update the child count in the parent delta.
+ delta.setChildCount(element.getChildren().length);
+ delta.addNode(newChild, index, IModelDelta.INSERTED);
+
+ return rootDelta;
+ }
+
+ private TestElement[] doInsertElementInArray(TestElement[] children, int index, TestElement newChild) {
+ // Create the new children array add the element to it and set it to
+ // the parent.
+ TestElement[] newChildren = new TestElement[children.length + 1];
+ System.arraycopy(children, 0, newChildren, 0, index);
+ newChildren[index] = newChild;
+ System.arraycopy(children, index, newChildren, index + 1, children.length - index);
+ return newChildren;
+ }
+
+ public ModelDelta removeElementChild(TreePath parentPath, int index) {
+ ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+
+ // Find the parent element and generate the delta node for it.
+ TestElement element = getElement(parentPath);
+ ModelDelta delta= getElementDelta(baseDelta, parentPath, false);
+
+ // Create a new child array with the element removed
+ TestElement[] children = element.getChildren();
+ TestElement childToRemove = children[index];
+ TestElement[] newChildren = new TestElement[children.length - 1];
+ System.arraycopy(children, 0, newChildren, 0, index);
+ System.arraycopy(children, index + 1, newChildren, index, children.length - index - 1);
+ element.fChildren = newChildren;
+
+ // Add the delta flag and update the child count in the parent delta.
+ delta.setChildCount(element.getChildren().length);
+ delta.addNode(childToRemove, index, IModelDelta.REMOVED);
+
+ return rootDelta;
+ }
+
+ public ModelDelta makeElementDelta(TreePath path, int flags) {
+ ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = getBaseDelta(rootDelta);
+
+ // Find the element and generate the delta node for it.
+ ModelDelta delta= getElementDelta(baseDelta, path, false);
+
+ delta.setFlags(flags);
+ return rootDelta;
+ }
+
+ public TreePath findElement(String label) {
+ return findElement(TreePath.EMPTY, label);
+ }
+
+ public TreePath findElement(TreePath startPath, String label) {
+ TestElement element = getElement(startPath);
+ for (int i = 0; i < element.getChildren().length; i++) {
+ TestElement child = element.getChildren()[i];
+ TreePath path = startPath.createChildPath(child);
+ if ( label.equals(child.getLabel()) ) {
+ return path;
+ } else {
+ TreePath subPath = findElement(path, label);
+ if (subPath != null) {
+ return subPath;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
public String toString() {
- return getElementString(fRoot, ""); //$NON-NLS-1$
- }
-
- public String getElementString(TestElement element, String indent) {
- StringBuilder builder = new StringBuilder();
- builder.append(indent);
- builder.append(element.toString());
- builder.append('\n');
- TestElement[] children = element.getChildren();
- for (int i = 0; i < children.length; i++) {
- builder.append(getElementString(children[i], indent + " ")); //$NON-NLS-1$
- }
- return builder.toString();
- }
-
- public static TestModel simpleSingleLevel() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", makeSingleLevelModelElements(model, 6, ""))); //$NON-NLS-1$ //$NON-NLS-2$
- return model;
- }
-
- public static TestElement[] makeSingleLevelModelElements(TestModel model, int length, String prefix) {
- TestElement[] elements = new TestElement[length];
- for (int i = 1; i <= length; i++) {
- String name = prefix + i;
- elements[i - 1] = new TestElement(model, name, new TestElement[0]);
- }
- return elements;
- }
-
- public static TestElement[] makeMultiLevelElements(TestModel model, int depth, String prefix) {
- TestElement[] elements = new TestElement[depth];
- for (int i = 0; i < depth; i++) {
- String name = prefix + i;
- elements[i] = new TestElement(model, name, makeMultiLevelElements(model, i, name + ".")); //$NON-NLS-1$
- }
- return elements;
- }
-
- public static TestElement[] makeMultiLevelElements2(TestModel model, int[] levelCounts, String prefix) {
- if (levelCounts.length == 0) {
+ return getElementString(fRoot, ""); //$NON-NLS-1$
+ }
+
+ public String getElementString(TestElement element, String indent) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(indent);
+ builder.append(element.toString());
+ builder.append('\n');
+ TestElement[] children = element.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ builder.append(getElementString(children[i], indent + " ")); //$NON-NLS-1$
+ }
+ return builder.toString();
+ }
+
+ public static TestModel simpleSingleLevel() {
+ TestModel model = new TestModel();
+ model.setRoot( new TestElement(model, "root", makeSingleLevelModelElements(model, 6, ""))); //$NON-NLS-1$ //$NON-NLS-2$
+ return model;
+ }
+
+ public static TestElement[] makeSingleLevelModelElements(TestModel model, int length, String prefix) {
+ TestElement[] elements = new TestElement[length];
+ for (int i = 1; i <= length; i++) {
+ String name = prefix + i;
+ elements[i - 1] = new TestElement(model, name, new TestElement[0]);
+ }
+ return elements;
+ }
+
+ public static TestElement[] makeMultiLevelElements(TestModel model, int depth, String prefix) {
+ TestElement[] elements = new TestElement[depth];
+ for (int i = 0; i < depth; i++) {
+ String name = prefix + i;
+ elements[i] = new TestElement(model, name, makeMultiLevelElements(model, i, name + ".")); //$NON-NLS-1$
+ }
+ return elements;
+ }
+
+ public static TestElement[] makeMultiLevelElements2(TestModel model, int[] levelCounts, String prefix) {
+ if (levelCounts.length == 0) {
return new TestElement[0];
}
- int count = levelCounts[0];
- int[] oldLevelCounts = levelCounts;
- levelCounts = new int[levelCounts.length - 1];
- System.arraycopy(oldLevelCounts, 1, levelCounts, 0, levelCounts.length);
- TestElement[] elements = new TestElement[count];
- for (int i = 0; i < count; i++) {
- String name = prefix + i;
- elements[i] = new TestElement(model, name, makeMultiLevelElements2(model, levelCounts, name + ".")); //$NON-NLS-1$
- }
- return elements;
- }
-
- public static TestModel simpleMultiLevel() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "2", true, false, new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.1", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.1.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.1.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.1.3", new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3.2", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.2.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.2.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.2.3", new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3.3", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.3.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.3.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.3.3", new TestElement[0]), //$NON-NLS-1$
- }),
- })
- }) );
- return model;
- }
-
- public static TestModel compositeMultiLevel() {
- TestModel m2 = new TestModel();
- m2.setRoot( new TestElement(m2, "m2.root", new TestElement[] { //$NON-NLS-1$
- new TestElement(m2, "m2.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(m2, "m2.2", true, false, new TestElement[] { //$NON-NLS-1$
- new TestElement(m2, "m2.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(m2, "m2.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(m2, "m2.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
- }),
- }) );
-
- TestModel m3 = new TestModel();
- m3.setRoot( new TestElement(m3, "m3.root", new TestElement[] { //$NON-NLS-1$
- new TestElement(m3, "m3.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(m3, "m3.2", true, false, new TestElement[] { //$NON-NLS-1$
- new TestElement(m3, "m3.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(m3, "m3.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(m3, "m3.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
- }),
- }) );
-
- TestModel m4 = new TestModel();
- m4.setRoot( new TestElement(m4, "m4.root", new TestElement[] { //$NON-NLS-1$
- new TestElement(m4, "m4.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(m4, "m4.2", true, false, new TestElement[] { //$NON-NLS-1$
- new TestElement(m4, "m4.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(m4, "m4.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(m4, "m4.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
- }),
- }) );
-
- TestModel m1 = new TestModel();
- m1.setRoot( new TestElement(m1, "m1.root", new TestElement[] { //$NON-NLS-1$
- new TestElement(m1, "m1.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(m1, "m1.2", true, false, new TestElement[] { //$NON-NLS-1$
- m2.fRoot,
- m3.fRoot,
- m4.fRoot,
- }),
- }) );
-
-
- return m1;
- }
-
- public static TestModel simpleDeepMultiLevel() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "2", true, false, new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.1", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.1.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.1.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.1.3", new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3.2", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.2.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.2.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.2.3", new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3.3", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.3.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.3.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.3.3", new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3.4", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.4.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.4.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.4.3", new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3.5", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.5.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.5.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.5.3", new TestElement[0]), //$NON-NLS-1$
- }),
- new TestElement(model, "3.6", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.6.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.6.3.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.4", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.5", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.6", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.7", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.8", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.9", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.10", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.11", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.12", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.13", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.14", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.15", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.4", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.5", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.6", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.7", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.8", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.9", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.10", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.11", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.12", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.13", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.14", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.15", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.4", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.5", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.6", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.7", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.8", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.9", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.10", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.11", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.12", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.13", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.14", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.15", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16", new TestElement[] { //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
- new TestElement(model, "3.6.3.16.16.16.16.16.16", new TestElement[0]), //$NON-NLS-1$
- }),
- }),
- }),
- }),
- }),
- }),
- }),
- })
- }) );
- return model;
- }
+ int count = levelCounts[0];
+ int[] oldLevelCounts = levelCounts;
+ levelCounts = new int[levelCounts.length - 1];
+ System.arraycopy(oldLevelCounts, 1, levelCounts, 0, levelCounts.length);
+ TestElement[] elements = new TestElement[count];
+ for (int i = 0; i < count; i++) {
+ String name = prefix + i;
+ elements[i] = new TestElement(model, name, makeMultiLevelElements2(model, levelCounts, name + ".")); //$NON-NLS-1$
+ }
+ return elements;
+ }
+
+ public static TestModel simpleMultiLevel() {
+ TestModel model = new TestModel();
+ model.setRoot( new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3.2", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.2.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3.3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ })
+ }) );
+ return model;
+ }
+
+ public static TestModel compositeMultiLevel() {
+ TestModel m2 = new TestModel();
+ m2.setRoot( new TestElement(m2, "m2.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m2, "m2.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m2, "m2.2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(m2, "m2.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m2, "m2.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m2, "m2.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
+ }),
+ }) );
+
+ TestModel m3 = new TestModel();
+ m3.setRoot( new TestElement(m3, "m3.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m3, "m3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m3, "m3.2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(m3, "m3.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m3, "m3.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m3, "m3.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
+ }),
+ }) );
+
+ TestModel m4 = new TestModel();
+ m4.setRoot( new TestElement(m4, "m4.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m4, "m4.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "m4.2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(m4, "m4.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "m4.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "m4.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
+ }),
+ }) );
+
+ TestModel m1 = new TestModel();
+ m1.setRoot( new TestElement(m1, "m1.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m1, "m1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m1, "m1.2", true, false, new TestElement[] { //$NON-NLS-1$
+ m2.fRoot,
+ m3.fRoot,
+ m4.fRoot,
+ }),
+ }) );
+
+
+ return m1;
+ }
+
+ public static TestModel simpleDeepMultiLevel() {
+ TestModel model = new TestModel();
+ model.setRoot( new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3.2", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.2.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3.3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3.4", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.4.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.4.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.4.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3.5", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.5.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.5.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.5.3", new TestElement[0]), //$NON-NLS-1$
+ }),
+ new TestElement(model, "3.6", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.16", new TestElement[0]), //$NON-NLS-1$
+ }),
+ }),
+ }),
+ }),
+ }),
+ }),
+ }),
+ })
+ }) );
+ return model;
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
index 2798ee6cf..33b262caf 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
@@ -29,76 +29,76 @@ import org.eclipse.swt.widgets.Widget;
public class TreeModelViewerAutopopulateAgent implements IViewerUpdateListener {
- private TreeModelViewer fViewer;
+ private TreeModelViewer fViewer;
- public TreeModelViewerAutopopulateAgent(TreeModelViewer viewer) {
- fViewer = viewer;
- fViewer.addViewerUpdateListener(this);
- }
+ public TreeModelViewerAutopopulateAgent(TreeModelViewer viewer) {
+ fViewer = viewer;
+ fViewer.addViewerUpdateListener(this);
+ }
- public void dispose() {
- fViewer.removeViewerUpdateListener(this);
- fViewer = null;
- }
+ public void dispose() {
+ fViewer.removeViewerUpdateListener(this);
+ fViewer = null;
+ }
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {
- if (update instanceof IChildrenCountUpdate) {
- TreePath path = update.getElementPath();
- ILazyTreePathContentProvider contentProvider = (ILazyTreePathContentProvider) fViewer.getContentProvider();
-
- Widget[] items = fViewer.testFindItems(update.getElement());
- for (int i = 0; i < items.length; i++) {
- if ( path.equals(getTreePath(items[i])) ) {
- int itemCount = getItemChildCount(items[i]);
- for (int j = 0; j < itemCount; j++) {
- contentProvider.updateElement(path, j);
- }
- }
- }
- }
- }
-
- @Override
+ if (update instanceof IChildrenCountUpdate) {
+ TreePath path = update.getElementPath();
+ ILazyTreePathContentProvider contentProvider = (ILazyTreePathContentProvider) fViewer.getContentProvider();
+
+ Widget[] items = fViewer.testFindItems(update.getElement());
+ for (int i = 0; i < items.length; i++) {
+ if ( path.equals(getTreePath(items[i])) ) {
+ int itemCount = getItemChildCount(items[i]);
+ for (int j = 0; j < itemCount; j++) {
+ contentProvider.updateElement(path, j);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
public void updateStarted(IViewerUpdate update) {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- @Override
+ @Override
public void viewerUpdatesBegin() {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- @Override
+ @Override
public void viewerUpdatesComplete() {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
- }
+ }
- private TreePath getTreePath(Widget w) {
- if (w instanceof TreeItem) {
- TreeItem item = (TreeItem)w;
+ private TreePath getTreePath(Widget w) {
+ if (w instanceof TreeItem) {
+ TreeItem item = (TreeItem)w;
LinkedList<Object> segments = new LinkedList<>();
- while (item != null) {
- Object segment = item.getData();
- Assert.isNotNull(segment);
- segments.addFirst(segment);
- item = item.getParentItem();
- }
- return new TreePath(segments.toArray());
- }
- return TreePath.EMPTY;
- }
-
- private int getItemChildCount(Widget w) {
- if (w instanceof Tree) {
- return ((Tree)w).getItemCount();
- } else if (w instanceof TreeItem) {
- return ((TreeItem)w).getItemCount();
- }
- return 0;
- }
+ while (item != null) {
+ Object segment = item.getData();
+ Assert.isNotNull(segment);
+ segments.addFirst(segment);
+ item = item.getParentItem();
+ }
+ return new TreePath(segments.toArray());
+ }
+ return TreePath.EMPTY;
+ }
+
+ private int getItemChildCount(Widget w) {
+ if (w instanceof Tree) {
+ return ((Tree)w).getItemCount();
+ } else if (w instanceof TreeItem) {
+ return ((TreeItem)w).getItemCount();
+ }
+ return 0;
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreePathWrapper.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreePathWrapper.java
index b68c73280..306f020b8 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreePathWrapper.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TreePathWrapper.java
@@ -24,48 +24,48 @@ import org.junit.Assert;
* @since 3.7
*/
public class TreePathWrapper {
- private final TreePath fPath;
+ private final TreePath fPath;
- public TreePathWrapper(TreePath path) {
- fPath = path;
- }
+ public TreePathWrapper(TreePath path) {
+ fPath = path;
+ }
- @Override
+ @Override
public int hashCode() {
- return fPath.hashCode();
- }
+ return fPath.hashCode();
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof TreePathWrapper &&
- fPath.equals( ((TreePathWrapper)obj).fPath );
- }
+ return obj instanceof TreePathWrapper &&
+ fPath.equals( ((TreePathWrapper)obj).fPath );
+ }
- @Override
+ @Override
public String toString() {
- if (fPath.getSegmentCount() == 0) {
- return "TreePath:EMPTY"; //$NON-NLS-1$
- }
+ if (fPath.getSegmentCount() == 0) {
+ return "TreePath:EMPTY"; //$NON-NLS-1$
+ }
- StringBuilder buf = new StringBuilder("TreePath:["); //$NON-NLS-1$
+ StringBuilder buf = new StringBuilder("TreePath:["); //$NON-NLS-1$
- for (int i = 0; i < fPath.getSegmentCount(); i++) {
- if (i != 0) {
- buf.append(", "); //$NON-NLS-1$
- }
- buf.append(fPath.getSegment(i));
- }
- buf.append(']');
- return buf.toString();
- }
+ for (int i = 0; i < fPath.getSegmentCount(); i++) {
+ if (i != 0) {
+ buf.append(", "); //$NON-NLS-1$
+ }
+ buf.append(fPath.getSegment(i));
+ }
+ buf.append(']');
+ return buf.toString();
+ }
- /**
- * Asserts that the two given tree paths are the same. In case of failure, the
- * generated exception will contain a printout of the tree paths' contents.
- */
- public static void assertEqual(TreePath expected, TreePath actual) {
- Assert.assertEquals(
- expected != null ? new TreePathWrapper(expected) : null,
- actual != null ? new TreePathWrapper(actual) : null);
- }
+ /**
+ * Asserts that the two given tree paths are the same. In case of failure, the
+ * generated exception will contain a printout of the tree paths' contents.
+ */
+ public static void assertEqual(TreePath expected, TreePath actual) {
+ Assert.assertEquals(
+ expected != null ? new TreePathWrapper(expected) : null,
+ actual != null ? new TreePathWrapper(actual) : null);
+ }
} \ No newline at end of file
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/UpdateTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/UpdateTests.java
index b51907bc2..bba5dec82 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/UpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/UpdateTests.java
@@ -39,235 +39,235 @@ import org.junit.Assert;
*/
abstract public class UpdateTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public UpdateTests(String name) {
- super(name);
- }
+ public UpdateTests(String name) {
+ super(name);
+ }
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
}
- /**
- * This test:
- * - creates a simple model
- * - replaces the list of elements with a shorter list of elements
- * - refreshes the viewer
- */
+ /**
+ * This test:
+ * - creates a simple model
+ * - replaces the list of elements with a shorter list of elements
+ * - refreshes the viewer
+ */
public void testRemoveElements() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- TestElement root = model.getRootElement();
- TreePath rootPath = new TreePath(new Object[] {});
- TestElement[] newElements = new TestElement[] {
+ // Update the model
+ TestElement root = model.getRootElement();
+ TreePath rootPath = new TreePath(new Object[] {});
+ TestElement[] newElements = new TestElement[] {
new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "3", new TestElement[0]), //$NON-NLS-1$
- };
- model.setElementChildren(rootPath, newElements);
+ };
+ model.setElementChildren(rootPath, newElements);
- // Reset the listener to NOT fail on redundant updates.
- // When elements are remvoed from the model and the model is
- // refreshed the viewer will issue an IChildrenUpdate for the
- // missing elements as an optimization.
- fListener.reset(rootPath, root, -1, false, false);
+ // Reset the listener to NOT fail on redundant updates.
+ // When elements are remvoed from the model and the model is
+ // refreshed the viewer will issue an IChildrenUpdate for the
+ // missing elements as an optimization.
+ fListener.reset(rootPath, root, -1, false, false);
- model.postDelta(new ModelDelta(root, IModelDelta.CONTENT));
+ model.postDelta(new ModelDelta(root, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- /**
- * This test:
- * - creates a simple model
- * - sets a list of children to one of the elements
- * - refreshes the viewer
- */
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
+
+ /**
+ * This test:
+ * - creates a simple model
+ * - sets a list of children to one of the elements
+ * - refreshes the viewer
+ */
public void testAddNewChildren() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
- TestElement[] newChildren = new TestElement[] {
+ // Update the model
+ TestElement element = model.getRootElement().getChildren()[0];
+ TreePath elementPath = new TreePath(new Object[] { element });
+ TestElement[] newChildren = new TestElement[] {
new TestElement(model, "1.1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "1.2", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "1.3", new TestElement[0]), //$NON-NLS-1$
- };
- model.setElementChildren(elementPath, newChildren);
-
- // Reset the viewer to ignore redundant updates. The '1' element
- // will be updated for "hasChildren" before it is expanded, which is
- // expected.
- TreePath rootPath = TreePath.EMPTY;
- TestElement rootElement = model.getRootElement();
- fListener.reset(rootPath, rootElement, -1, false, false);
-
- // Refresh the viewer
- model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
+ };
+ model.setElementChildren(elementPath, newChildren);
+
+ // Reset the viewer to ignore redundant updates. The '1' element
+ // will be updated for "hasChildren" before it is expanded, which is
+ // expected.
+ TreePath rootPath = TreePath.EMPTY;
+ TestElement rootElement = model.getRootElement();
+ fListener.reset(rootPath, rootElement, -1, false, false);
+
+ // Refresh the viewer
+ model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
private void removeElement(TestModel model, int index, boolean validate) throws Exception {
- ModelDelta delta = model.removeElementChild(TreePath.EMPTY, index);
+ ModelDelta delta = model.removeElementChild(TreePath.EMPTY, index);
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
+ // Remove delta should generate no new updates, but we still need to wait for the event to
+ // be processed.
+ fListener.reset();
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- if (validate) {
- model.validateData(fViewer, TreePath.EMPTY);
- }
- }
+ if (validate) {
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
+ }
private void addElement(TestModel model, String label, int position, boolean validate) throws Exception {
- ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, position, new TestElement(model, label, new TestElement[0]));
+ ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, position, new TestElement(model, label, new TestElement[0]));
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
+ // Remove delta should generate no new updates, but we still need to wait for the event to
+ // be processed.
+ fListener.reset();
+ model.postDelta(delta);
- if (validate) {
+ if (validate) {
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- } else {
+ model.validateData(fViewer, TreePath.EMPTY);
+ } else {
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- }
- }
+ }
+ }
private void insertElement(TestModel model, String label, int position, boolean validate) throws Exception {
- ModelDelta delta = model.insertElementChild(TreePath.EMPTY, position, new TestElement(model, label, new TestElement[0]));
+ ModelDelta delta = model.insertElementChild(TreePath.EMPTY, position, new TestElement(model, label, new TestElement[0]));
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
+ // Remove delta should generate no new updates, but we still need to wait for the event to
+ // be processed.
+ fListener.reset();
+ model.postDelta(delta);
- if (validate) {
+ if (validate) {
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- } else {
+ model.validateData(fViewer, TreePath.EMPTY);
+ } else {
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- }
- }
+ }
+ }
public void testRepeatedAddRemoveElement() throws Exception {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Update the model
- removeElement(model, 2, true);
+ // Update the model
+ removeElement(model, 2, true);
addElement(model, "3-new", 3, true); //$NON-NLS-1$
- removeElement(model, 4, true);
+ removeElement(model, 4, true);
addElement(model, "5-new", 5, true); //$NON-NLS-1$
- removeElement(model, 1, true);
+ removeElement(model, 1, true);
addElement(model, "1-new", 1, true); //$NON-NLS-1$
- removeElement(model, 3, true);
+ removeElement(model, 3, true);
addElement(model, "4-new", 4, true); //$NON-NLS-1$
- }
+ }
- /**
- * This test verifies that when the viewer processes a delta that causes viewer
- * updates it initiates the model update sequence before it finishes processing
- * the delta.
- */
+ /**
+ * This test verifies that when the viewer processes a delta that causes viewer
+ * updates it initiates the model update sequence before it finishes processing
+ * the delta.
+ */
public void testNotifyUpdatesTartedOnModelChanged() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- Assert.assertTrue( fListener.isFinished(CONTENT_SEQUENCE_STARTED) );
- }
+ Assert.assertTrue( fListener.isFinished(CONTENT_SEQUENCE_STARTED) );
+ }
- /**
- * This test case attempts to create a race condition between processing
- * of the content updates and processing of add/remove model deltas.
- * <br>
- * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
- */
+ /**
+ * This test case attempts to create a race condition between processing
+ * of the content updates and processing of add/remove model deltas.
+ * <br>
+ * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
+ */
public void testContentPlusAddRemoveUpdateRaceConditionsElement() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Create a listener to listen only to a children count update for the root.
- TestModelUpdatesListener childrenCountUpdateListener = new TestModelUpdatesListener(fViewer, false, false);
+ // Create a listener to listen only to a children count update for the root.
+ TestModelUpdatesListener childrenCountUpdateListener = new TestModelUpdatesListener(fViewer, false, false);
- for (int i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
String pass = "pass #" + i; //$NON-NLS-1$
- // Request a content update for view
- childrenCountUpdateListener.reset();
- childrenCountUpdateListener.addChildreCountUpdate(TreePath.EMPTY);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait until the delta is processed
+ // Request a content update for view
+ childrenCountUpdateListener.reset();
+ childrenCountUpdateListener.addChildreCountUpdate(TreePath.EMPTY);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Wait until the delta is processed
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- removeElement(model, 5, false);
- removeElement(model, 4, false);
- removeElement(model, 3, false);
- removeElement(model, 2, false);
- removeElement(model, 1, false);
- removeElement(model, 0, false);
+ removeElement(model, 5, false);
+ removeElement(model, 4, false);
+ removeElement(model, 3, false);
+ removeElement(model, 2, false);
+ removeElement(model, 1, false);
+ removeElement(model, 0, false);
- // Wait until the children count update is completed using the count from
- // before elements were removed.
+ // Wait until the children count update is completed using the count from
+ // before elements were removed.
waitWhile(t -> !childrenCountUpdateListener.isFinished(CHILD_COUNT_UPDATES), createListenerErrorMessage());
insertElement(model, "1 - " + pass, 0, false); //$NON-NLS-1$
@@ -278,37 +278,37 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
insertElement(model, "6 - " + pass, 5, false); //$NON-NLS-1$
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- }
+ }
- childrenCountUpdateListener.dispose();
- }
+ childrenCountUpdateListener.dispose();
+ }
- /**
- * This test case attempts to create a race condition between processing
- * of the content updates and processing of add/remove model deltas.
- * <br>
- * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
- */
+ /**
+ * This test case attempts to create a race condition between processing
+ * of the content updates and processing of add/remove model deltas.
+ * <br>
+ * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
+ */
public void testInsertAtInvalidIndex() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Insert element at the end of the list.
- final int insertIndex = model.getRootElement().getChildren().length;
+ // Insert element at the end of the list.
+ final int insertIndex = model.getRootElement().getChildren().length;
ModelDelta delta = model.insertElementChild(TreePath.EMPTY, insertIndex, new TestElement(model, "last - invalid index", new TestElement[0])); //$NON-NLS-1$
- // Change insert index to out of range
- delta.accept(new IModelDeltaVisitor() {
+ // Change insert index to out of range
+ delta.accept(new IModelDeltaVisitor() {
@Override
public boolean visit(IModelDelta visitorDelta, int depth) {
@@ -320,341 +320,341 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
}
});
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
+ // Remove delta should generate no new updates, but we still need to wait for the event to
+ // be processed.
+ fListener.reset();
+ model.postDelta(delta);
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- /**
- * This test forces the viewer to reschedule pending content updates
- * due to a remove event from the model.
- * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#rescheduleUpdates
- */
+ model.validateData(fViewer, TreePath.EMPTY);
+ }
+
+ /**
+ * This test forces the viewer to reschedule pending content updates
+ * due to a remove event from the model.
+ * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#rescheduleUpdates
+ */
public void testRescheduleUpdates() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- for (int i = 0; i < 5; i++) {
- // Refresh the viewer so that updates are generated.
- TestElement rootElement = model.getRootElement();
- fListener.reset();
- fListener.addUpdates(TreePath.EMPTY, model.getRootElement(), 1, CHILD_COUNT_UPDATES);
- model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
+ for (int i = 0; i < 5; i++) {
+ // Refresh the viewer so that updates are generated.
+ TestElement rootElement = model.getRootElement();
+ fListener.reset();
+ fListener.addUpdates(TreePath.EMPTY, model.getRootElement(), 1, CHILD_COUNT_UPDATES);
+ model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES | CHILDREN_UPDATES_STARTED), createListenerErrorMessage());
- // Update the model
- removeElement(model, 0, true);
+ // Update the model
+ removeElement(model, 0, true);
addElement(model, "1", 0, true); //$NON-NLS-1$
- }
- }
-
- /**
- * This test forces the viewer to cancel updates then process them at once.
- * <p>
- * - Wait until CHILDREN COUNT update started then refresh<br>
- * - Process queued updates in order.<br>
- * </p>
- */
+ }
+ }
+
+ /**
+ * This test forces the viewer to cancel updates then process them at once.
+ * <p>
+ * - Wait until CHILDREN COUNT update started then refresh<br>
+ * - Process queued updates in order.<br>
+ * </p>
+ */
public void testCanceledUpdates1() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- model.setQeueueingUpdate(true);
+ model.setQeueueingUpdate(true);
- for (int i = 0; i < 5; i++) {
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ for (int i = 0; i < 5; i++) {
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES_STARTED), createListenerErrorMessage());
- }
+ }
- model.setQeueueingUpdate(false);
+ model.setQeueueingUpdate(false);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- }
+ }
- /**
- * This test forces the viewer to cancel updates then process them at once.
- * <p>
- * - Wait until CHILDREN COUNT update started then refresh<br>
- * - Process queued updates in REVERSE order.<br>
- * </p>
- */
+ /**
+ * This test forces the viewer to cancel updates then process them at once.
+ * <p>
+ * - Wait until CHILDREN COUNT update started then refresh<br>
+ * - Process queued updates in REVERSE order.<br>
+ * </p>
+ */
public void testCanceledUpdates2() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- model.setQeueueingUpdate(true);
+ model.setQeueueingUpdate(true);
- for (int i = 0; i < 5; i++) {
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ for (int i = 0; i < 5; i++) {
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES_STARTED), createListenerErrorMessage());
- }
+ }
ArrayList<IViewerUpdate> updates = new ArrayList<>(model.getQueuedUpdates());
- model.getQueuedUpdates().clear();
- for (int i = updates.size() - 1; i >= 0; i--) {
- model.processUpdate(updates.get(i));
- }
+ model.getQueuedUpdates().clear();
+ for (int i = updates.size() - 1; i >= 0; i--) {
+ model.processUpdate(updates.get(i));
+ }
- model.setQeueueingUpdate(false);
+ model.setQeueueingUpdate(false);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- }
-
- /**
- * This test forces the viewer to cancel updates then process them at once.
- * <p>
- * - Wait until CHILDREN update started then refresh<br>
- * - Process queued updates in order.<br>
- * </p>
- */
+ }
+
+ /**
+ * This test forces the viewer to cancel updates then process them at once.
+ * <p>
+ * - Wait until CHILDREN update started then refresh<br>
+ * - Process queued updates in order.<br>
+ * </p>
+ */
public void testCanceledUpdates3() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- model.setQeueueingUpdate(true);
+ model.setQeueueingUpdate(true);
- for (int i = 0; i < 5; i++) {
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ for (int i = 0; i < 5; i++) {
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
long start = System.currentTimeMillis();
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES_STARTED)
&& System.currentTimeMillis() - start < testTimeout) {
- completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
- completeQueuedUpdatesOfType(model, IHasChildrenUpdate.class);
+ completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
+ completeQueuedUpdatesOfType(model, IHasChildrenUpdate.class);
TestUtil.processUIEvents();
- }
- }
+ }
+ }
- model.setQeueueingUpdate(false);
+ model.setQeueueingUpdate(false);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- }
+ }
- /**
- * This test forces the viewer to cancel updates then process them at once.
- * <p>
- * - Wait until CHILDREN update started then refresh<br>
- * - Process queued updates in REVERSE order.<br>
- * </p>
- */
+ /**
+ * This test forces the viewer to cancel updates then process them at once.
+ * <p>
+ * - Wait until CHILDREN update started then refresh<br>
+ * - Process queued updates in REVERSE order.<br>
+ * </p>
+ */
public void testCanceledUpdates4() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- model.setQeueueingUpdate(true);
+ model.setQeueueingUpdate(true);
- for (int i = 0; i < 5; i++) {
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ for (int i = 0; i < 5; i++) {
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- long start = System.currentTimeMillis();
- // Wait for the delta to be processed.
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES_STARTED)
- && System.currentTimeMillis() - start < testTimeout) {
- completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
- completeQueuedUpdatesOfType(model, IHasChildrenUpdate.class);
- TestUtil.processUIEvents();
- }
+ long start = System.currentTimeMillis();
+ // Wait for the delta to be processed.
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES_STARTED)
+ && System.currentTimeMillis() - start < testTimeout) {
+ completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
+ completeQueuedUpdatesOfType(model, IHasChildrenUpdate.class);
+ TestUtil.processUIEvents();
+ }
- }
+ }
ArrayList<IViewerUpdate> updates = new ArrayList<>(model.getQueuedUpdates());
- model.getQueuedUpdates().clear();
- for (int i = updates.size() - 1; i >= 0; i--) {
- model.processUpdate(updates.get(i));
- }
+ model.getQueuedUpdates().clear();
+ for (int i = updates.size() - 1; i >= 0; i--) {
+ model.processUpdate(updates.get(i));
+ }
- model.setQeueueingUpdate(false);
+ model.setQeueueingUpdate(false);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- }
-
- /**
- * This test removes an element while there are updates running on its
- * sub-tree. With a precise timing this operation caused Bug 373790.
- * <p>
- * See Bug 373790 - Debug view stays busy after Resume
- * </p>
- * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#rescheduleUpdates
- */
+ }
+
+ /**
+ * This test removes an element while there are updates running on its
+ * sub-tree. With a precise timing this operation caused Bug 373790.
+ * <p>
+ * See Bug 373790 - Debug view stays busy after Resume
+ * </p>
+ * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#rescheduleUpdates
+ */
public void testCancelUpdatesOnRemoveElementWhileUpdatingSubTree() throws Exception {
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleMultiLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- // Refresh the viewer so that updates are generated.
- fListener.reset();
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
TreePath path = model.findElement("2"); //$NON-NLS-1$
- fListener.addUpdates(path, model.getElement(path), 1, CHILD_COUNT_UPDATES);
- fListener.addChildreUpdate(path, 0);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ fListener.addUpdates(path, model.getElement(path), 1, CHILD_COUNT_UPDATES);
+ fListener.addChildreUpdate(path, 0);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait for the delta to be processed and child updates for "2" to get started.
+ // Wait for the delta to be processed and child updates for "2" to get started.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES | CHILDREN_UPDATES_RUNNING), createListenerErrorMessage());
- // Remove element "2"
- removeElement(model, 1, true);
+ // Remove element "2"
+ removeElement(model, 1, true);
- // Wait for all updates to finish.
- waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
- }
+ // Wait for all updates to finish.
+ waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
+ }
- /**
- * This test forces the viewer to cancel updates upon setInput().
- * <p>
- * - Wait until CHILDREN update started then refresh<br>
- * - Process queued updates in order.<br>
- * </p>
- */
+ /**
+ * This test forces the viewer to cancel updates upon setInput().
+ * <p>
+ * - Wait until CHILDREN update started then refresh<br>
+ * - Process queued updates in order.<br>
+ * </p>
+ */
public void testCanceledUpdatesOnSetInput() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- model.setQeueueingUpdate(false);
+ model.setQeueueingUpdate(false);
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- fListener.addChildreCountUpdate(TreePath.EMPTY);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ fListener.addChildreCountUpdate(TreePath.EMPTY);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES), createListenerErrorMessage());
- TestModel model2 = new TestModel();
+ TestModel model2 = new TestModel();
model2.setRoot(new TestElement(model2, "root", new TestElement[0])); //$NON-NLS-1$
- fViewer.setInput(model2.getRootElement());
+ fViewer.setInput(model2.getRootElement());
waitWhile(t -> !fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING), createListenerErrorMessage());
- }
+ }
- /**
- * This test forces the viewer to cancel updates upon setInput().
- * <p>
- * - Wait until CHILDREN update started then refresh<br>
- * - Process queued updates in order.<br>
- * </p>
- */
+ /**
+ * This test forces the viewer to cancel updates upon setInput().
+ * <p>
+ * - Wait until CHILDREN update started then refresh<br>
+ * - Process queued updates in order.<br>
+ * </p>
+ */
public void testCanceledUpdatesOnSetNullInput() throws Exception {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
+ TestModel model = TestModel.simpleSingleLevel();
+ fViewer.setAutoExpandLevel(-1);
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
- model.setQeueueingUpdate(false);
+ model.setQeueueingUpdate(false);
- // Refresh the viewer so that updates are generated.
- fListener.reset();
- fListener.addChildreCountUpdate(TreePath.EMPTY);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
+ // Refresh the viewer so that updates are generated.
+ fListener.reset();
+ fListener.addChildreCountUpdate(TreePath.EMPTY);
+ model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- // Wait for the delta to be processed.
+ // Wait for the delta to be processed.
waitWhile(t -> !fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES), createListenerErrorMessage());
- fViewer.setInput(null);
+ fViewer.setInput(null);
waitWhile(t -> !fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING), createListenerErrorMessage());
- }
+ }
private void completeQueuedUpdatesOfType(TestModel model, Class<?> updateClass) {
List<IViewerUpdate> updatesToComplete = new LinkedList<>();
for (Iterator<IViewerUpdate> itr = model.getQueuedUpdates().iterator(); itr.hasNext();) {
- IViewerUpdate update = itr.next();
- if (updateClass.isInstance(update)) {
- updatesToComplete.add(update);
- itr.remove();
- }
- }
- if (updatesToComplete != null) {
+ IViewerUpdate update = itr.next();
+ if (updateClass.isInstance(update)) {
+ updatesToComplete.add(update);
+ itr.remove();
+ }
+ }
+ if (updatesToComplete != null) {
for (Iterator<IViewerUpdate> itr = updatesToComplete.iterator(); itr.hasNext();) {
- model.processUpdate(itr.next());
- }
- }
- }
+ model.processUpdate(itr.next());
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerContentTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerContentTests.java
index 6ac55ba4a..af1434896 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerContentTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerContentTests.java
@@ -25,12 +25,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerContentTests extends ContentTests {
- public VirtualViewerContentTests(String name) {
- super(name);
- }
+ public VirtualViewerContentTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerDeltaTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerDeltaTests.java
index c53058364..2c68368f0 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerDeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerDeltaTests.java
@@ -25,12 +25,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerDeltaTests extends DeltaTests {
- public VirtualViewerDeltaTests(String name) {
- super(name);
- }
+ public VirtualViewerDeltaTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerFilterTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerFilterTests.java
index cc0f46095..f0aff25a4 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerFilterTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerFilterTests.java
@@ -26,12 +26,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerFilterTests extends FilterTests {
- public VirtualViewerFilterTests(String name) {
- super(name);
- }
+ public VirtualViewerFilterTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), new VisibleVirtualItemValidator(0, 100)); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerLazyModeTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
index 18653ec09..8c95b7fba 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
@@ -30,9 +30,9 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerLazyModeTests extends AbstractViewerModelTest {
- public VirtualViewerLazyModeTests(String name) {
- super(name);
- }
+ public VirtualViewerLazyModeTests(String name) {
+ super(name);
+ }
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
@@ -42,9 +42,9 @@ public class VirtualViewerLazyModeTests extends AbstractViewerModelTest {
@Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(display, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
- public void test() {
- // TODO
- }
+ public void test() {
+ // TODO
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
index c70ec1706..6143a3184 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
@@ -26,17 +26,17 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerPerformanceTests extends PerformanceTests {
- public VirtualViewerPerformanceTests(String name) {
- super(name);
- }
+ public VirtualViewerPerformanceTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), fVirtualItemValidator); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
protected int getTestModelDepth() {
- return 7;
- }
+ return 7;
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPopupTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPopupTests.java
index 055cd88bd..fd07796f4 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPopupTests.java
@@ -25,14 +25,14 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerPopupTests extends PopupTests {
- public VirtualViewerPopupTests(String name) {
- super(name);
- }
+ public VirtualViewerPopupTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell, int style) {
return new VirtualTreeModelViewer(fDisplay, style, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerSelectionTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerSelectionTests.java
index f4edf0b01..68100fab3 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerSelectionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerSelectionTests.java
@@ -25,12 +25,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerSelectionTests extends SelectionTests {
- public VirtualViewerSelectionTests(String name) {
- super(name);
- }
+ public VirtualViewerSelectionTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerStateTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerStateTests.java
index ff0e3e29a..1c39f0bb1 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerStateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerStateTests.java
@@ -25,12 +25,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerStateTests extends StateTests {
- public VirtualViewerStateTests(String name) {
- super(name);
- }
+ public VirtualViewerStateTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerUpdateTests.java
index 6e202e342..42a69e80c 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerUpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerUpdateTests.java
@@ -25,12 +25,12 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerUpdateTests extends UpdateTests {
- public VirtualViewerUpdateTests(String name) {
- super(name);
- }
+ public VirtualViewerUpdateTests(String name) {
+ super(name);
+ }
- @Override
+ @Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VisibleVirtualItemValidator.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VisibleVirtualItemValidator.java
index b59c02edb..02ebae98a 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VisibleVirtualItemValidator.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VisibleVirtualItemValidator.java
@@ -23,78 +23,78 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTree;
*/
public class VisibleVirtualItemValidator implements IVirtualItemValidator {
- private int fStart = 0;
- private int fEnd = 0;
+ private int fStart = 0;
+ private int fEnd = 0;
- public VisibleVirtualItemValidator(int startPosition, int length) {
- setVisibleRange(startPosition, length);
- }
+ public VisibleVirtualItemValidator(int startPosition, int length) {
+ setVisibleRange(startPosition, length);
+ }
- public void setVisibleRange(int startPosition, int length) {
- fStart = startPosition;
- fEnd = startPosition + length;
- }
+ public void setVisibleRange(int startPosition, int length) {
+ fStart = startPosition;
+ fEnd = startPosition + length;
+ }
- public int getStartPosition() {
- return fStart;
- }
+ public int getStartPosition() {
+ return fStart;
+ }
- public int getLength() {
- return fEnd - fStart;
- }
+ public int getLength() {
+ return fEnd - fStart;
+ }
- @Override
+ @Override
public boolean isItemVisible(VirtualItem item) {
- int position = 0;
- while (item.getParent() != null) {
- position += item.getIndex().intValue();
- item = item.getParent();
- }
- return position >= fStart && position < fEnd || isSelected(item);
- }
+ int position = 0;
+ while (item.getParent() != null) {
+ position += item.getIndex().intValue();
+ item = item.getParent();
+ }
+ return position >= fStart && position < fEnd || isSelected(item);
+ }
- @Override
+ @Override
public void showItem(VirtualItem item) {
- int length = fEnd - fStart;
- fStart = calcPosition(item);
- fEnd = fStart + length;
- }
+ int length = fEnd - fStart;
+ fStart = calcPosition(item);
+ fEnd = fStart + length;
+ }
- private int calcPosition(VirtualItem item) {
- int position = 0;
- while (item.getParent() != null) {
- position += item.getIndex().intValue();
- item = item.getParent();
- }
- return position;
- }
+ private int calcPosition(VirtualItem item) {
+ int position = 0;
+ while (item.getParent() != null) {
+ position += item.getIndex().intValue();
+ item = item.getParent();
+ }
+ return position;
+ }
- private boolean isSelected(VirtualItem item) {
- VirtualItem[] selection = getSelection(item);
- for (int i = 0; i < selection.length; i++) {
- VirtualItem selectionItem = selection[i];
- while (selectionItem != null) {
- if (item.equals(selectionItem)) {
- return true;
- }
- selectionItem = selectionItem.getParent();
- }
- }
- return false;
- }
+ private boolean isSelected(VirtualItem item) {
+ VirtualItem[] selection = getSelection(item);
+ for (int i = 0; i < selection.length; i++) {
+ VirtualItem selectionItem = selection[i];
+ while (selectionItem != null) {
+ if (item.equals(selectionItem)) {
+ return true;
+ }
+ selectionItem = selectionItem.getParent();
+ }
+ }
+ return false;
+ }
- private VirtualItem[] getSelection(VirtualItem item) {
- VirtualTree tree = getTree(item);
- if (tree != null) {
- return tree.getSelection();
- }
- return new VirtualItem[0];
- }
+ private VirtualItem[] getSelection(VirtualItem item) {
+ VirtualTree tree = getTree(item);
+ if (tree != null) {
+ return tree.getSelection();
+ }
+ return new VirtualItem[0];
+ }
- private VirtualTree getTree(VirtualItem item) {
- while (item != null && !(item instanceof VirtualTree)) {
- item = item.getParent();
- }
- return (VirtualTree)item;
- }
+ private VirtualTree getTree(VirtualItem item) {
+ while (item != null && !(item instanceof VirtualTree)) {
+ item = item.getParent();
+ }
+ return (VirtualTree)item;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugListSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugListSelectionDialog.java
index fd2fdc4e4..7f234f4e6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugListSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugListSelectionDialog.java
@@ -84,13 +84,13 @@ public abstract class AbstractDebugListSelectionDialog extends AbstractDebugSele
return false;
}
- @Override
+ @Override
protected void okPressed() {
ISelection selection = fViewer.getSelection();
if (selection instanceof IStructuredSelection) {
setResult(((IStructuredSelection) selection).toList());
}
super.okPressed();
- }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugSelectionDialog.java
index 9cc311402..14af78526 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugSelectionDialog.java
@@ -152,8 +152,8 @@ public abstract class AbstractDebugSelectionDialog extends SelectionDialog {
* @return viewer used in this dialog
*/
protected Viewer getViewer(){
- return fViewer;
- }
+ return fViewer;
+ }
@Override
protected Control createContents(Composite parent) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CompositeDebugImageDescriptor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CompositeDebugImageDescriptor.java
index d6c619bff..7d0e3b95d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CompositeDebugImageDescriptor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CompositeDebugImageDescriptor.java
@@ -106,9 +106,9 @@ public class CompositeDebugImageDescriptor extends CompositeImageDescriptor {
return fBaseImage;
}
- protected void setBaseImage(Image image) {
- fBaseImage = image;
- }
+ protected void setBaseImage(Image image) {
+ fBaseImage = image;
+ }
protected int getFlags() {
return fFlags;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
index f7281fee6..f8961d034 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java
@@ -66,15 +66,15 @@ public class DebugModelPropertyTester extends PropertyTester {
Platform.getAdapterManager().
getAdapter(receiver, IDebugModelProvider.class);
}
- if (modelProvider != null) {
- String[] ids = modelProvider.getModelIdentifiers();
- for (int i = 0; i < ids.length; i++) {
- if (ids[i].equals(expectedValue)) {
- return true;
- }
- }
- return false;
- }
+ if (modelProvider != null) {
+ String[] ids = modelProvider.getModelIdentifiers();
+ for (int i = 0; i < ids.length; i++) {
+ if (ids[i].equals(expectedValue)) {
+ return true;
+ }
+ }
+ return false;
+ }
// There is no element selected with an associated debug model.
// Return true iff the expected value is an empty string.
return "".equals(expectedValue); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
index 3d06ce444..15048895a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
@@ -51,7 +51,7 @@ public class DebugPluginImages {
// Use IPath and toOSString to build the names to ensure they have the slashes correct
private final static String CTOOL= ICONS_PATH + "etool16/"; //basic colors - size 16x16 //$NON-NLS-1$
- private final static String DTOOL= ICONS_PATH + "dtool16/"; //basic colors - size 16x16 //$NON-NLS-1$
+ private final static String DTOOL= ICONS_PATH + "dtool16/"; //basic colors - size 16x16 //$NON-NLS-1$
private final static String DLCL= ICONS_PATH + "dlcl16/"; //disabled - size 16x16 //$NON-NLS-1$
private final static String ELCL= ICONS_PATH + "elcl16/"; //enabled - size 16x16 //$NON-NLS-1$
private final static String OBJECT= ICONS_PATH + "obj16/"; //basic colors - size 16x16 //$NON-NLS-1$
@@ -66,7 +66,7 @@ public class DebugPluginImages {
// Actions
declareRegistryImage(IDebugUIConstants.IMG_ACT_DEBUG, CTOOL + "debug_exc.png"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_ACT_RUN, CTOOL + "run_exc.png"); //$NON-NLS-1$
- declareRegistryImage(IDebugUIConstants.IMG_ACT_SYNCED, ELCL + "synced.png"); //$NON-NLS-1$
+ declareRegistryImage(IDebugUIConstants.IMG_ACT_SYNCED, ELCL + "synced.png"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_SKIP_BREAKPOINTS, ELCL + "skip_brkp.png"); //$NON-NLS-1$
//menus
@@ -87,12 +87,12 @@ public class DebugPluginImages {
declareRegistryImage(IDebugUIConstants.IMG_LCL_TYPE_NAMES, ELCL + "tnames_co.png"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_LCL_DISCONNECT, ELCL + "disconnect_co.png"); //$NON-NLS-1$
declareRegistryImage(IDebugUIConstants.IMG_LCL_REMOVE_ALL, ELCL + "rem_all_co.png"); //$NON-NLS-1$
- declareRegistryImage(IDebugUIConstants.IMG_LCL_REMOVE, ELCL + "rem_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_REMOVE, ELCL + "rem_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_SHOW_LOGICAL_STRUCTURE, ELCL + "var_cntnt_prvdr.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_COLLAPSE_ALL, ELCL + "collapseall.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_TERMINATE, ELCL + "terminate_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_RUN_TO_LINE, ELCL + "runtoline_co.png"); //$NON-NLS-1$
- declareRegistryImage(IDebugUIConstants.IMG_LCL_ADD, ELCL + "monitorexpression_tsk.png"); //$NON-NLS-1$
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_ADD, ELCL + "monitorexpression_tsk.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_REMOVE_MEMORY, ELCL + "removememory_tsk.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_RESET_MEMORY, ELCL + "memoryreset_tsk.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_COPY_VIEW_TO_CLIPBOARD, ELCL + "copyviewtoclipboard_tsk.png"); //$NON-NLS-1$
@@ -110,7 +110,7 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_COLLAPSE_ALL, DLCL + "collapseall.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE, DLCL + "terminate_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_REMOVE_ALL, DLCL + "rem_all_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_REMOVE, DLCL + "rem_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_REMOVE, DLCL + "rem_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RUN_TO_LINE, DLCL + "runtoline_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_MONITOR_EXPRESSION, DLCL + "monitorexpression_tsk.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_REMOVE_MEMORY, DLCL + "removememory_tsk.png"); //$NON-NLS-1$
@@ -125,20 +125,20 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_LINK_PROTO, DLCL + "link_proto.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_UNLINK_PROTO, DLCL + "unlink_proto.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESET_PROTO, DLCL + "reset_proto.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT, DLCL + "disconnect_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_SUSPEND, DLCL + "suspend_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESUME, DLCL + "resume_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEP_RETURN, DLCL+ "stepreturn_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEP_OVER, DLCL + "stepover_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEP_INTO, DLCL + "stepinto_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_REMOVE, DLCL + "terminate_rem_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_ALL, DLCL + "terminate_all_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_RELAUNCH, DTOOL + "term_restart.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TOGGLE_STEP_FILTERS, DLCL+"stepbystep_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_NEXT_THREAD, DLCL+"next_thread_nav.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_PREVIOUS_THREAD, DLCL+"prev_thread_nav.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESTART, DLCL+"restart_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_EXPORT_CONFIG, DLCL + "export_config.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT, DLCL + "disconnect_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_SUSPEND, DLCL + "suspend_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESUME, DLCL + "resume_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEP_RETURN, DLCL+ "stepreturn_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEP_OVER, DLCL + "stepover_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEP_INTO, DLCL + "stepinto_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_REMOVE, DLCL + "terminate_rem_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_ALL, DLCL + "terminate_all_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_RELAUNCH, DTOOL + "term_restart.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TOGGLE_STEP_FILTERS, DLCL+"stepbystep_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_NEXT_THREAD, DLCL+"next_thread_nav.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_PREVIOUS_THREAD, DLCL+"prev_thread_nav.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESTART, DLCL+"restart_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_EXPORT_CONFIG, DLCL + "export_config.png"); //$NON-NLS-1$
// enabled local toolbars
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DETAIL_PANE, ELCL + "toggledetailpane_co.png"); //$NON-NLS-1$
@@ -158,7 +158,7 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_COPY_VIEW_TO_CLIPBOARD, ELCL + "copyviewtoclipboard_tsk.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_PRINT_TOP_VIEW_TAB, ELCL + "printview_tsk.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL, ELCL + "rem_all_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_REMOVE, ELCL + "rem_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_REMOVE, ELCL + "rem_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_HIERARCHICAL, ELCL + "hierarchicalLayout.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS, ELCL + "filter_ps.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG, ELCL + "copy_edit_co.png"); //$NON-NLS-1$
@@ -168,21 +168,21 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_LINK_PROTO, ELCL + "link_proto.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_UNLINK_PROTO, ELCL + "unlink_proto.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESET_PROTO, ELCL + "reset_proto.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_SUSPEND, ELCL + "suspend_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESUME, ELCL + "resume_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN, ELCL + "stepreturn_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER, ELCL + "stepover_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO, ELCL + "stepinto_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME, ELCL + "drop_to_frame.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE, ELCL + "terminate_rem_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_ALL, ELCL + "terminate_all_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH, CTOOL + "term_restart.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TOGGLE_STEP_FILTERS, ELCL+"stepbystep_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STANDARD_OUT, ELCL+"writeout_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STANDARD_ERR, ELCL+"writeerr_co.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_NEXT_THREAD, ELCL+"next_thread_nav.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_PREVIOUS_THREAD, ELCL+"prev_thread_nav.png"); //$NON-NLS-1$
- declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESTART, ELCL+"restart_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_SUSPEND, ELCL + "suspend_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESUME, ELCL + "resume_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN, ELCL + "stepreturn_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER, ELCL + "stepover_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO, ELCL + "stepinto_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME, ELCL + "drop_to_frame.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE, ELCL + "terminate_rem_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_ALL, ELCL + "terminate_all_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH, CTOOL + "term_restart.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TOGGLE_STEP_FILTERS, ELCL+"stepbystep_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STANDARD_OUT, ELCL+"writeout_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STANDARD_ERR, ELCL+"writeerr_co.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_NEXT_THREAD, ELCL+"next_thread_nav.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_PREVIOUS_THREAD, ELCL+"prev_thread_nav.png"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESTART, ELCL+"restart_co.png"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_EXPORT_CONFIG, ELCL + "export_config.png"); //$NON-NLS-1$
//Object
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java
index 2119bbb3c..ad3c95fa5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java
@@ -39,21 +39,21 @@ public class DebugUIAdapterFactory implements IAdapterFactory {
if (adapterType == IPersistableElement.class) {
if (obj instanceof IBreakpoint) {
- return (T) new BreakpointPersistableElementAdapter((IBreakpoint)obj);
- }
+ return (T) new BreakpointPersistableElementAdapter((IBreakpoint)obj);
+ }
}
- if (adapterType == IWorkbenchAdapter.class) {
- if (obj instanceof IBreakpointContainer) {
- return (T) new BreakpointContainerWorkbenchAdapter();
- }
- }
+ if (adapterType == IWorkbenchAdapter.class) {
+ if (obj instanceof IBreakpointContainer) {
+ return (T) new BreakpointContainerWorkbenchAdapter();
+ }
+ }
- if (adapterType == IWorkbenchAdapter2.class) {
- if (obj instanceof IBreakpointContainer) {
- return (T) new BreakpointContainerWorkbenchAdapter();
- }
- }
+ if (adapterType == IWorkbenchAdapter2.class) {
+ if (obj instanceof IBreakpointContainer) {
+ return (T) new BreakpointContainerWorkbenchAdapter();
+ }
+ }
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
index 85d727654..e75f65f61 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
@@ -21,7 +21,7 @@ import org.eclipse.osgi.util.NLS;
public class DebugUIMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.DebugUIMessages";//$NON-NLS-1$
- public static String AbstractAsyncTableRendering_2;
+ public static String AbstractAsyncTableRendering_2;
public static String AbstractDebugCheckboxSelectionDialog_0;
@@ -51,7 +51,7 @@ public class DebugUIMessages extends NLS {
public static String SwitchMemoryBlockAction_4;
- public static String WorkingDirectoryStatusHandler_0;
+ public static String WorkingDirectoryStatusHandler_0;
public static String WorkingDirectoryStatusHandler_Eclipse_Runtime_1;
public static String DebugUITools_3;
@@ -299,7 +299,7 @@ public class DebugUIMessages extends NLS {
//
// Elements
//
- public static String ExpressionManagerContentProvider_1;
+ public static String ExpressionManagerContentProvider_1;
static {
// load message values from bundle file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 6049c5fa0..cf4f3b231 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -205,18 +205,18 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
*/
private LaunchingResourceManager fContextLaunchingManager = null;
- /**
- * Image descriptor registry used for images with common overlays.
- *
- * @since 3.1
- */
- private ImageDescriptorRegistry fImageDescriptorRegistry;
-
- /**
- * A set of <code>ISaveParticipant</code>s that want to contribute to saving via this plugin
- *
- * @since 3.3
- */
+ /**
+ * Image descriptor registry used for images with common overlays.
+ *
+ * @since 3.1
+ */
+ private ImageDescriptorRegistry fImageDescriptorRegistry;
+
+ /**
+ * A set of <code>ISaveParticipant</code>s that want to contribute to saving via this plugin
+ *
+ * @since 3.3
+ */
private Set<ISaveParticipant> fSaveParticipants = new HashSet<>();
/**
@@ -226,31 +226,31 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
*/
private IPropertyChangeListener fThemeListener;
- /**
- * Dummy launch node representing a launch that is waiting
- * for a build to finish before proceeding. This node exists
- * to provide immediate feedback to the user in the Debug view and
- * allows termination, which equates to cancellation of the launch.
- */
+ /**
+ * Dummy launch node representing a launch that is waiting
+ * for a build to finish before proceeding. This node exists
+ * to provide immediate feedback to the user in the Debug view and
+ * allows termination, which equates to cancellation of the launch.
+ */
public static class PendingLaunch extends Launch {
- private Job fJob;
- public PendingLaunch(ILaunchConfiguration launchConfiguration, String mode, Job job) {
- super(launchConfiguration, mode, null);
- fJob= job;
- }
-
- // Allow the user to terminate the dummy launch as a means to
- // cancel the launch while waiting for a build to finish.
- @Override
+ private Job fJob;
+ public PendingLaunch(ILaunchConfiguration launchConfiguration, String mode, Job job) {
+ super(launchConfiguration, mode, null);
+ fJob= job;
+ }
+
+ // Allow the user to terminate the dummy launch as a means to
+ // cancel the launch while waiting for a build to finish.
+ @Override
public boolean canTerminate() {
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public void terminate() throws DebugException {
- fJob.cancel();
- }
- }
+ fJob.cancel();
+ }
+ }
/**
* Constructs the debug UI plug-in
@@ -424,11 +424,11 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
@Override
public void stop(BundleContext context) throws Exception {
try {
- if (fProcessConsoleManager != null) {
- fProcessConsoleManager.shutdown();
- }
+ if (fProcessConsoleManager != null) {
+ fProcessConsoleManager.shutdown();
+ }
- BreakpointOrganizerManager.getDefault().shutdown();
+ BreakpointOrganizerManager.getDefault().shutdown();
if (fPerspectiveManager != null) {
fPerspectiveManager.shutdown();
@@ -446,15 +446,15 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
fgPresentation.dispose();
}
- if (fImageDescriptorRegistry != null) {
- fImageDescriptorRegistry.dispose();
- }
+ if (fImageDescriptorRegistry != null) {
+ fImageDescriptorRegistry.dispose();
+ }
- if (fgDefaultLabelProvider != null) {
- fgDefaultLabelProvider.dispose();
- }
+ if (fgDefaultLabelProvider != null) {
+ fgDefaultLabelProvider.dispose();
+ }
- SourceLookupFacility.shutdown();
+ SourceLookupFacility.shutdown();
DebugElementHelper.dispose();
@@ -557,8 +557,8 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
launchManager.addLaunchListener(this);
}
- // start the breakpoint organizer manager
- BreakpointOrganizerManager.getDefault();
+ // start the breakpoint organizer manager
+ BreakpointOrganizerManager.getDefault();
getLaunchConfigurationManager().startup();
@@ -683,94 +683,94 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
/**
- * Open the launch configuration dialog on the specified launch
- * configuration. The dialog displays the tabs for a single configuration
- * only (a tree of launch configuration is not displayed)
- * <p>
- * If a status is specified, a status handler is consulted to handle the
- * status. The status handler is passed the instance of the launch
- * configuration dialog that is opened. This gives the status handler an
- * opportunity to perform error handling/initialization as required.
- * </p>
- * @param shell the parent shell for the launch configuration dialog
- * @param configuration the configuration to display
- * @param groupIdentifier group identifier of the launch group the launch configuration
- * belongs to
- * @param status the status to display, or <code>null</code> if none
- * @param showCancel if the cancel button should be shown in the particular instance of the dialog
- * @return the return code from opening the launch configuration dialog -
- * one of <code>Window.OK</code> or <code>Window.CANCEL</code>
- *
- * @since 3.3
- *
- */
- public static int openLaunchConfigurationEditDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status, boolean showCancel) {
- LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
- if (group != null) {
- LaunchConfigurationEditDialog dialog = new LaunchConfigurationEditDialog(shell, configuration, group, showCancel);
- dialog.setInitialStatus(status);
- return dialog.open();
- }
- return Window.CANCEL;
- }
-
- /**
- * Open the launch configuration dialog on the specified launch
- * configuration. The dialog displays the tabs for a single configuration
- * only (a tree of launch configuration is not displayed)
- * <p>
- * If a status is specified, a status handler is consulted to handle the
- * status. The status handler is passed the instance of the launch
- * configuration dialog that is opened. This gives the status handler an
- * opportunity to perform error handling/initialization as required.
- * </p>
- * @param shell the parent shell for the launch configuration dialog
- * @param configuration the configuration to display
- * @param groupIdentifier group identifier of the launch group the launch configuration
- * belongs to
- * @param reservednames a set of launch configuration names that cannot be used when creating or renaming
- * the specified launch configuration
- * @param status the status to display, or <code>null</code> if none
- * @param setDefaults whether to set default values in the configuration
- * @return the return code from opening the launch configuration dialog -
- * one of <code>Window.OK</code> or <code>Window.CANCEL</code>
- *
- * @since 3.3
- *
- */
+ * Open the launch configuration dialog on the specified launch
+ * configuration. The dialog displays the tabs for a single configuration
+ * only (a tree of launch configuration is not displayed)
+ * <p>
+ * If a status is specified, a status handler is consulted to handle the
+ * status. The status handler is passed the instance of the launch
+ * configuration dialog that is opened. This gives the status handler an
+ * opportunity to perform error handling/initialization as required.
+ * </p>
+ * @param shell the parent shell for the launch configuration dialog
+ * @param configuration the configuration to display
+ * @param groupIdentifier group identifier of the launch group the launch configuration
+ * belongs to
+ * @param status the status to display, or <code>null</code> if none
+ * @param showCancel if the cancel button should be shown in the particular instance of the dialog
+ * @return the return code from opening the launch configuration dialog -
+ * one of <code>Window.OK</code> or <code>Window.CANCEL</code>
+ *
+ * @since 3.3
+ *
+ */
+ public static int openLaunchConfigurationEditDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status, boolean showCancel) {
+ LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
+ if (group != null) {
+ LaunchConfigurationEditDialog dialog = new LaunchConfigurationEditDialog(shell, configuration, group, showCancel);
+ dialog.setInitialStatus(status);
+ return dialog.open();
+ }
+ return Window.CANCEL;
+ }
+
+ /**
+ * Open the launch configuration dialog on the specified launch
+ * configuration. The dialog displays the tabs for a single configuration
+ * only (a tree of launch configuration is not displayed)
+ * <p>
+ * If a status is specified, a status handler is consulted to handle the
+ * status. The status handler is passed the instance of the launch
+ * configuration dialog that is opened. This gives the status handler an
+ * opportunity to perform error handling/initialization as required.
+ * </p>
+ * @param shell the parent shell for the launch configuration dialog
+ * @param configuration the configuration to display
+ * @param groupIdentifier group identifier of the launch group the launch configuration
+ * belongs to
+ * @param reservednames a set of launch configuration names that cannot be used when creating or renaming
+ * the specified launch configuration
+ * @param status the status to display, or <code>null</code> if none
+ * @param setDefaults whether to set default values in the configuration
+ * @return the return code from opening the launch configuration dialog -
+ * one of <code>Window.OK</code> or <code>Window.CANCEL</code>
+ *
+ * @since 3.3
+ *
+ */
public static int openLaunchConfigurationPropertiesDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, Set<String> reservednames, IStatus status, boolean setDefaults) {
- LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
- if (group != null) {
- LaunchConfigurationPropertiesDialog dialog = new LaunchConfigurationPropertiesDialog(shell, configuration, group, reservednames);
- dialog.setInitialStatus(status);
- dialog.setDefaultsOnOpen(setDefaults);
- return dialog.open();
- }
- return Window.CANCEL;
- }
-
- /**
- * Opens the {@link LaunchConfigurationsDialog} on the given selection for the given group. A status
- * can be provided or <code>null</code> and the dialog can initialize the given {@link ILaunchConfiguration}
- * to its defaults when opening as well - as long as the specified configuration is an {@link ILaunchConfigurationWorkingCopy}.
- * @param shell the shell to open the dialog on
- * @param selection the non-null selection to show when the dialog opens
- * @param groupIdentifier the identifier of the launch group to open the dialog on
- * @param setDefaults if the default values should be set on the opened configuration - if there is one
- * @return the return code from the dialog.open() call
- * @since 3.6
- */
- public static int openLaunchConfigurationsDialog(Shell shell, IStructuredSelection selection, String groupIdentifier, boolean setDefaults) {
- LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
- if (group != null) {
+ LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
+ if (group != null) {
+ LaunchConfigurationPropertiesDialog dialog = new LaunchConfigurationPropertiesDialog(shell, configuration, group, reservednames);
+ dialog.setInitialStatus(status);
+ dialog.setDefaultsOnOpen(setDefaults);
+ return dialog.open();
+ }
+ return Window.CANCEL;
+ }
+
+ /**
+ * Opens the {@link LaunchConfigurationsDialog} on the given selection for the given group. A status
+ * can be provided or <code>null</code> and the dialog can initialize the given {@link ILaunchConfiguration}
+ * to its defaults when opening as well - as long as the specified configuration is an {@link ILaunchConfigurationWorkingCopy}.
+ * @param shell the shell to open the dialog on
+ * @param selection the non-null selection to show when the dialog opens
+ * @param groupIdentifier the identifier of the launch group to open the dialog on
+ * @param setDefaults if the default values should be set on the opened configuration - if there is one
+ * @return the return code from the dialog.open() call
+ * @since 3.6
+ */
+ public static int openLaunchConfigurationsDialog(Shell shell, IStructuredSelection selection, String groupIdentifier, boolean setDefaults) {
+ LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
+ if (group != null) {
LaunchConfigurationsDialog dialog = new LaunchConfigurationsDialog(shell, group);
dialog.setOpenMode(LaunchConfigurationsDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_SELECTION);
dialog.setInitialSelection(selection);
dialog.setDefaultsOnOpen(setDefaults);
return dialog.open();
- }
- return Window.CANCEL;
- }
+ }
+ return Window.CANCEL;
+ }
/**
* Save all dirty editors in the workbench.
@@ -953,38 +953,38 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
public static boolean DEBUG_TEST_PRESENTATION_ID(IPresentationContext context) {
- if (context == null) {
- return true;
- }
- return DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(context.getId());
+ if (context == null) {
+ return true;
+ }
+ return DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(context.getId());
}
/**
- * Return the ILaunch associated with a model element, or null if there is
- * no such association.
- *
- * @param element the model element
- * @return the ILaunch associated with the element, or null.
- * @since 3.6
- */
- public static ILaunch getLaunch(Object element) {
- // support for custom models
- ILaunch launch= (ILaunch)DebugPlugin.getAdapter(element, ILaunch.class);
- if (launch == null) {
- // support for standard debug model
- if (element instanceof IDebugElement) {
- launch= ((IDebugElement)element).getLaunch();
- } else if (element instanceof ILaunch) {
- launch= ((ILaunch)element);
- } else if (element instanceof IProcess) {
- launch= ((IProcess)element).getLaunch();
- }
- }
- return launch;
- }
-
-
- /**
+ * Return the ILaunch associated with a model element, or null if there is
+ * no such association.
+ *
+ * @param element the model element
+ * @return the ILaunch associated with the element, or null.
+ * @since 3.6
+ */
+ public static ILaunch getLaunch(Object element) {
+ // support for custom models
+ ILaunch launch= (ILaunch)DebugPlugin.getAdapter(element, ILaunch.class);
+ if (launch == null) {
+ // support for standard debug model
+ if (element instanceof IDebugElement) {
+ launch= ((IDebugElement)element).getLaunch();
+ } else if (element instanceof ILaunch) {
+ launch= ((ILaunch)element);
+ } else if (element instanceof IProcess) {
+ launch= ((IProcess)element).getLaunch();
+ }
+ }
+ return launch;
+ }
+
+
+ /**
* Save dirty editors before launching, according to preferences.
*
* @return whether to proceed with launch
@@ -1199,33 +1199,33 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
workingCopy.setAttribute(ATTR_LAUNCHING_CONFIG_HANDLE, configuration.getMemento());
final ILaunch pendingLaunch = new PendingLaunch(workingCopy, mode, this);
DebugPlugin.getDefault().getLaunchManager().addLaunch(pendingLaunch);
- IJobChangeListener listener= new IJobChangeListener() {
- @Override
+ IJobChangeListener listener= new IJobChangeListener() {
+ @Override
public void sleeping(IJobChangeEvent event) {}
- @Override
+ @Override
public void scheduled(IJobChangeEvent event) {}
- @Override
+ @Override
public void running(IJobChangeEvent event) {}
- @Override
+ @Override
public void awake(IJobChangeEvent event) {}
- @Override
+ @Override
public void aboutToRun(IJobChangeEvent event) {}
- @Override
+ @Override
public void done(IJobChangeEvent event) {
- DebugPlugin dp = DebugPlugin.getDefault();
- if (dp != null) {
- dp.getLaunchManager().removeLaunch(pendingLaunch);
- }
- removeJobChangeListener(this);
- }
- };
- addJobChangeListener(listener);
+ DebugPlugin dp = DebugPlugin.getDefault();
+ if (dp != null) {
+ dp.getLaunchManager().removeLaunch(pendingLaunch);
+ }
+ removeJobChangeListener(this);
+ }
+ };
+ addJobChangeListener(listener);
try {
jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new SubProgressMonitor(monitor, 1));
jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new SubProgressMonitor(monitor, 1));
}
catch (InterruptedException e) {/*just continue.*/}
- DebugPlugin.getDefault().getLaunchManager().removeLaunch(pendingLaunch);
+ DebugPlugin.getDefault().getLaunchManager().removeLaunch(pendingLaunch);
}
else {
monitor.worked(2); /* don't wait for jobs to finish */
@@ -1273,28 +1273,28 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
*
* @return label without accelerators
*/
- public static String removeAccelerators(String label) {
- String title = label;
- if (title != null) {
- // strip out any '&' (accelerators)
- int index = title.indexOf('&');
- if (index == 0) {
- title = title.substring(1);
- } else if (index > 0) {
- //DBCS languages use "(&X)" format
- if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') {
- String first = title.substring(0, index - 1);
- String last = title.substring(index + 3);
- title = first + last;
- } else if (index < (title.length() - 1)) {
- String first = title.substring(0, index);
- String last = title.substring(index + 1);
- title = first + last;
- }
- }
- }
- return title;
- }
+ public static String removeAccelerators(String label) {
+ String title = label;
+ if (title != null) {
+ // strip out any '&' (accelerators)
+ int index = title.indexOf('&');
+ if (index == 0) {
+ title = title.substring(1);
+ } else if (index > 0) {
+ //DBCS languages use "(&X)" format
+ if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') {
+ String first = title.substring(0, index - 1);
+ String last = title.substring(index + 3);
+ title = first + last;
+ } else if (index < (title.length() - 1)) {
+ String first = title.substring(0, index);
+ String last = title.substring(index + 1);
+ title = first + last;
+ }
+ }
+ }
+ return title;
+ }
/**
* Returns the label with any DBCS accelerator moved to the end of the string.
@@ -1303,52 +1303,52 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
*
* @return label with moved accelerator
*/
- public static String adjustDBCSAccelerator(String label) {
- String title = label;
- if (title != null) {
- // strip out any '&' (accelerators)
- int index = title.indexOf('&');
- if (index > 0) {
- //DBCS languages use "(&X)" format
- if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') {
- String first = title.substring(0, index - 1);
- String accel = title.substring(index - 1, index + 3);
- String last = title.substring(index + 3);
- title = first + last;
- if (title.endsWith("...")) { //$NON-NLS-1$
- title = title.substring(0, title.length() - 3);
- title = title + accel + "..."; //$NON-NLS-1$
- } else {
- title = title + accel;
- }
- }
- }
- }
- return title;
- }
-
- /**
- * Returns the image descriptor registry used for this plug-in.
- * @return the singleton {@link ImageDescriptorRegistry}
- *
- * @since 3.1
- */
- public static ImageDescriptorRegistry getImageDescriptorRegistry() {
- if (getDefault().fImageDescriptorRegistry == null) {
- getDefault().fImageDescriptorRegistry = new ImageDescriptorRegistry();
- }
- return getDefault().fImageDescriptorRegistry;
- }
-
- /**
- * Returns an image descriptor for the icon referenced by the given attribute
- * and configuration element, or <code>null</code> if none.
- *
- * @param element the configuration element
- * @param attr the name of the attribute
- * @return image descriptor or <code>null</code>
- */
- public static ImageDescriptor getImageDescriptor(IConfigurationElement element, String attr) {
+ public static String adjustDBCSAccelerator(String label) {
+ String title = label;
+ if (title != null) {
+ // strip out any '&' (accelerators)
+ int index = title.indexOf('&');
+ if (index > 0) {
+ //DBCS languages use "(&X)" format
+ if (title.charAt(index - 1) == '(' && title.length() >= index + 3 && title.charAt(index + 2) == ')') {
+ String first = title.substring(0, index - 1);
+ String accel = title.substring(index - 1, index + 3);
+ String last = title.substring(index + 3);
+ title = first + last;
+ if (title.endsWith("...")) { //$NON-NLS-1$
+ title = title.substring(0, title.length() - 3);
+ title = title + accel + "..."; //$NON-NLS-1$
+ } else {
+ title = title + accel;
+ }
+ }
+ }
+ }
+ return title;
+ }
+
+ /**
+ * Returns the image descriptor registry used for this plug-in.
+ * @return the singleton {@link ImageDescriptorRegistry}
+ *
+ * @since 3.1
+ */
+ public static ImageDescriptorRegistry getImageDescriptorRegistry() {
+ if (getDefault().fImageDescriptorRegistry == null) {
+ getDefault().fImageDescriptorRegistry = new ImageDescriptorRegistry();
+ }
+ return getDefault().fImageDescriptorRegistry;
+ }
+
+ /**
+ * Returns an image descriptor for the icon referenced by the given attribute
+ * and configuration element, or <code>null</code> if none.
+ *
+ * @param element the configuration element
+ * @param attr the name of the attribute
+ * @return image descriptor or <code>null</code>
+ */
+ public static ImageDescriptor getImageDescriptor(IConfigurationElement element, String attr) {
Bundle bundle = Platform.getBundle(element.getContributor().getName());
String iconPath = element.getAttribute(attr);
if (iconPath != null) {
@@ -1367,18 +1367,18 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
}
return null;
- }
-
- /**
- * Returns an image descriptor for the icon referenced by the given path
- * and contributor name, or <code>null</code> if none.
- *
- * @param name the name of the contributor
- * @param path the path of the icon (from the configuration element)
- * @return image descriptor or <code>null</code>
- * @since 3.3
- */
- public static ImageDescriptor getImageDescriptor(String name, String path) {
+ }
+
+ /**
+ * Returns an image descriptor for the icon referenced by the given path
+ * and contributor name, or <code>null</code> if none.
+ *
+ * @param name the name of the contributor
+ * @param path the path of the icon (from the configuration element)
+ * @return image descriptor or <code>null</code>
+ * @since 3.3
+ */
+ public static ImageDescriptor getImageDescriptor(String name, String path) {
Bundle bundle = Platform.getBundle(name);
if (path != null) {
URL iconURL = FileLocator.find(bundle , new Path(path), null);
@@ -1387,9 +1387,9 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
}
return null;
- }
+ }
- /**
+ /**
* Performs extra filtering for launch configurations based on the preferences set on the
* Launch Configurations page
* @param config the config to filter
@@ -1409,7 +1409,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
ret &= new LaunchConfigurationTypeFilter().select(null, null, config.getType());
}
catch(CoreException e) {
- DebugUIPlugin.log(e);
+ DebugUIPlugin.log(e);
}
}
return ret;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
index 59de95449..955bda6f4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
@@ -160,7 +160,7 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
*
* @since 3.5
*/
- prefs.setDefault(IDebugPreferenceConstants.DEBUG_VIEW_MODE, IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO);
+ prefs.setDefault(IDebugPreferenceConstants.DEBUG_VIEW_MODE, IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
index 8c5021e06..9254cd8b2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java
@@ -441,38 +441,38 @@ public class DefaultLabelProvider implements ILabelProvider {
protected String getBreakpointImageKey(IBreakpoint breakpoint) {
if (breakpoint != null && breakpoint.getMarker().exists()) {
- try {
- boolean enabled = breakpoint.isEnabled();
- if (breakpoint instanceof IWatchpoint) {
- IWatchpoint watchpoint = (IWatchpoint) breakpoint;
- if (watchpoint.isAccess()) {
- if (watchpoint.isModification()) {
- //access and modification
- if (enabled) {
- return IDebugUIConstants.IMG_OBJS_WATCHPOINT;
- }
- return IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED;
- }
- if (enabled) {
- return IDebugUIConstants.IMG_OBJS_ACCESS_WATCHPOINT;
- }
- return IDebugUIConstants.IMG_OBJS_ACCESS_WATCHPOINT_DISABLED;
- } else if (watchpoint.isModification()) {
- if (enabled) {
- return IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT;
- }
- return IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT_DISABLED;
- } else {
- //neither access nor modification
- return IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED;
- }
- }
- if (enabled) {
+ try {
+ boolean enabled = breakpoint.isEnabled();
+ if (breakpoint instanceof IWatchpoint) {
+ IWatchpoint watchpoint = (IWatchpoint) breakpoint;
+ if (watchpoint.isAccess()) {
+ if (watchpoint.isModification()) {
+ //access and modification
+ if (enabled) {
+ return IDebugUIConstants.IMG_OBJS_WATCHPOINT;
+ }
+ return IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED;
+ }
+ if (enabled) {
+ return IDebugUIConstants.IMG_OBJS_ACCESS_WATCHPOINT;
+ }
+ return IDebugUIConstants.IMG_OBJS_ACCESS_WATCHPOINT_DISABLED;
+ } else if (watchpoint.isModification()) {
+ if (enabled) {
+ return IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT;
+ }
+ return IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT_DISABLED;
+ } else {
+ //neither access nor modification
+ return IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED;
+ }
+ }
+ if (enabled) {
return IDebugUIConstants.IMG_OBJS_BREAKPOINT;
}
return IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED;
- } catch (CoreException e) {
- }
+ } catch (CoreException e) {
+ }
}
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
index 94bf2b550..20694eba4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
@@ -146,14 +146,14 @@ public class DelegatingModelPresentation implements IDebugModelPresentation, IDe
return getDefaultImage(item);
}
- @Override
+ @Override
public String getText(Object item) {
- IDebugModelPresentation lp= getConfiguredPresentation(item);
- if (lp != null) {
- return lp.getText(item);
- }
- return getDefaultText(item);
- }
+ IDebugModelPresentation lp= getConfiguredPresentation(item);
+ if (lp != null) {
+ return lp.getText(item);
+ }
+ return getDefaultText(item);
+ }
@Override
public IEditorInput getEditorInput(Object item) {
@@ -319,35 +319,35 @@ public class DelegatingModelPresentation implements IDebugModelPresentation, IDe
return fLabelProviders;
}
- @Override
+ @Override
public Color getForeground(Object element) {
- IDebugModelPresentation presentation = getConfiguredPresentation(element);
- if (presentation instanceof IColorProvider) {
- IColorProvider colorProvider = (IColorProvider) presentation;
- return colorProvider.getForeground(element);
- }
- return null;
- }
-
- @Override
+ IDebugModelPresentation presentation = getConfiguredPresentation(element);
+ if (presentation instanceof IColorProvider) {
+ IColorProvider colorProvider = (IColorProvider) presentation;
+ return colorProvider.getForeground(element);
+ }
+ return null;
+ }
+
+ @Override
public Color getBackground(Object element) {
- IDebugModelPresentation presentation = getConfiguredPresentation(element);
- if (presentation instanceof IColorProvider) {
- IColorProvider colorProvider = (IColorProvider) presentation;
- return colorProvider.getBackground(element);
- }
- return null;
- }
-
- @Override
+ IDebugModelPresentation presentation = getConfiguredPresentation(element);
+ if (presentation instanceof IColorProvider) {
+ IColorProvider colorProvider = (IColorProvider) presentation;
+ return colorProvider.getBackground(element);
+ }
+ return null;
+ }
+
+ @Override
public Font getFont(Object element) {
- IDebugModelPresentation presentation = getConfiguredPresentation(element);
- if (presentation instanceof IFontProvider) {
- IFontProvider fontProvider = (IFontProvider) presentation;
- return fontProvider.getFont(element);
- }
- return null;
- }
+ IDebugModelPresentation presentation = getConfiguredPresentation(element);
+ if (presentation instanceof IFontProvider) {
+ IFontProvider fontProvider = (IFontProvider) presentation;
+ return fontProvider.getFont(element);
+ }
+ return null;
+ }
@Override
public Annotation getInstructionPointerAnnotation(IEditorPart editorPart, IStackFrame frame) {
@@ -371,7 +371,7 @@ public class DelegatingModelPresentation implements IDebugModelPresentation, IDe
}
}
if (annotation == null) {
- boolean defaultAnnotation = id == null;
+ boolean defaultAnnotation = id == null;
if (id == null || text == null || (defaultAnnotation && image == null)) {
IThread thread = frame.getThread();
IStackFrame tos = null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
index 439243b8a..d1d2216c4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
@@ -61,27 +61,27 @@ public interface IDebugHelpContextIds {
String DETAIL_PANE_PASTE_ACTION = PREFIX + "detail_pane_paste_action_context"; //$NON-NLS-1$
String DETAIL_PANE_SELECT_ALL_ACTION = PREFIX + "detail_pane_select_all_action_context"; //$NON-NLS-1$
String DETAIL_PANE_FIND_REPLACE_ACTION = PREFIX + "detail_pane_find_replace_action_context"; //$NON-NLS-1$
- String DETAIL_PANE_WORD_WRAP_ACTION = PREFIX + "detail_pane_word_wrap_action_context"; //$NON-NLS-1$
- String DETAIL_PANE_MAX_LENGTH_ACTION = PREFIX + "detail_pane_max_length_action_context"; //$NON-NLS-1$
- String CONSOLE_TERMINATE_ACTION = PREFIX + "console_terminate_action_context"; //$NON-NLS-1$
- String CONSOLE_REMOVE_ALL_TERMINATED = PREFIX + "console_remove_all_terminated_context"; //$NON-NLS-1$
- String CONSOLE_REMOVE_LAUNCH = PREFIX + "console_remove_launch_context"; //$NON-NLS-1$;
- String CONSOLE_SHOW_PREFERENCES = PREFIX + "console_show_preferences_action_context"; //$NON-NLS-1$
- String SHOW_COLUMNS_ACTION = PREFIX + "show_columns_context"; //$NON-NLS-1$;
- String CONFIGURE_COLUMNS_ACTION = PREFIX + "configure_columns_context"; //$NON-NLS-1$;
- String MEMORY_VIEW_PANE_ORIENTATION_ACTION = PREFIX + "memory_view_pane_orientation_action_context"; //$NON-NLS-1$
- String SHOW_WHEN_STDOUT_CHANGES_ACTION = PREFIX + "show_stdout_action_context"; //$NON-NLS-1$
- String SHOW_WHEN_STDERR_CHANGES_ACTION = PREFIX + "show_stderr_action_context"; //$NON-NLS-1$
- String HORIZONTAL_DETAIL_PANE_LAYOUT_ACTION = PREFIX + "horizontal_detail_pane_layout_action_context"; //$NON-NLS-1$
- String VERTICAL_DETAIL_PANE_LAYOUT_ACTION = PREFIX + "vertical_detail_pane_layout_action_context"; //$NON-NLS-1$
- String DETAIL_PANE_HIDDEN_LAYOUT_ACTION = PREFIX + "detail_pane_hidden_layout_action_context"; //$NON-NLS-1$
- String DEBUG_VIEW_MODE_AUTO_ACTION = PREFIX + "debug_view_mode_auto_action_context"; //$NON-NLS-1$
- String DEBUG_VIEW_MODE_FULL_ACTION = PREFIX + "debug_view_mode_full_action_context"; //$NON-NLS-1$
- String DEBUG_VIEW_MODE_COMPACT_ACTION = PREFIX + "debug_view_mode_compact_action_context"; //$NON-NLS-1$
- String DEBUG_VIEW_DROP_DOWN_AUTOEXPAND_ACTION = PREFIX + "debug_view_drop_down_autoexpand_action_context"; //$NON-NLS-1$
- String DEBUG_TOOLBAR_VIEW_ACTION = PREFIX + "debug_toolbar_view_action_context"; //$NON-NLS-1$
- String DEBUG_TOOLBAR_WINDOW_ACTION = PREFIX + "debug_toolbar_window_action_context"; //$NON-NLS-1$
- String DEBUG_TOOLBAR_BOTH_ACTION = PREFIX + "debug_toolbar_both_action_context"; //$NON-NLS-1$
+ String DETAIL_PANE_WORD_WRAP_ACTION = PREFIX + "detail_pane_word_wrap_action_context"; //$NON-NLS-1$
+ String DETAIL_PANE_MAX_LENGTH_ACTION = PREFIX + "detail_pane_max_length_action_context"; //$NON-NLS-1$
+ String CONSOLE_TERMINATE_ACTION = PREFIX + "console_terminate_action_context"; //$NON-NLS-1$
+ String CONSOLE_REMOVE_ALL_TERMINATED = PREFIX + "console_remove_all_terminated_context"; //$NON-NLS-1$
+ String CONSOLE_REMOVE_LAUNCH = PREFIX + "console_remove_launch_context"; //$NON-NLS-1$;
+ String CONSOLE_SHOW_PREFERENCES = PREFIX + "console_show_preferences_action_context"; //$NON-NLS-1$
+ String SHOW_COLUMNS_ACTION = PREFIX + "show_columns_context"; //$NON-NLS-1$;
+ String CONFIGURE_COLUMNS_ACTION = PREFIX + "configure_columns_context"; //$NON-NLS-1$;
+ String MEMORY_VIEW_PANE_ORIENTATION_ACTION = PREFIX + "memory_view_pane_orientation_action_context"; //$NON-NLS-1$
+ String SHOW_WHEN_STDOUT_CHANGES_ACTION = PREFIX + "show_stdout_action_context"; //$NON-NLS-1$
+ String SHOW_WHEN_STDERR_CHANGES_ACTION = PREFIX + "show_stderr_action_context"; //$NON-NLS-1$
+ String HORIZONTAL_DETAIL_PANE_LAYOUT_ACTION = PREFIX + "horizontal_detail_pane_layout_action_context"; //$NON-NLS-1$
+ String VERTICAL_DETAIL_PANE_LAYOUT_ACTION = PREFIX + "vertical_detail_pane_layout_action_context"; //$NON-NLS-1$
+ String DETAIL_PANE_HIDDEN_LAYOUT_ACTION = PREFIX + "detail_pane_hidden_layout_action_context"; //$NON-NLS-1$
+ String DEBUG_VIEW_MODE_AUTO_ACTION = PREFIX + "debug_view_mode_auto_action_context"; //$NON-NLS-1$
+ String DEBUG_VIEW_MODE_FULL_ACTION = PREFIX + "debug_view_mode_full_action_context"; //$NON-NLS-1$
+ String DEBUG_VIEW_MODE_COMPACT_ACTION = PREFIX + "debug_view_mode_compact_action_context"; //$NON-NLS-1$
+ String DEBUG_VIEW_DROP_DOWN_AUTOEXPAND_ACTION = PREFIX + "debug_view_drop_down_autoexpand_action_context"; //$NON-NLS-1$
+ String DEBUG_TOOLBAR_VIEW_ACTION = PREFIX + "debug_toolbar_view_action_context"; //$NON-NLS-1$
+ String DEBUG_TOOLBAR_WINDOW_ACTION = PREFIX + "debug_toolbar_window_action_context"; //$NON-NLS-1$
+ String DEBUG_TOOLBAR_BOTH_ACTION = PREFIX + "debug_toolbar_both_action_context"; //$NON-NLS-1$
// Views
String DEBUG_VIEW = PREFIX + "debug_view_context"; //$NON-NLS-1$
@@ -91,7 +91,7 @@ public interface IDebugHelpContextIds {
String LAUNCH_CONFIGURATION_VIEW = PREFIX + "launch_configuration_view_context"; //$NON-NLS-1$
String REGISTERS_VIEW = PREFIX + "registers_view_context"; //$NON-NLS-1$
String PROCESS_CONSOLE = PREFIX + "process_console_context"; //$NON-NLS-1$
- String MODULES_VIEW = PREFIX + "modules_view_context"; //$NON-NLS-1$
+ String MODULES_VIEW = PREFIX + "modules_view_context"; //$NON-NLS-1$
// Preference pages
String DEBUG_PREFERENCE_PAGE = PREFIX + "debug_preference_page_context"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
index fb4a8a76e..270fa4468 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
@@ -24,288 +24,288 @@ import org.eclipse.debug.ui.IDebugUIConstants;
public interface IInternalDebugUIConstants {
- String DIALOGSTORE_LASTEXTJAR= "org.eclipse.debug.ui.lastextjar"; //$NON-NLS-1$
-
- //Folders
- String ID_NAVIGATOR_FOLDER_VIEW= "org.eclipse.debug.internal.ui.NavigatorFolderView"; //$NON-NLS-1$
- String ID_TOOLS_FOLDER_VIEW= "org.eclipse.debug.internal.ui.ToolsFolderView"; //$NON-NLS-1$
- String ID_CONSOLE_FOLDER_VIEW= "org.eclipse.debug.internal.ui.ConsoleFolderView"; //$NON-NLS-1$
- String ID_OUTLINE_FOLDER_VIEW= "org.eclipse.debug.internal.ui.OutlineFolderView"; //$NON-NLS-1$
-
- // tool images
- String IMG_LCL_COLLAPSE_ALL = "IMG_LCL_COLLAPSE_ALL"; //$NON-NLS-1$
- String IMG_LCL_TERMINATE = "IMG_LCL_TERMINATE"; //$NON-NLS-1$
- String IMG_LCL_SHOW_LOGICAL_STRUCTURE = "IMG_LCL_SHOW_LOGICAL_STRUCTURE"; //$NON-NLS-1$
- String IMG_LCL_RUN_TO_LINE= "IMG_LCL_RUN_TO_LINE"; //$NON-NLS-1$
- String IMG_SRC_LOOKUP_MENU = "IMG_SRC_LOOKUP_MENU"; //$NON-NLS-1$
-
- /**
- * @deprecated Use IDebugUIConstants#IMG_LCL_ADD
- */
- @Deprecated String IMG_LCL_MONITOR_EXPRESSION= IDebugUIConstants.IMG_LCL_ADD;
- String IMG_LCL_REMOVE_MEMORY= "IMG_LCL_REMOVE_MEMORY"; //$NON-NLS-1$
- String IMG_LCL_RESET_MEMORY= "IMG_LCL_RESET_MEMORY";//$NON-NLS-1$
- String IMG_LCL_COPY_VIEW_TO_CLIPBOARD = "IMG_LCL_COPY_VIEW_TO_CLIPBOARD"; //$NON-NLS-1$
- String IMG_LCL_PRINT_TOP_VIEW_TAB = "IMG_LCL_PRINT_TOP_VIEW_TAB"; //$NON-NLS-1$
-
- // disabled local tool images
- String IMG_DLCL_LOCK= "IMG_DLCL_LOCK"; //$NON-NLS-1$
- String IMG_DLCL_DETAIL_PANE= "IMG_DLCL_DETAIL_PANE"; //$NON-NLS-1$
- String IMG_DLCL_CHANGE_VARIABLE_VALUE= "IMG_DLCL_CHANGE_VARIABLE_VALUE"; //$NON-NLS-1$
- String IMG_DLCL_TYPE_NAMES= "IMG_DLCL_TYPE_NAMES"; //$NON-NLS-1$
- String IMG_DLCL_SHOW_LOGICAL_STRUCTURE= "IMG_DLCL_SHOW_LOGICAL_STRUCTURE"; //$NON-NLS-1$
- String IMG_DLCL_DETAIL_PANE_UNDER= "IMG_DLCL_DETAIL_PANE_UNDER"; //$NON-NLS-1$
- String IMG_DLCL_DETAIL_PANE_RIGHT= "IMG_DLCL_DETAIL_PANE_RIGHT"; //$NON-NLS-1$
- String IMG_DLCL_DETAIL_PANE_HIDE= "IMG_DLCL_DETAIL_PANE_HIDE"; //$NON-NLS-1$
- String IMG_DLCL_DETAIL_PANE_AUTO= "IMG_DLCL_DETAIL_PANE_AUTO"; //$NON-NLS-1$
- String IMG_DLCL_COLLAPSE_ALL = "IMG_DLCL_COLLAPSE_ALL"; //$NON-NLS-1$
- String IMG_DLCL_TERMINATE = "IMG_DLCL_TERMINATE"; //$NON-NLS-1$
- String IMG_DLCL_REMOVE_ALL = "IMG_DLCL_REMOVE_ALL"; //$NON-NLS-1$
- String IMG_DLCL_REMOVE = "IMG_DLCL_REMOVE"; //$NON-NLS-1$
- String IMG_DLCL_RUN_TO_LINE= "IMG_DLCL_RUN_TO_LINE"; //$NON-NLS-1$
- String IMG_SRC_LOOKUP_MENU_DLCL = "IMG_SRC_LOOKUP_MENU_DISABLED"; //$NON-NLS-1$
- String IMG_DLCL_MONITOR_EXPRESSION= "IMG_DLCL_MONITOR_EXPRESSION"; //$NON-NLS-1$
- String IMG_DLCL_REMOVE_MEMORY= "IMG_DLCL_REMOVE_MEMORY"; //$NON-NLS-1$
- String IMG_DLCL_RESET_MEMORY= "IMG_DLCL_RESET_MEMORY"; //$NON-NLS-1$
- String IMG_DLCL_COPY_VIEW_TO_CLIPBOARD= "IMG_DLCL_COPY_VIEW_TO_CLIPBOARD"; //$NON-NLS-1$
- String IMG_DLCL_PRINT_TOP_VIEW_TAB= "IMG_DLCL_PRINT_TOP_VIEW_TAB"; //$NON-NLS-1$
- String IMG_DLCL_NEW_CONFIG = "IMG_DLCL_NEW_CONFIG"; //$NON-NLS-1$
- String IMG_DLCL_DUPLICATE_CONFIG = "IMG_DLCL_DUPLICATE_CONFIG"; //$NON-NLS-1$
- String IMG_DLCL_DELETE_CONFIG = "IMG_DLCL_DELETE_CONFIG"; //$NON-NLS-1$
- String IMG_DLCL_FILTER_CONFIGS = "IMG_DLCL_FILTER_CONFIGS"; //$NON-NLS-1$
- String IMG_DLCL_NEW_PROTO = "IMG_DLCL_NEW_PROTO"; //$NON-NLS-1$
- String IMG_DLCL_LINK_PROTO = "IMG_DLCL_LINK_PROTO"; //$NON-NLS-1$
- String IMG_DLCL_UNLINK_PROTO = "IMG_DLCL_UNLINK_PROTO"; //$NON-NLS-1$
- String IMG_DLCL_RESET_PROTO = "IMG_DLCL_RESET_PROTO"; //$NON-NLS-1$
- String IMG_DLCL_SUSPEND = "IMG_DLCL_SUSPEND"; //$NON-NLS-1$
- String IMG_DLCL_RESUME = "IMG_DLCL_RESUME"; //$NON-NLS-1$
- String IMG_DLCL_STEP_RETURN = "IMG_DLCL_STEP_RETURN"; //$NON-NLS-1$
- String IMG_DLCL_STEP_OVER = "IMG_DLCL_STEP_OVER"; //$NON-NLS-1$
- String IMG_DLCL_STEP_INTO = "IMG_DLCL_STEP_INTO"; //$NON-NLS-1$
- String IMG_DLCL_TERMINATE_AND_REMOVE = "IMG_DLCL_TERMINATE_AND_REMOVE"; //$NON-NLS-1$
- String IMG_DLCL_TERMINATE_ALL = "IMG_DLCL_TERMINATE_ALL"; //$NON-NLS-1$
- String IMG_DLCL_TERMINATE_AND_RELAUNCH = "IMG_DLCL_TERMINATE_AND_RELAUNCH"; //$NON-NLS-1$
- String IMG_DLCL_TOGGLE_STEP_FILTERS = "IMG_DLCL_TOGGLE_STEP_FILTERS"; //$NON-NLS-1$
- String IMG_DLCL_NEXT_THREAD = "IMG_DLCL_NEXT_THREAD"; //$NON-NLS-1$
- String IMG_DLCL_PREVIOUS_THREAD = "IMG_DLCL_PREVIOUS_THREAD"; //$NON-NLS-1$
- String IMG_DLCL_RESTART = "IMG_DLCL_RESTART"; //$NON-NLS-1$
+ String DIALOGSTORE_LASTEXTJAR= "org.eclipse.debug.ui.lastextjar"; //$NON-NLS-1$
+
+ //Folders
+ String ID_NAVIGATOR_FOLDER_VIEW= "org.eclipse.debug.internal.ui.NavigatorFolderView"; //$NON-NLS-1$
+ String ID_TOOLS_FOLDER_VIEW= "org.eclipse.debug.internal.ui.ToolsFolderView"; //$NON-NLS-1$
+ String ID_CONSOLE_FOLDER_VIEW= "org.eclipse.debug.internal.ui.ConsoleFolderView"; //$NON-NLS-1$
+ String ID_OUTLINE_FOLDER_VIEW= "org.eclipse.debug.internal.ui.OutlineFolderView"; //$NON-NLS-1$
+
+ // tool images
+ String IMG_LCL_COLLAPSE_ALL = "IMG_LCL_COLLAPSE_ALL"; //$NON-NLS-1$
+ String IMG_LCL_TERMINATE = "IMG_LCL_TERMINATE"; //$NON-NLS-1$
+ String IMG_LCL_SHOW_LOGICAL_STRUCTURE = "IMG_LCL_SHOW_LOGICAL_STRUCTURE"; //$NON-NLS-1$
+ String IMG_LCL_RUN_TO_LINE= "IMG_LCL_RUN_TO_LINE"; //$NON-NLS-1$
+ String IMG_SRC_LOOKUP_MENU = "IMG_SRC_LOOKUP_MENU"; //$NON-NLS-1$
+
+ /**
+ * @deprecated Use IDebugUIConstants#IMG_LCL_ADD
+ */
+ @Deprecated String IMG_LCL_MONITOR_EXPRESSION= IDebugUIConstants.IMG_LCL_ADD;
+ String IMG_LCL_REMOVE_MEMORY= "IMG_LCL_REMOVE_MEMORY"; //$NON-NLS-1$
+ String IMG_LCL_RESET_MEMORY= "IMG_LCL_RESET_MEMORY";//$NON-NLS-1$
+ String IMG_LCL_COPY_VIEW_TO_CLIPBOARD = "IMG_LCL_COPY_VIEW_TO_CLIPBOARD"; //$NON-NLS-1$
+ String IMG_LCL_PRINT_TOP_VIEW_TAB = "IMG_LCL_PRINT_TOP_VIEW_TAB"; //$NON-NLS-1$
+
+ // disabled local tool images
+ String IMG_DLCL_LOCK= "IMG_DLCL_LOCK"; //$NON-NLS-1$
+ String IMG_DLCL_DETAIL_PANE= "IMG_DLCL_DETAIL_PANE"; //$NON-NLS-1$
+ String IMG_DLCL_CHANGE_VARIABLE_VALUE= "IMG_DLCL_CHANGE_VARIABLE_VALUE"; //$NON-NLS-1$
+ String IMG_DLCL_TYPE_NAMES= "IMG_DLCL_TYPE_NAMES"; //$NON-NLS-1$
+ String IMG_DLCL_SHOW_LOGICAL_STRUCTURE= "IMG_DLCL_SHOW_LOGICAL_STRUCTURE"; //$NON-NLS-1$
+ String IMG_DLCL_DETAIL_PANE_UNDER= "IMG_DLCL_DETAIL_PANE_UNDER"; //$NON-NLS-1$
+ String IMG_DLCL_DETAIL_PANE_RIGHT= "IMG_DLCL_DETAIL_PANE_RIGHT"; //$NON-NLS-1$
+ String IMG_DLCL_DETAIL_PANE_HIDE= "IMG_DLCL_DETAIL_PANE_HIDE"; //$NON-NLS-1$
+ String IMG_DLCL_DETAIL_PANE_AUTO= "IMG_DLCL_DETAIL_PANE_AUTO"; //$NON-NLS-1$
+ String IMG_DLCL_COLLAPSE_ALL = "IMG_DLCL_COLLAPSE_ALL"; //$NON-NLS-1$
+ String IMG_DLCL_TERMINATE = "IMG_DLCL_TERMINATE"; //$NON-NLS-1$
+ String IMG_DLCL_REMOVE_ALL = "IMG_DLCL_REMOVE_ALL"; //$NON-NLS-1$
+ String IMG_DLCL_REMOVE = "IMG_DLCL_REMOVE"; //$NON-NLS-1$
+ String IMG_DLCL_RUN_TO_LINE= "IMG_DLCL_RUN_TO_LINE"; //$NON-NLS-1$
+ String IMG_SRC_LOOKUP_MENU_DLCL = "IMG_SRC_LOOKUP_MENU_DISABLED"; //$NON-NLS-1$
+ String IMG_DLCL_MONITOR_EXPRESSION= "IMG_DLCL_MONITOR_EXPRESSION"; //$NON-NLS-1$
+ String IMG_DLCL_REMOVE_MEMORY= "IMG_DLCL_REMOVE_MEMORY"; //$NON-NLS-1$
+ String IMG_DLCL_RESET_MEMORY= "IMG_DLCL_RESET_MEMORY"; //$NON-NLS-1$
+ String IMG_DLCL_COPY_VIEW_TO_CLIPBOARD= "IMG_DLCL_COPY_VIEW_TO_CLIPBOARD"; //$NON-NLS-1$
+ String IMG_DLCL_PRINT_TOP_VIEW_TAB= "IMG_DLCL_PRINT_TOP_VIEW_TAB"; //$NON-NLS-1$
+ String IMG_DLCL_NEW_CONFIG = "IMG_DLCL_NEW_CONFIG"; //$NON-NLS-1$
+ String IMG_DLCL_DUPLICATE_CONFIG = "IMG_DLCL_DUPLICATE_CONFIG"; //$NON-NLS-1$
+ String IMG_DLCL_DELETE_CONFIG = "IMG_DLCL_DELETE_CONFIG"; //$NON-NLS-1$
+ String IMG_DLCL_FILTER_CONFIGS = "IMG_DLCL_FILTER_CONFIGS"; //$NON-NLS-1$
+ String IMG_DLCL_NEW_PROTO = "IMG_DLCL_NEW_PROTO"; //$NON-NLS-1$
+ String IMG_DLCL_LINK_PROTO = "IMG_DLCL_LINK_PROTO"; //$NON-NLS-1$
+ String IMG_DLCL_UNLINK_PROTO = "IMG_DLCL_UNLINK_PROTO"; //$NON-NLS-1$
+ String IMG_DLCL_RESET_PROTO = "IMG_DLCL_RESET_PROTO"; //$NON-NLS-1$
+ String IMG_DLCL_SUSPEND = "IMG_DLCL_SUSPEND"; //$NON-NLS-1$
+ String IMG_DLCL_RESUME = "IMG_DLCL_RESUME"; //$NON-NLS-1$
+ String IMG_DLCL_STEP_RETURN = "IMG_DLCL_STEP_RETURN"; //$NON-NLS-1$
+ String IMG_DLCL_STEP_OVER = "IMG_DLCL_STEP_OVER"; //$NON-NLS-1$
+ String IMG_DLCL_STEP_INTO = "IMG_DLCL_STEP_INTO"; //$NON-NLS-1$
+ String IMG_DLCL_TERMINATE_AND_REMOVE = "IMG_DLCL_TERMINATE_AND_REMOVE"; //$NON-NLS-1$
+ String IMG_DLCL_TERMINATE_ALL = "IMG_DLCL_TERMINATE_ALL"; //$NON-NLS-1$
+ String IMG_DLCL_TERMINATE_AND_RELAUNCH = "IMG_DLCL_TERMINATE_AND_RELAUNCH"; //$NON-NLS-1$
+ String IMG_DLCL_TOGGLE_STEP_FILTERS = "IMG_DLCL_TOGGLE_STEP_FILTERS"; //$NON-NLS-1$
+ String IMG_DLCL_NEXT_THREAD = "IMG_DLCL_NEXT_THREAD"; //$NON-NLS-1$
+ String IMG_DLCL_PREVIOUS_THREAD = "IMG_DLCL_PREVIOUS_THREAD"; //$NON-NLS-1$
+ String IMG_DLCL_RESTART = "IMG_DLCL_RESTART"; //$NON-NLS-1$
String IMG_DLCL_EXPORT_CONFIG = "IMG_DLCL_EXPORT_CONFIG"; //$NON-NLS-1$
- //TODO: Move this IDebugUIConstants. Created too late in 3.2 cycle to add API.
- //The enabled icon is already API.
- String IMG_DLCL_DISCONNECT= "IMG_DLCL_DISCONNECT"; //$NON-NLS-1$
-
- // enabled local tool images
- String IMG_ELCL_LOCK= "IMG_ELCL_LOCK"; //$NON-NLS-1$
- String IMG_ELCL_DETAIL_PANE= "IMG_ELCL_DETAIL_PANE"; //$NON-NLS-1$
- String IMG_ELCL_CHANGE_VARIABLE_VALUE= "IMG_ELCL_CHANGE_VARIABLE_VALUE"; //$NON-NLS-1$
- String IMG_ELCL_TYPE_NAMES= "IMG_ELCL_TYPE_NAMES"; //$NON-NLS-1$
- String IMG_ELCL_SHOW_LOGICAL_STRUCTURE= "IMG_ELCL_SHOW_LOGICAL_STRUCTURE"; //$NON-NLS-1$
- String IMG_ELCL_DETAIL_PANE_UNDER= "IMG_ELCL_DETAIL_PANE_UNDER"; //$NON-NLS-1$
- String IMG_ELCL_DETAIL_PANE_RIGHT= "IMG_ELCL_DETAIL_PANE_RIGHT"; //$NON-NLS-1$
- String IMG_ELCL_DETAIL_PANE_HIDE= "IMG_ELCL_DETAIL_PANE_HIDE"; //$NON-NLS-1$
- String IMG_ELCL_DETAIL_PANE_AUTO= "IMG_ELCL_DETAIL_PANE_AUTO"; //$NON-NLS-1$
- String IMG_ELCL_COLLAPSE_ALL = "IMG_ELCL_COLLAPSE_ALL"; //$NON-NLS-1$
- String IMG_ELCL_TERMINATE = "IMG_ELCL_TERMINATE"; //$NON-NLS-1$
- String IMG_SRC_LOOKUP_MENU_ELCL = "IMG_SRC_LOOKUP_MENU_ENABLED"; //$NON-NLS-1$
- String IMG_ELCL_MONITOR_EXPRESSION= "IMG_ELCL_MONITOR_EXPRESSION"; //$NON-NLS-1$
- String IMG_ELCL_REMOVE_MEMORY= "IMG_ELCL_REMOVE_MEMORY"; //$NON-NLS-1$
- String IMG_ELCL_RESET_MEMORY= "IMG_ELCL_RESET_MEMORY"; //$NON-NLS-1$
- String IMG_ELCL_COPY_VIEW_TO_CLIPBOARD= "IMG_ELCL_COPY_VIEW_TO_CLIPBOARD"; //$NON-NLS-1$
- String IMG_ELCL_PRINT_TOP_VIEW_TAB= "IMG_ELCL_PRINT_TOP_VIEW_TAB"; //$NON-NLS-1$
- String IMG_ELCL_REMOVE_ALL = "IMG_ELCL_REMOVE_ALL"; //$NON-NLS-1$
- String IMG_ELCL_REMOVE = "IMG_ELCL_REMOVE"; //$NON-NLS-1$
- String IMG_ELCL_HIERARCHICAL = "IMG_ELCL_HIERARCHICAL"; //$NON-NLS-1$
- String IMG_ELCL_HELP = "IMG_ELCL_HELP"; //$NON-NLS-1$
- String IMG_ELCL_NEW_CONFIG = "IMG_ELCL_NEW_CONFIG"; //$NON-NLS-1$
- String IMG_ELCL_DELETE_CONFIG = "IMG_ELCL_DELETE_CONFIG"; //$NON-NLS-1$
- String IMG_ELCL_FILTER_CONFIGS = "IMG_ELCL_FILTER_CONFIGS"; //$NON-NLS-1$
- String IMG_ELCL_DUPLICATE_CONFIG = "IMG_ELCL_DUPLICATE_CONFIG"; //$NON-NLS-1$
- String IMG_ELCL_NEW_PROTO = "IMG_ELCL_NEW_PROTO"; //$NON-NLS-1$
- String IMG_ELCL_LINK_PROTO = "IMG_ELCL_LINK_PROTO"; //$NON-NLS-1$
- String IMG_ELCL_UNLINK_PROTO = "IMG_ELCL_UNLINK_PROTO"; //$NON-NLS-1$
- String IMG_ELCL_RESET_PROTO = "IMG_ELCL_RESET_PROTO"; //$NON-NLS-1$
- String IMG_ELCL_SUSPEND = "IMG_ELCL_SUSPEND"; //$NON-NLS-1$
- String IMG_ELCL_RESUME = "IMG_ELCL_RESUME"; //$NON-NLS-1$
- String IMG_ELCL_STEP_RETURN = "IMG_ELCL_STEP_RETURN"; //$NON-NLS-1$
- String IMG_ELCL_STEP_OVER = "IMG_ELCL_STEP_OVER"; //$NON-NLS-1$
- String IMG_ELCL_STEP_INTO = "IMG_ELCL_STEP_INTO"; //$NON-NLS-1$
- String IMG_ELCL_DROP_TO_FRAME = "IMG_ELCL_DROP_TO_FRAME"; //$NON-NLS-1$
- String IMG_ELCL_TERMINATE_AND_REMOVE = "IMG_ELCL_TERMINATE_AND_REMOVE"; //$NON-NLS-1$
- String IMG_ELCL_TERMINATE_ALL = "IMG_ELCL_TERMINATE_ALL"; //$NON-NLS-1$
- String IMG_ELCL_TERMINATE_AND_RELAUNCH = "IMG_ELCL_TERMINATE_AND_RELAUNCH"; //$NON-NLS-1$
- String IMG_ELCL_TOGGLE_STEP_FILTERS = "IMG_ELCL_TOGGLE_STEP_FILTERS"; //$NON-NLS-1$
- String IMG_ELCL_STANDARD_OUT = "IMG_ELCL_STANDARD_OUT"; //$NON-NLS-1$
- String IMG_ELCL_STANDARD_ERR = "IMG_ELCL_STANDARD_ERR"; //$NON-NLS-1$
- String IMG_ELCL_NEXT_THREAD = "IMG_ELCL_NEXT_THREAD"; //$NON-NLS-1$
- String IMG_ELCL_PREVIOUS_THREAD = "IMG_ELCL_PREVIOUS_THREAD"; //$NON-NLS-1$
- String IMG_ELCL_RESTART = "IMG_ELCL_RESTART"; //$NON-NLS-1$
- String IMG_ELCL_DEBUG_VIEW_COMPACT_LAYOUT = "IMG_ELCL_DEBUG_VIEW_BREADCRUMB_LAYOUT"; //$NON-NLS-1$
+ //TODO: Move this IDebugUIConstants. Created too late in 3.2 cycle to add API.
+ //The enabled icon is already API.
+ String IMG_DLCL_DISCONNECT= "IMG_DLCL_DISCONNECT"; //$NON-NLS-1$
+
+ // enabled local tool images
+ String IMG_ELCL_LOCK= "IMG_ELCL_LOCK"; //$NON-NLS-1$
+ String IMG_ELCL_DETAIL_PANE= "IMG_ELCL_DETAIL_PANE"; //$NON-NLS-1$
+ String IMG_ELCL_CHANGE_VARIABLE_VALUE= "IMG_ELCL_CHANGE_VARIABLE_VALUE"; //$NON-NLS-1$
+ String IMG_ELCL_TYPE_NAMES= "IMG_ELCL_TYPE_NAMES"; //$NON-NLS-1$
+ String IMG_ELCL_SHOW_LOGICAL_STRUCTURE= "IMG_ELCL_SHOW_LOGICAL_STRUCTURE"; //$NON-NLS-1$
+ String IMG_ELCL_DETAIL_PANE_UNDER= "IMG_ELCL_DETAIL_PANE_UNDER"; //$NON-NLS-1$
+ String IMG_ELCL_DETAIL_PANE_RIGHT= "IMG_ELCL_DETAIL_PANE_RIGHT"; //$NON-NLS-1$
+ String IMG_ELCL_DETAIL_PANE_HIDE= "IMG_ELCL_DETAIL_PANE_HIDE"; //$NON-NLS-1$
+ String IMG_ELCL_DETAIL_PANE_AUTO= "IMG_ELCL_DETAIL_PANE_AUTO"; //$NON-NLS-1$
+ String IMG_ELCL_COLLAPSE_ALL = "IMG_ELCL_COLLAPSE_ALL"; //$NON-NLS-1$
+ String IMG_ELCL_TERMINATE = "IMG_ELCL_TERMINATE"; //$NON-NLS-1$
+ String IMG_SRC_LOOKUP_MENU_ELCL = "IMG_SRC_LOOKUP_MENU_ENABLED"; //$NON-NLS-1$
+ String IMG_ELCL_MONITOR_EXPRESSION= "IMG_ELCL_MONITOR_EXPRESSION"; //$NON-NLS-1$
+ String IMG_ELCL_REMOVE_MEMORY= "IMG_ELCL_REMOVE_MEMORY"; //$NON-NLS-1$
+ String IMG_ELCL_RESET_MEMORY= "IMG_ELCL_RESET_MEMORY"; //$NON-NLS-1$
+ String IMG_ELCL_COPY_VIEW_TO_CLIPBOARD= "IMG_ELCL_COPY_VIEW_TO_CLIPBOARD"; //$NON-NLS-1$
+ String IMG_ELCL_PRINT_TOP_VIEW_TAB= "IMG_ELCL_PRINT_TOP_VIEW_TAB"; //$NON-NLS-1$
+ String IMG_ELCL_REMOVE_ALL = "IMG_ELCL_REMOVE_ALL"; //$NON-NLS-1$
+ String IMG_ELCL_REMOVE = "IMG_ELCL_REMOVE"; //$NON-NLS-1$
+ String IMG_ELCL_HIERARCHICAL = "IMG_ELCL_HIERARCHICAL"; //$NON-NLS-1$
+ String IMG_ELCL_HELP = "IMG_ELCL_HELP"; //$NON-NLS-1$
+ String IMG_ELCL_NEW_CONFIG = "IMG_ELCL_NEW_CONFIG"; //$NON-NLS-1$
+ String IMG_ELCL_DELETE_CONFIG = "IMG_ELCL_DELETE_CONFIG"; //$NON-NLS-1$
+ String IMG_ELCL_FILTER_CONFIGS = "IMG_ELCL_FILTER_CONFIGS"; //$NON-NLS-1$
+ String IMG_ELCL_DUPLICATE_CONFIG = "IMG_ELCL_DUPLICATE_CONFIG"; //$NON-NLS-1$
+ String IMG_ELCL_NEW_PROTO = "IMG_ELCL_NEW_PROTO"; //$NON-NLS-1$
+ String IMG_ELCL_LINK_PROTO = "IMG_ELCL_LINK_PROTO"; //$NON-NLS-1$
+ String IMG_ELCL_UNLINK_PROTO = "IMG_ELCL_UNLINK_PROTO"; //$NON-NLS-1$
+ String IMG_ELCL_RESET_PROTO = "IMG_ELCL_RESET_PROTO"; //$NON-NLS-1$
+ String IMG_ELCL_SUSPEND = "IMG_ELCL_SUSPEND"; //$NON-NLS-1$
+ String IMG_ELCL_RESUME = "IMG_ELCL_RESUME"; //$NON-NLS-1$
+ String IMG_ELCL_STEP_RETURN = "IMG_ELCL_STEP_RETURN"; //$NON-NLS-1$
+ String IMG_ELCL_STEP_OVER = "IMG_ELCL_STEP_OVER"; //$NON-NLS-1$
+ String IMG_ELCL_STEP_INTO = "IMG_ELCL_STEP_INTO"; //$NON-NLS-1$
+ String IMG_ELCL_DROP_TO_FRAME = "IMG_ELCL_DROP_TO_FRAME"; //$NON-NLS-1$
+ String IMG_ELCL_TERMINATE_AND_REMOVE = "IMG_ELCL_TERMINATE_AND_REMOVE"; //$NON-NLS-1$
+ String IMG_ELCL_TERMINATE_ALL = "IMG_ELCL_TERMINATE_ALL"; //$NON-NLS-1$
+ String IMG_ELCL_TERMINATE_AND_RELAUNCH = "IMG_ELCL_TERMINATE_AND_RELAUNCH"; //$NON-NLS-1$
+ String IMG_ELCL_TOGGLE_STEP_FILTERS = "IMG_ELCL_TOGGLE_STEP_FILTERS"; //$NON-NLS-1$
+ String IMG_ELCL_STANDARD_OUT = "IMG_ELCL_STANDARD_OUT"; //$NON-NLS-1$
+ String IMG_ELCL_STANDARD_ERR = "IMG_ELCL_STANDARD_ERR"; //$NON-NLS-1$
+ String IMG_ELCL_NEXT_THREAD = "IMG_ELCL_NEXT_THREAD"; //$NON-NLS-1$
+ String IMG_ELCL_PREVIOUS_THREAD = "IMG_ELCL_PREVIOUS_THREAD"; //$NON-NLS-1$
+ String IMG_ELCL_RESTART = "IMG_ELCL_RESTART"; //$NON-NLS-1$
+ String IMG_ELCL_DEBUG_VIEW_COMPACT_LAYOUT = "IMG_ELCL_DEBUG_VIEW_BREADCRUMB_LAYOUT"; //$NON-NLS-1$
String IMG_ELCL_EXPORT_CONFIG = "IMG_ELCL_EXPORT_CONFIG"; //$NON-NLS-1$
- String IMG_OBJS_COMMON_TAB = "IMG_OBJS_COMMON_TAB"; //$NON-NLS-1$
- String IMG_OBJS_REFRESH_TAB = "IMG_OBJS_REFRESH_TAB"; //$NON-NLS-1$
- String IMG_OBJS_PERSPECTIVE_TAB = "IMG_OBJS_PERSPECTIVE_TAB"; //$NON-NLS-1$
- String IMG_OBJS_ARRAY_PARTITION = "IMG_OBJS_ARRAY_PARTITION"; //$NON-NLS-1$
- String IMG_SRC_LOOKUP_TAB = "IMG_SRC_LOOKUP_TAB"; //$NON-NLS-1$
- String IMG_OBJECT_MEMORY_CHANGED="IMG_OBJECT_MEMORY_CHANGED"; //$NON-NLS-1$
- String IMG_OBJECT_MEMORY="IMG_OBJECT_MEMORY"; //$NON-NLS-1$
- String IMG_OBJS_BREAKPOINT_TYPE="IMG_OBJ_BREAKPOINT_TYPE"; //$NON-NLS-1$
- String IMG_OBJS_LAUNCH_GROUP = "IMG_OBJ_LAUNCH_GROUP"; //$NON-NLS-1$
- String IMG_OBJS_CHECK = "IMG_OBJS_CHECK"; //$NON-NLS-1$
- String IMG_OBJS_UNCHECK = "IMG_OBJS_UNCHECK"; //$NON-NLS-1$
- String IMG_OBJS_PROTO_TAB = "IMG_OBJS_PROTO_TAB"; //$NON-NLS-1$
-
- // wizard images
- String IMG_WIZBAN_IMPORT_BREAKPOINTS = "IMG_WIZBAN_IMPORT_BREAKPOINTS"; //$NON-NLS-1$
- String IMG_WIZBAN_EXPORT_BREAKPOINTS = "IMG_WIZBAN_EXPORT_BREAKPOINTS"; //$NON-NLS-1$
- String IMG_WIZBAN_IMPORT_CONFIGS = "IMG_WIZBAN_IMPORT_CONFIGS"; //$NON-NLS-1$
- String IMG_WIZBAN_EXPORT_CONFIGS = "IMG_WIZBAN_EXPORT_CONFIGS"; //$NON-NLS-1$
- String IMG_ADD_SRC_LOC_WIZ = "IMG_ADD_SRC_LOCATION"; //$NON-NLS-1$
- String IMG_EDIT_SRC_LOC_WIZ = "IMG_EDIT_SRC_LOCATION"; //$NON-NLS-1$
- String IMG_ADD_SRC_DIR_WIZ = "IMG_ADD_SRC_DIRECTORY"; //$NON-NLS-1$
- String IMG_EDIT_SRC_DIR_WIZ = "IMG_EDIT_SRC_DIRECTORY"; //$NON-NLS-1$
-
- // internal preferences
- /**
- * XML for perspective settings - see PerspectiveManager.
- * @since 3.0
- */
- String PREF_LAUNCH_PERSPECTIVES = IDebugUIConstants.PLUGIN_ID + ".PREF_LAUNCH_PERSPECTIVES"; //$NON-NLS-1$
-
- /**
- * Preference for enabling/disabling launch configuration filtering based on project accessibility status
- *
- * @since 3.2
- */
- String PREF_FILTER_LAUNCH_CLOSED = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_LAUNCH_CLOSED"; //$NON-NLS-1$
-
- /**
- * Preference for enabling/disabling launch configuration filtering based on project context
- *
- * @since 3.2
- */
- String PREF_FILTER_LAUNCH_DELETED = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_LAUNCH_DELETED"; //$NON-NLS-1$
-
- /**
- * Preference for enabling/disabling filtering based on selected items from the launch configuration type table
- * @since 3.2
- */
- String PREF_FILTER_LAUNCH_TYPES = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_LAUNCH_TYPES"; //$NON-NLS-1$
-
- /**
- * Preference that saves which launch configuration types have been checked on the Launch Configurations pref page
- * @since 3.2
- */
- String PREF_FILTER_TYPE_LIST = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_TYPE_LIST"; //$NON-NLS-1$
-
- /**
- * Preference for filtering launch configurations based on the currently active working sets
- * @since 3.2
- */
- String PREF_FILTER_WORKING_SETS = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_WORKING_SETS"; //$NON-NLS-1$
-
- /**
- * Transparent overlay image identifier.
- */
- String IMG_OVR_TRANSPARENT = "IMG_OVR_TRANSPARENT"; //$NON-NLS-1$
+ String IMG_OBJS_COMMON_TAB = "IMG_OBJS_COMMON_TAB"; //$NON-NLS-1$
+ String IMG_OBJS_REFRESH_TAB = "IMG_OBJS_REFRESH_TAB"; //$NON-NLS-1$
+ String IMG_OBJS_PERSPECTIVE_TAB = "IMG_OBJS_PERSPECTIVE_TAB"; //$NON-NLS-1$
+ String IMG_OBJS_ARRAY_PARTITION = "IMG_OBJS_ARRAY_PARTITION"; //$NON-NLS-1$
+ String IMG_SRC_LOOKUP_TAB = "IMG_SRC_LOOKUP_TAB"; //$NON-NLS-1$
+ String IMG_OBJECT_MEMORY_CHANGED="IMG_OBJECT_MEMORY_CHANGED"; //$NON-NLS-1$
+ String IMG_OBJECT_MEMORY="IMG_OBJECT_MEMORY"; //$NON-NLS-1$
+ String IMG_OBJS_BREAKPOINT_TYPE="IMG_OBJ_BREAKPOINT_TYPE"; //$NON-NLS-1$
+ String IMG_OBJS_LAUNCH_GROUP = "IMG_OBJ_LAUNCH_GROUP"; //$NON-NLS-1$
+ String IMG_OBJS_CHECK = "IMG_OBJS_CHECK"; //$NON-NLS-1$
+ String IMG_OBJS_UNCHECK = "IMG_OBJS_UNCHECK"; //$NON-NLS-1$
+ String IMG_OBJS_PROTO_TAB = "IMG_OBJS_PROTO_TAB"; //$NON-NLS-1$
+
+ // wizard images
+ String IMG_WIZBAN_IMPORT_BREAKPOINTS = "IMG_WIZBAN_IMPORT_BREAKPOINTS"; //$NON-NLS-1$
+ String IMG_WIZBAN_EXPORT_BREAKPOINTS = "IMG_WIZBAN_EXPORT_BREAKPOINTS"; //$NON-NLS-1$
+ String IMG_WIZBAN_IMPORT_CONFIGS = "IMG_WIZBAN_IMPORT_CONFIGS"; //$NON-NLS-1$
+ String IMG_WIZBAN_EXPORT_CONFIGS = "IMG_WIZBAN_EXPORT_CONFIGS"; //$NON-NLS-1$
+ String IMG_ADD_SRC_LOC_WIZ = "IMG_ADD_SRC_LOCATION"; //$NON-NLS-1$
+ String IMG_EDIT_SRC_LOC_WIZ = "IMG_EDIT_SRC_LOCATION"; //$NON-NLS-1$
+ String IMG_ADD_SRC_DIR_WIZ = "IMG_ADD_SRC_DIRECTORY"; //$NON-NLS-1$
+ String IMG_EDIT_SRC_DIR_WIZ = "IMG_EDIT_SRC_DIRECTORY"; //$NON-NLS-1$
+
+ // internal preferences
+ /**
+ * XML for perspective settings - see PerspectiveManager.
+ * @since 3.0
+ */
+ String PREF_LAUNCH_PERSPECTIVES = IDebugUIConstants.PLUGIN_ID + ".PREF_LAUNCH_PERSPECTIVES"; //$NON-NLS-1$
+
+ /**
+ * Preference for enabling/disabling launch configuration filtering based on project accessibility status
+ *
+ * @since 3.2
+ */
+ String PREF_FILTER_LAUNCH_CLOSED = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_LAUNCH_CLOSED"; //$NON-NLS-1$
+
+ /**
+ * Preference for enabling/disabling launch configuration filtering based on project context
+ *
+ * @since 3.2
+ */
+ String PREF_FILTER_LAUNCH_DELETED = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_LAUNCH_DELETED"; //$NON-NLS-1$
+
+ /**
+ * Preference for enabling/disabling filtering based on selected items from the launch configuration type table
+ * @since 3.2
+ */
+ String PREF_FILTER_LAUNCH_TYPES = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_LAUNCH_TYPES"; //$NON-NLS-1$
+
+ /**
+ * Preference that saves which launch configuration types have been checked on the Launch Configurations pref page
+ * @since 3.2
+ */
+ String PREF_FILTER_TYPE_LIST = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_TYPE_LIST"; //$NON-NLS-1$
+
+ /**
+ * Preference for filtering launch configurations based on the currently active working sets
+ * @since 3.2
+ */
+ String PREF_FILTER_WORKING_SETS = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_WORKING_SETS"; //$NON-NLS-1$
+
+ /**
+ * Transparent overlay image identifier.
+ */
+ String IMG_OVR_TRANSPARENT = "IMG_OVR_TRANSPARENT"; //$NON-NLS-1$
/**
* Logical Structure overlay image identifier.
*/
String IMG_OVR_SHOW_LOGICAL_STRUCTURE = "IMG_OVR_SHOW_LOGICAL_STRUCTURE"; //$NON-NLS-1$
- /**
- * Editor Id for the "Source Not Found" editor
- */
- String ID_SOURCE_NOT_FOUND_EDITOR = "org.eclipse.debug.ui.NoSourceFoundEditor"; //$NON-NLS-1$
-
- /**
- * Boolean preference indicating if contextual launch options should be visible
- * to the user rather than the "run as" menu.
- *
- * @since 3.3.0
- * CONTEXTLAUNCHING
- */
- String PREF_USE_CONTEXTUAL_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".UseContextualLaunch"; //$NON-NLS-1$
-
- /**
- * Boolean preference indicating that if the selected resource is not launchable, then we should
- * launch the last configuration that was launched.
- *
- * @since 3.3.0
- * CONTEXTLAUNCHING
- */
- String PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE = IDebugUIConstants.PLUGIN_ID + ".LaunchLastIfNotLaunchable"; //$NON-NLS-1$
-
- /**
- * Boolean preference indicating if we should always consider the parent project when
- * a selected context is not runnable
- *
- * @since 3.3.0
- * CONTEXTLAUNCHING
- */
- String PREF_LAUNCH_PARENT_PROJECT = IDebugUIConstants.PLUGIN_ID + ".LaunchParentProject"; //$NON-NLS-1$
-
- /**
- * Boolean preference indicating if the user should be prompted prior to removing a launch configuration
- * from the launch history drop down
- *
- * @since 3.4
- */
- String PREF_REMOVE_FROM_LAUNCH_HISTORY = IDebugUIConstants.PLUGIN_ID + ".RemoveFromLaunchHistory"; //$NON-NLS-1$
-
- /**
- * String preference controlling whether editors are saved before launching.
- * Valid values are either "always", "never", or "prompt".
- * If "always" or "never", launching will save editors (or not) automatically.
- * If "prompt", the user will be prompted each time.
- *
- * @since 3.0
- */
- String PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".save_dirty_editors_before_launch"; //$NON-NLS-1$
-
- /**
- * Preference specifying that all launches should be DEBUG_MODE if breakpoints exist in the workspace
- * @since 3.0
- */
- String PREF_RELAUNCH_IN_DEBUG_MODE = IDebugUIConstants.PLUGIN_ID + ".relaunch_in_debug_mode"; //$NON-NLS-1$
-
- /**
- * Preference specifying that launches should continue when compile errors exist.
- * @since 3.0
- */
- String PREF_CONTINUE_WITH_COMPILE_ERROR = IDebugUIConstants.PLUGIN_ID + ".cancel_launch_with_compile_errors"; //$NON-NLS-1$
-
- /**
- * Boolean preference controlling whether the debugger will force activate the debug
- * view when a breakpoint is hit.
- *
- * @since 3.0
- */
- String PREF_ACTIVATE_DEBUG_VIEW= IDebugUIConstants.PLUGIN_ID + ".activate_debug_view"; //$NON-NLS-1$
-
- /**
- * String preference controlling whether the debugger switching to
- * the associated perspective when launching.
- * Valid values are either "always", "never", or "prompt".
- * If "always" or "never", launching will switch perspectives (or not) automatically.
- * If "prompt", the user will be prompted each time.
- *
- * @since 3.0
- */
- String PREF_SWITCH_TO_PERSPECTIVE= IDebugUIConstants.PLUGIN_ID + ".switch_to_perspective"; //$NON-NLS-1$
-
- /**
- * String preference controlling whether the debugger switching to
- * the associated perspective when a launch suspends.
- * Valid values are either "always", "never", or "prompt".
- * If "always" or "never", suspension will switch perspectives (or not) automatically.
- * If "prompt", the user will be prompted each time.
- *
- * @since 3.0
- */
- String PREF_SWITCH_PERSPECTIVE_ON_SUSPEND= IDebugUIConstants.PLUGIN_ID + ".switch_perspective_on_suspend"; //$NON-NLS-1$
+ /**
+ * Editor Id for the "Source Not Found" editor
+ */
+ String ID_SOURCE_NOT_FOUND_EDITOR = "org.eclipse.debug.ui.NoSourceFoundEditor"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference indicating if contextual launch options should be visible
+ * to the user rather than the "run as" menu.
+ *
+ * @since 3.3.0
+ * CONTEXTLAUNCHING
+ */
+ String PREF_USE_CONTEXTUAL_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".UseContextualLaunch"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference indicating that if the selected resource is not launchable, then we should
+ * launch the last configuration that was launched.
+ *
+ * @since 3.3.0
+ * CONTEXTLAUNCHING
+ */
+ String PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE = IDebugUIConstants.PLUGIN_ID + ".LaunchLastIfNotLaunchable"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference indicating if we should always consider the parent project when
+ * a selected context is not runnable
+ *
+ * @since 3.3.0
+ * CONTEXTLAUNCHING
+ */
+ String PREF_LAUNCH_PARENT_PROJECT = IDebugUIConstants.PLUGIN_ID + ".LaunchParentProject"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference indicating if the user should be prompted prior to removing a launch configuration
+ * from the launch history drop down
+ *
+ * @since 3.4
+ */
+ String PREF_REMOVE_FROM_LAUNCH_HISTORY = IDebugUIConstants.PLUGIN_ID + ".RemoveFromLaunchHistory"; //$NON-NLS-1$
+
+ /**
+ * String preference controlling whether editors are saved before launching.
+ * Valid values are either "always", "never", or "prompt".
+ * If "always" or "never", launching will save editors (or not) automatically.
+ * If "prompt", the user will be prompted each time.
+ *
+ * @since 3.0
+ */
+ String PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".save_dirty_editors_before_launch"; //$NON-NLS-1$
+
+ /**
+ * Preference specifying that all launches should be DEBUG_MODE if breakpoints exist in the workspace
+ * @since 3.0
+ */
+ String PREF_RELAUNCH_IN_DEBUG_MODE = IDebugUIConstants.PLUGIN_ID + ".relaunch_in_debug_mode"; //$NON-NLS-1$
+
+ /**
+ * Preference specifying that launches should continue when compile errors exist.
+ * @since 3.0
+ */
+ String PREF_CONTINUE_WITH_COMPILE_ERROR = IDebugUIConstants.PLUGIN_ID + ".cancel_launch_with_compile_errors"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference controlling whether the debugger will force activate the debug
+ * view when a breakpoint is hit.
+ *
+ * @since 3.0
+ */
+ String PREF_ACTIVATE_DEBUG_VIEW= IDebugUIConstants.PLUGIN_ID + ".activate_debug_view"; //$NON-NLS-1$
+
+ /**
+ * String preference controlling whether the debugger switching to
+ * the associated perspective when launching.
+ * Valid values are either "always", "never", or "prompt".
+ * If "always" or "never", launching will switch perspectives (or not) automatically.
+ * If "prompt", the user will be prompted each time.
+ *
+ * @since 3.0
+ */
+ String PREF_SWITCH_TO_PERSPECTIVE= IDebugUIConstants.PLUGIN_ID + ".switch_to_perspective"; //$NON-NLS-1$
+
+ /**
+ * String preference controlling whether the debugger switching to
+ * the associated perspective when a launch suspends.
+ * Valid values are either "always", "never", or "prompt".
+ * If "always" or "never", suspension will switch perspectives (or not) automatically.
+ * If "prompt", the user will be prompted each time.
+ *
+ * @since 3.0
+ */
+ String PREF_SWITCH_PERSPECTIVE_ON_SUSPEND= IDebugUIConstants.PLUGIN_ID + ".switch_perspective_on_suspend"; //$NON-NLS-1$
/**
* String preference controlling whether the debugger waits for a currently
@@ -328,135 +328,135 @@ public interface IInternalDebugUIConstants {
int ADD_UNIT_PER_LINE = 16; // number of addressable unit per line
int CHAR_PER_BYTE = 2; // number of characters to represent one byte
- /**
- * Memory view's rendering view pane identifier (value <code>"org.eclipse.debug.ui.MemoryView.RenderingViewPane"</code>).
- * @since 3.1
- */
- String ID_RENDERING_VIEW_PANE = RenderingViewPane.RENDERING_VIEW_PANE_ID;
-
- /**
- * Memory view's memory block tree viewer's identifier. (value <code>"org.eclipse.debug.ui.MemoryView.MemoryBlocksTreeViewPane"</code>).
- * @since 3.1
- */
- String ID_MEMORY_BLOCK_TREE_VIEWER = MemoryBlocksTreeViewPane.PANE_ID;
-
- /**
- * Memory view image identifier
- *
- * @since 3.0
- * */
- String IMG_CVIEW_MEMORY_VIEW= "IMG_CVIEW_MEMORY_VIEW"; //$NON-NLS-1$
-
-
- /**
- * Modules view image identifier
- *
- * @since 3.4
- * */
- String IMG_CVIEW_MODULES_VIEW= "IMG_CVIEW_MODULES_VIEW"; //$NON-NLS-1$
-
- /**
- * Boolean preference controlling whether the debug view tracks
- * views as the user manually opens/closes them for the purpose
- * of not automatically opening/closing such views.
- *
- * @since 3.0
- */
- String PREF_TRACK_VIEWS= IDebugUIConstants.PLUGIN_ID + ".track_views"; //$NON-NLS-1$
-
- /**
- * Comma separated list of view ids closed by the user, that have view context bindings.
- * @since 3.2
- */
- String PREF_USER_VIEW_BINDINGS = IDebugUIConstants.PLUGIN_ID + ".user_view_bindings"; //$NON-NLS-1$
-
- /**
- * Preference storing memento for the default breakpoint working set in
- * the breakpoints view.
- *
- * @since 3.1
- */
- String MEMENTO_BREAKPOINT_WORKING_SET_NAME = DebugUIPlugin.getUniqueIdentifier() + ".MEMENTO_BREAKPOINT_WORKING_SET_NAME"; //$NON-NLS-1$
-
- /**
- * Breakpoint working set identifier.
- *
- * @since 3.1
- * @deprecated There is an API equivalent constant that should be used, see
- * {@link IDebugUIConstants#BREAKPOINT_WORKINGSET_ID}
- */
+ /**
+ * Memory view's rendering view pane identifier (value <code>"org.eclipse.debug.ui.MemoryView.RenderingViewPane"</code>).
+ * @since 3.1
+ */
+ String ID_RENDERING_VIEW_PANE = RenderingViewPane.RENDERING_VIEW_PANE_ID;
+
+ /**
+ * Memory view's memory block tree viewer's identifier. (value <code>"org.eclipse.debug.ui.MemoryView.MemoryBlocksTreeViewPane"</code>).
+ * @since 3.1
+ */
+ String ID_MEMORY_BLOCK_TREE_VIEWER = MemoryBlocksTreeViewPane.PANE_ID;
+
+ /**
+ * Memory view image identifier
+ *
+ * @since 3.0
+ * */
+ String IMG_CVIEW_MEMORY_VIEW= "IMG_CVIEW_MEMORY_VIEW"; //$NON-NLS-1$
+
+
+ /**
+ * Modules view image identifier
+ *
+ * @since 3.4
+ * */
+ String IMG_CVIEW_MODULES_VIEW= "IMG_CVIEW_MODULES_VIEW"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference controlling whether the debug view tracks
+ * views as the user manually opens/closes them for the purpose
+ * of not automatically opening/closing such views.
+ *
+ * @since 3.0
+ */
+ String PREF_TRACK_VIEWS= IDebugUIConstants.PLUGIN_ID + ".track_views"; //$NON-NLS-1$
+
+ /**
+ * Comma separated list of view ids closed by the user, that have view context bindings.
+ * @since 3.2
+ */
+ String PREF_USER_VIEW_BINDINGS = IDebugUIConstants.PLUGIN_ID + ".user_view_bindings"; //$NON-NLS-1$
+
+ /**
+ * Preference storing memento for the default breakpoint working set in
+ * the breakpoints view.
+ *
+ * @since 3.1
+ */
+ String MEMENTO_BREAKPOINT_WORKING_SET_NAME = DebugUIPlugin.getUniqueIdentifier() + ".MEMENTO_BREAKPOINT_WORKING_SET_NAME"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint working set identifier.
+ *
+ * @since 3.1
+ * @deprecated There is an API equivalent constant that should be used, see
+ * {@link IDebugUIConstants#BREAKPOINT_WORKINGSET_ID}
+ */
@Deprecated String ID_BREAKPOINT_WORKINGSET = "org.eclipse.debug.ui.breakpointWorkingSet"; //$NON-NLS-1$
- /**
- * Address at the beginning of a page in a table rendering.
- * @since 3.1
- */
- String PROPERTY_PAGE_START_ADDRESS = "pageStart"; //$NON-NLS-1$
-
-
- /**
- * This constant is used as a "quick-fix" for the issue of breakpoint to working set
- * persistence when the state of a project changes.
- *
- * @since 3.2
- */
- String WORKING_SET_NAME = "workingset_name"; //$NON-NLS-1$
-
- /**
- * This constant is used as a "quick-fix" for the issue of breakpoint to working set
- * persistence when the state of a project changes.
- *
- * @since 3.2
- */
- String WORKING_SET_ID = "workingset_id"; //$NON-NLS-1$
-
- /**
- * Annotation type identifier for annotation of the an instruction
- * pointer with a dynamic image. Value is <code>org.eclipse.debug.ui.dynamicIP</code>,
- * identifying a <code>org.eclipse.ui.editors.markerAnnotationSpecification</code>
- * extension.
- *
- * @since 3.2
- */
- String ANNOTATION_TYPE_DYNAMIC_INSTRUCTION_POINTER = "org.eclipse.debug.ui.dynamicIP"; //$NON-NLS-1$
-
- /**
- * Identifier of the external tool builder launch category. Defined here since
- * external tools is actually a dependent plug-in.
- *
- * @since 3.4
- */
- String ID_EXTERNAL_TOOL_BUILDER_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools.builder"; //$NON-NLS-1$
-
- //themes
-
- /**
- * Theme color definition for process console background color.
- *
- * @since 3.4
- */
- String THEME_CONSOLE_COLOR_BACKGROUND= "org.eclipse.debug.ui.console.background"; //$NON-NLS-1$
-
- /**
- * Theme color definition for process console standard out.
- *
- * @since 3.4
- */
- String THEME_CONSOLE_COLOR_STD_OUT= "org.eclipse.debug.ui.console.stream.out"; //$NON-NLS-1$
-
- /**
- * Theme color definition for process console standard in.
- *
- * @since 3.4
- */
- String THEME_CONSOLE_COLOR_STD_IN= "org.eclipse.debug.ui.console.stream.in"; //$NON-NLS-1$
-
- /**
- * Theme color definition for process console standard err.
- *
- * @since 3.4
- */
+ /**
+ * Address at the beginning of a page in a table rendering.
+ * @since 3.1
+ */
+ String PROPERTY_PAGE_START_ADDRESS = "pageStart"; //$NON-NLS-1$
+
+
+ /**
+ * This constant is used as a "quick-fix" for the issue of breakpoint to working set
+ * persistence when the state of a project changes.
+ *
+ * @since 3.2
+ */
+ String WORKING_SET_NAME = "workingset_name"; //$NON-NLS-1$
+
+ /**
+ * This constant is used as a "quick-fix" for the issue of breakpoint to working set
+ * persistence when the state of a project changes.
+ *
+ * @since 3.2
+ */
+ String WORKING_SET_ID = "workingset_id"; //$NON-NLS-1$
+
+ /**
+ * Annotation type identifier for annotation of the an instruction
+ * pointer with a dynamic image. Value is <code>org.eclipse.debug.ui.dynamicIP</code>,
+ * identifying a <code>org.eclipse.ui.editors.markerAnnotationSpecification</code>
+ * extension.
+ *
+ * @since 3.2
+ */
+ String ANNOTATION_TYPE_DYNAMIC_INSTRUCTION_POINTER = "org.eclipse.debug.ui.dynamicIP"; //$NON-NLS-1$
+
+ /**
+ * Identifier of the external tool builder launch category. Defined here since
+ * external tools is actually a dependent plug-in.
+ *
+ * @since 3.4
+ */
+ String ID_EXTERNAL_TOOL_BUILDER_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools.builder"; //$NON-NLS-1$
+
+ //themes
+
+ /**
+ * Theme color definition for process console background color.
+ *
+ * @since 3.4
+ */
+ String THEME_CONSOLE_COLOR_BACKGROUND= "org.eclipse.debug.ui.console.background"; //$NON-NLS-1$
+
+ /**
+ * Theme color definition for process console standard out.
+ *
+ * @since 3.4
+ */
+ String THEME_CONSOLE_COLOR_STD_OUT= "org.eclipse.debug.ui.console.stream.out"; //$NON-NLS-1$
+
+ /**
+ * Theme color definition for process console standard in.
+ *
+ * @since 3.4
+ */
+ String THEME_CONSOLE_COLOR_STD_IN= "org.eclipse.debug.ui.console.stream.in"; //$NON-NLS-1$
+
+ /**
+ * Theme color definition for process console standard err.
+ *
+ * @since 3.4
+ */
String THEME_CONSOLE_COLOR_STD_ERR = "org.eclipse.debug.ui.console.stream.err"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java
index c9132420d..f5d1db073 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java
@@ -95,11 +95,11 @@ public class InstructionPointerManager{
IDocumentProvider docProvider = textEditor.getDocumentProvider();
IEditorInput editorInput = textEditor.getEditorInput();
- // If there is no annotation model, there's nothing more to do
- IAnnotationModel annModel = docProvider.getAnnotationModel(editorInput);
- if (annModel == null) {
- return;
- }
+ // If there is no annotation model, there's nothing more to do
+ IAnnotationModel annModel = docProvider.getAnnotationModel(editorInput);
+ if (annModel == null) {
+ return;
+ }
// Create the Position object that specifies a location for the annotation
Position position = null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java
index 8bf88af20..cdc78ef3b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java
@@ -127,17 +127,17 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi
public Image getImage(Object element) {
initImageRegistry();
Image image = getPresentation().getImage(element);
- if (image == null) {
- image = getDefaultImage(element);
- }
- if (image != null) {
- int flags= computeAdornmentFlags(element);
- if (flags > 0) {
- CompositeDebugImageDescriptor descriptor= new CompositeDebugImageDescriptor(image, flags);
- return DebugUIPlugin.getImageDescriptorRegistry().get(descriptor);
- }
- }
- return image;
+ if (image == null) {
+ image = getDefaultImage(element);
+ }
+ if (image != null) {
+ int flags= computeAdornmentFlags(element);
+ if (flags > 0) {
+ CompositeDebugImageDescriptor descriptor= new CompositeDebugImageDescriptor(image, flags);
+ return DebugUIPlugin.getImageDescriptorRegistry().get(descriptor);
+ }
+ }
+ return image;
}
/**
@@ -150,81 +150,81 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi
}
/**
- * Computes and return common adornment flags for the given element.
- *
- * @param element
- * @return adornment flags defined in CompositeDebugImageDescriptor
- */
- private int computeAdornmentFlags(Object element) {
- if (element instanceof IBreakpoint) {
- if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
- return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
- }
- }
- return 0;
- }
-
- /**
- * Returns a default text label for the debug element
- */
- protected String getDefaultText(Object element) {
- return DebugUIPlugin.getDefaultLabelProvider().getText(element);
- }
-
- /**
- * Returns a default image for the debug element
- */
- protected Image getDefaultImage(Object element) {
- return DebugUIPlugin.getDefaultLabelProvider().getImage(element);
- }
-
- /**
+ * Computes and return common adornment flags for the given element.
+ *
+ * @param element
+ * @return adornment flags defined in CompositeDebugImageDescriptor
+ */
+ private int computeAdornmentFlags(Object element) {
+ if (element instanceof IBreakpoint) {
+ if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
+ return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Returns a default text label for the debug element
+ */
+ protected String getDefaultText(Object element) {
+ return DebugUIPlugin.getDefaultLabelProvider().getText(element);
+ }
+
+ /**
+ * Returns a default image for the debug element
+ */
+ protected Image getDefaultImage(Object element) {
+ return DebugUIPlugin.getDefaultLabelProvider().getImage(element);
+ }
+
+ /**
* @see IDebugModelPresentation#getText(Object)
*/
@Override
public String getText(Object element) {
- if (!(element instanceof IndexedVariablePartition)) {
- // Attempt to delegate
- String text = getPresentation().getText(element);
- if (text != null) {
- return text;
- }
- }
- // If no delegate returned a text label, use the default
- if (showVariableTypeNames()) {
- try {
- if (element instanceof IExpression) {
- StringBuilder buf = new StringBuilder();
- IValue value = ((IExpression)element).getValue();
- if (value != null) {
- String type = value.getReferenceTypeName();
- if (type != null && type.length() > 0) {
- buf.append(type);
- buf.append(' ');
- }
- }
- buf.append(getDefaultText(element));
- return buf.toString();
- } else if (element instanceof IVariable) {
- return new StringBuffer(((IVariable)element).getValue().getReferenceTypeName()).append(' ').append(getDefaultText(element)).toString();
- }
- } catch (DebugException de) {
- DebugUIPlugin.log(de);
- }
- }
- return getDefaultText(element);
- }
-
- /**
- * Whether or not to show variable type names.
- * This option is configured per model presentation.
- * This allows this option to be set per view, for example.
- */
- protected boolean showVariableTypeNames() {
+ if (!(element instanceof IndexedVariablePartition)) {
+ // Attempt to delegate
+ String text = getPresentation().getText(element);
+ if (text != null) {
+ return text;
+ }
+ }
+ // If no delegate returned a text label, use the default
+ if (showVariableTypeNames()) {
+ try {
+ if (element instanceof IExpression) {
+ StringBuilder buf = new StringBuilder();
+ IValue value = ((IExpression)element).getValue();
+ if (value != null) {
+ String type = value.getReferenceTypeName();
+ if (type != null && type.length() > 0) {
+ buf.append(type);
+ buf.append(' ');
+ }
+ }
+ buf.append(getDefaultText(element));
+ return buf.toString();
+ } else if (element instanceof IVariable) {
+ return new StringBuffer(((IVariable)element).getValue().getReferenceTypeName()).append(' ').append(getDefaultText(element)).toString();
+ }
+ } catch (DebugException de) {
+ DebugUIPlugin.log(de);
+ }
+ }
+ return getDefaultText(element);
+ }
+
+ /**
+ * Whether or not to show variable type names.
+ * This option is configured per model presentation.
+ * This allows this option to be set per view, for example.
+ */
+ protected boolean showVariableTypeNames() {
Boolean show = (Boolean) fAttributes.get(DISPLAY_VARIABLE_TYPE_NAMES);
show = show == null ? Boolean.FALSE : show;
- return show.booleanValue();
- }
+ return show.booleanValue();
+ }
/**
* @see IDebugModelPresentation#computeDetail(IValue, IValueDetailListener)
@@ -293,7 +293,7 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi
}
ListenerList<ILabelProviderListener> listeners = fListeners;
if (listeners != null) {
- listeners.remove(listener);
+ listeners.remove(listener);
}
}
@@ -302,12 +302,12 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi
*/
protected IDebugModelPresentation getPresentation() {
if (fPresentation == null) {
- synchronized (this) {
- if (fPresentation != null) {
- // In the case that the synchronization is enforced, the "blocked" thread
- // should return the presentation configured by the "owning" thread.
- return fPresentation;
- }
+ synchronized (this) {
+ if (fPresentation != null) {
+ // In the case that the synchronization is enforced, the "blocked" thread
+ // should return the presentation configured by the "owning" thread.
+ return fPresentation;
+ }
try {
IDebugModelPresentation tempPresentation= (IDebugModelPresentation) DebugUIPlugin.createExtension(fConfig, "class"); //$NON-NLS-1$
// configure it
@@ -326,7 +326,7 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi
} catch (CoreException e) {
DebugUIPlugin.log(e);
}
- }
+ }
}
return fPresentation;
}
@@ -394,35 +394,35 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi
return fAttributes;
}
- @Override
+ @Override
public Color getForeground(Object element) {
- IDebugModelPresentation presentation = getPresentation();
- if (presentation instanceof IColorProvider) {
- IColorProvider colorProvider = (IColorProvider) presentation;
- return colorProvider.getForeground(element);
- }
- return null;
- }
-
- @Override
+ IDebugModelPresentation presentation = getPresentation();
+ if (presentation instanceof IColorProvider) {
+ IColorProvider colorProvider = (IColorProvider) presentation;
+ return colorProvider.getForeground(element);
+ }
+ return null;
+ }
+
+ @Override
public Color getBackground(Object element) {
- IDebugModelPresentation presentation = getPresentation();
- if (presentation instanceof IColorProvider) {
- IColorProvider colorProvider = (IColorProvider) presentation;
- return colorProvider.getBackground(element);
- }
- return null;
- }
-
- @Override
+ IDebugModelPresentation presentation = getPresentation();
+ if (presentation instanceof IColorProvider) {
+ IColorProvider colorProvider = (IColorProvider) presentation;
+ return colorProvider.getBackground(element);
+ }
+ return null;
+ }
+
+ @Override
public Font getFont(Object element) {
- IDebugModelPresentation presentation = getPresentation();
- if (presentation instanceof IFontProvider) {
- IFontProvider fontProvider = (IFontProvider) presentation;
- return fontProvider.getFont(element);
- }
- return null;
- }
+ IDebugModelPresentation presentation = getPresentation();
+ if (presentation instanceof IFontProvider) {
+ IFontProvider fontProvider = (IFontProvider) presentation;
+ return fontProvider.getFont(element);
+ }
+ return null;
+ }
@Override
public Annotation getInstructionPointerAnnotation(IEditorPart editorPart, IStackFrame frame) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java
index 4e7d834eb..c9e2932f4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java
@@ -305,13 +305,13 @@ public class MultipleInputDialog extends Dialog {
text.setData(FIELD_NAME, labelText);
text.addTraverseListener(new TraverseListener () {
- @Override
+ @Override
public void keyTraversed(TraverseEvent e) {
- if(e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.SHIFT) {
- e.doit = true;
- }
- }
- });
+ if(e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.SHIFT) {
+ e.doit = true;
+ }
+ }
+ });
// make sure rows are the same height on both panels.
label.setSize(label.getSize().x, text.getSize().y);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java
index 53c76a253..bb50f1fa2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResourceExtender.java
@@ -40,100 +40,100 @@ import org.eclipse.ui.IPathEditorInput;
*/
public class ResourceExtender extends PropertyTester {
- private static final String PROPERTY_MATCHES_PATTERN = "matchesPattern"; //$NON-NLS-1$
+ private static final String PROPERTY_MATCHES_PATTERN = "matchesPattern"; //$NON-NLS-1$
- private static final String PROJECT_NATURE = "projectNature"; //$NON-NLS-1$
+ private static final String PROJECT_NATURE = "projectNature"; //$NON-NLS-1$
- private static final String PROPERTY_MATCHES_CONTENT_TYPE = "matchesContentType"; //$NON-NLS-1$
+ private static final String PROPERTY_MATCHES_CONTENT_TYPE = "matchesContentType"; //$NON-NLS-1$
- @Override
+ @Override
public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- IResource resource = ((IAdaptable) receiver).getAdapter(IResource.class);
- if (resource == null) {
- if (PROPERTY_MATCHES_CONTENT_TYPE.equals(method)) {
- IPathEditorInput editorInput = ((IAdaptable) receiver).getAdapter(IPathEditorInput.class);
- if (editorInput != null) {
- IPath path= editorInput.getPath();
- File file= path.toFile();
- if (file.exists()) {
+ IResource resource = ((IAdaptable) receiver).getAdapter(IResource.class);
+ if (resource == null) {
+ if (PROPERTY_MATCHES_CONTENT_TYPE.equals(method)) {
+ IPathEditorInput editorInput = ((IAdaptable) receiver).getAdapter(IPathEditorInput.class);
+ if (editorInput != null) {
+ IPath path= editorInput.getPath();
+ File file= path.toFile();
+ if (file.exists()) {
try (FileReader reader = new FileReader(file)) {
- IContentType contentType= Platform.getContentTypeManager().getContentType((String)expectedValue);
- IContentDescription description= contentType.getDescriptionFor(reader, IContentDescription.ALL);
- if (description != null) {
- return matchesContentType(description.getContentType(), (String)expectedValue);
- }
- } catch (FileNotFoundException e) {
- return false;
- } catch (IOException e) {
- return false;
- }
- }
- }
- }
- } else {
- if (PROPERTY_MATCHES_PATTERN.equals(method)) {
- String fileName = resource.getName();
- String expected = (String) expectedValue;
- expected = expected.replaceAll("\\.", "\\\\."); //$NON-NLS-1$//$NON-NLS-2$
- expected = expected.replaceAll("\\*", "\\.\\*"); //$NON-NLS-1$//$NON-NLS-2$
- Pattern pattern = Pattern.compile(expected);
- boolean retVal = pattern.matcher(fileName).find();
- return retVal;
- } else if (PROJECT_NATURE.equals(method)) {
- try {
- IProject proj = resource.getProject();
- return proj != null && proj.isAccessible() && proj.hasNature((String) expectedValue);
- } catch (CoreException e) {
- return false;
- }
- } else if (PROPERTY_MATCHES_CONTENT_TYPE.equals(method)) {
- return matchesContentType(resource, (String) expectedValue);
- }
- }
- return false;
- }
+ IContentType contentType= Platform.getContentTypeManager().getContentType((String)expectedValue);
+ IContentDescription description= contentType.getDescriptionFor(reader, IContentDescription.ALL);
+ if (description != null) {
+ return matchesContentType(description.getContentType(), (String)expectedValue);
+ }
+ } catch (FileNotFoundException e) {
+ return false;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+ }
+ }
+ } else {
+ if (PROPERTY_MATCHES_PATTERN.equals(method)) {
+ String fileName = resource.getName();
+ String expected = (String) expectedValue;
+ expected = expected.replaceAll("\\.", "\\\\."); //$NON-NLS-1$//$NON-NLS-2$
+ expected = expected.replaceAll("\\*", "\\.\\*"); //$NON-NLS-1$//$NON-NLS-2$
+ Pattern pattern = Pattern.compile(expected);
+ boolean retVal = pattern.matcher(fileName).find();
+ return retVal;
+ } else if (PROJECT_NATURE.equals(method)) {
+ try {
+ IProject proj = resource.getProject();
+ return proj != null && proj.isAccessible() && proj.hasNature((String) expectedValue);
+ } catch (CoreException e) {
+ return false;
+ }
+ } else if (PROPERTY_MATCHES_CONTENT_TYPE.equals(method)) {
+ return matchesContentType(resource, (String) expectedValue);
+ }
+ }
+ return false;
+ }
- /**
- * Returns whether the given type or one of its base types matches the
- * given content type identifier.
- *
- * @param type content type or <code>null</code>
- * @param typeId content type identifier
- * @return
- */
- private boolean matchesContentType(IContentType type, String typeId) {
- while (type != null) {
- if (typeId.equals(type.getId())) {
- return true;
- }
- type = type.getBaseType();
- }
- return false;
- }
+ /**
+ * Returns whether the given type or one of its base types matches the
+ * given content type identifier.
+ *
+ * @param type content type or <code>null</code>
+ * @param typeId content type identifier
+ * @return
+ */
+ private boolean matchesContentType(IContentType type, String typeId) {
+ while (type != null) {
+ if (typeId.equals(type.getId())) {
+ return true;
+ }
+ type = type.getBaseType();
+ }
+ return false;
+ }
- /**
- * Returns whether or not the given file's content type matches the
- * specified content type.
- *
- * Content types are looked up in the content type registry.
- *
- * @return whether or not the given resource has the given content type
- */
- private boolean matchesContentType(IResource resource, String contentType) {
- if (resource == null || !(resource instanceof IFile) || !resource.exists()) {
- return false;
- }
- IFile file = (IFile) resource;
- IContentDescription description;
- try {
- description = file.getContentDescription();
- } catch (CoreException e) {
- return false;
- }
- if (description != null) {
- return matchesContentType(description.getContentType(), contentType);
- }
- return false;
- }
+ /**
+ * Returns whether or not the given file's content type matches the
+ * specified content type.
+ *
+ * Content types are looked up in the content type registry.
+ *
+ * @return whether or not the given resource has the given content type
+ */
+ private boolean matchesContentType(IResource resource, String contentType) {
+ if (resource == null || !(resource instanceof IFile) || !resource.exists()) {
+ return false;
+ }
+ IFile file = (IFile) resource;
+ IContentDescription description;
+ try {
+ description = file.getContentDescription();
+ } catch (CoreException e) {
+ return false;
+ }
+ if (description != null) {
+ return matchesContentType(description.getContentType(), contentType);
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTFactory.java
index e43c22b70..6139c95bd 100755
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTFactory.java
@@ -322,13 +322,13 @@ public class SWTFactory {
*
*/
public static Text createSingleText(Composite parent, int hspan) {
- Text t = new Text(parent, SWT.SINGLE | SWT.BORDER);
- t.setFont(parent.getFont());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = hspan;
- t.setLayoutData(gd);
- return t;
- }
+ Text t = new Text(parent, SWT.SINGLE | SWT.BORDER);
+ t.setFont(parent.getFont());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = hspan;
+ t.setLayoutData(gd);
+ return t;
+ }
/**
* Creates a new text widget
@@ -340,13 +340,13 @@ public class SWTFactory {
* @since 3.3
*/
public static Text createText(Composite parent, int style, int hspan, int fill) {
- Text t = new Text(parent, style);
- t.setFont(parent.getFont());
- GridData gd = new GridData(fill);
- gd.horizontalSpan = hspan;
- t.setLayoutData(gd);
- return t;
- }
+ Text t = new Text(parent, style);
+ t.setFont(parent.getFont());
+ GridData gd = new GridData(fill);
+ gd.horizontalSpan = hspan;
+ t.setLayoutData(gd);
+ return t;
+ }
/**
* Creates a new text widget
@@ -357,13 +357,13 @@ public class SWTFactory {
* @since 3.3
*/
public static Text createText(Composite parent, int style, int hspan) {
- Text t = new Text(parent, style);
- t.setFont(parent.getFont());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = hspan;
- t.setLayoutData(gd);
- return t;
- }
+ Text t = new Text(parent, style);
+ t.setFont(parent.getFont());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = hspan;
+ t.setLayoutData(gd);
+ return t;
+ }
/**
* Creates a new text widget
@@ -377,15 +377,15 @@ public class SWTFactory {
* @since 3.3
*/
public static Text createText(Composite parent, int style, int hspan, int width, int height, int fill) {
- Text t = new Text(parent, style);
- t.setFont(parent.getFont());
- GridData gd = new GridData(fill);
- gd.horizontalSpan = hspan;
- gd.widthHint = width;
- gd.heightHint = height;
- t.setLayoutData(gd);
- return t;
- }
+ Text t = new Text(parent, style);
+ t.setFont(parent.getFont());
+ GridData gd = new GridData(fill);
+ gd.horizontalSpan = hspan;
+ gd.widthHint = width;
+ gd.heightHint = height;
+ t.setLayoutData(gd);
+ return t;
+ }
/**
* Creates a new styled text widget
@@ -419,14 +419,14 @@ public class SWTFactory {
* @since 3.6
*/
public static Text createText(Composite parent, int style, int hspan, String text) {
- Text t = new Text(parent, style);
- t.setFont(parent.getFont());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = hspan;
- t.setLayoutData(gd);
- t.setText(text);
- return t;
- }
+ Text t = new Text(parent, style);
+ t.setFont(parent.getFont());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = hspan;
+ t.setLayoutData(gd);
+ t.setText(text);
+ return t;
+ }
/**
* Creates a Group widget
@@ -440,15 +440,15 @@ public class SWTFactory {
*
*/
public static Group createGroup(Composite parent, String text, int columns, int hspan, int fill) {
- Group g = new Group(parent, SWT.NONE);
- g.setLayout(new GridLayout(columns, false));
- g.setText(text);
- g.setFont(parent.getFont());
- GridData gd = new GridData(fill);
+ Group g = new Group(parent, SWT.NONE);
+ g.setLayout(new GridLayout(columns, false));
+ g.setText(text);
+ g.setFont(parent.getFont());
+ GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
- g.setLayoutData(gd);
- return g;
- }
+ g.setLayoutData(gd);
+ return g;
+ }
/**
* Creates a Composite widget
@@ -461,14 +461,14 @@ public class SWTFactory {
* @since 3.3
*/
public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill) {
- Composite g = new Composite(parent, SWT.NONE);
- g.setLayout(new GridLayout(columns, false));
- g.setFont(font);
- GridData gd = new GridData(fill);
+ Composite g = new Composite(parent, SWT.NONE);
+ g.setLayout(new GridLayout(columns, false));
+ g.setFont(font);
+ GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
- g.setLayoutData(gd);
- return g;
- }
+ g.setLayoutData(gd);
+ return g;
+ }
/**
* Creates an ExpandibleComposite widget
@@ -503,12 +503,12 @@ public class SWTFactory {
*/
public static Composite createComposite(Composite parent, int columns, int hspan, int fill) {
Composite g = new Composite(parent, SWT.NONE);
- g.setLayout(new GridLayout(columns, false));
- g.setFont(parent.getFont());
- GridData gd = new GridData(fill);
+ g.setLayout(new GridLayout(columns, false));
+ g.setFont(parent.getFont());
+ GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
- g.setLayoutData(gd);
- return g;
+ g.setLayoutData(gd);
+ return g;
}
/**
@@ -561,12 +561,12 @@ public class SWTFactory {
GridLayout layout = new GridLayout(columns, false);
layout.marginWidth = marginwidth;
layout.marginHeight = marginheight;
- g.setLayout(layout);
- g.setFont(font);
- GridData gd = new GridData(fill);
+ g.setLayout(layout);
+ g.setFont(font);
+ GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
- g.setLayoutData(gd);
- return g;
+ g.setLayoutData(gd);
+ return g;
}
/**
@@ -585,9 +585,9 @@ public class SWTFactory {
ViewForm form = new ViewForm(parent, style);
form.setFont(parent.getFont());
GridLayout layout = new GridLayout(cols, false);
- layout.marginWidth = marginwidth;
+ layout.marginWidth = marginwidth;
layout.marginHeight = marginheight;
- form.setLayout(layout);
+ form.setLayout(layout);
GridData gd = new GridData(fill);
gd.horizontalSpan = span;
form.setLayoutData(gd);
@@ -612,12 +612,12 @@ public class SWTFactory {
GridLayout layout = new GridLayout(columns, false);
layout.marginWidth = marginwidth;
layout.marginHeight = marginheight;
- g.setLayout(layout);
- g.setFont(font);
- GridData gd = new GridData(fill);
+ g.setLayout(layout);
+ g.setFont(font);
+ GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
- g.setLayoutData(gd);
- return g;
+ g.setLayoutData(gd);
+ return g;
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java
index be0c60993..4266ff096 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java
@@ -33,65 +33,65 @@ import org.eclipse.debug.ui.actions.IVariableValueEditor;
*/
public class VariableValueEditorManager {
- /**
- * Mapping of debug model identifiers to variable value editors.
- * The keys in this map are always Strings (model ids).
- * The values in the map are IConfigurationElements at startup,
- * which are replaced by IVariableValueEditors as the editors
- * are instantiated (editors are loaded lazily, then cached).
- */
+ /**
+ * Mapping of debug model identifiers to variable value editors.
+ * The keys in this map are always Strings (model ids).
+ * The values in the map are IConfigurationElements at startup,
+ * which are replaced by IVariableValueEditors as the editors
+ * are instantiated (editors are loaded lazily, then cached).
+ */
private Map<String, Object> fEditorMap = new HashMap<>();
- /**
- * The singleton instance of this manager.
- */
- private static VariableValueEditorManager fgManager;
+ /**
+ * The singleton instance of this manager.
+ */
+ private static VariableValueEditorManager fgManager;
- /**
- * Creates a new variable value editor manager. Clients
- * should access the singleton instance of this manager
- * by calling getDefault()
- */
- private VariableValueEditorManager() {
- loadVariableEditors();
- }
+ /**
+ * Creates a new variable value editor manager. Clients
+ * should access the singleton instance of this manager
+ * by calling getDefault()
+ */
+ private VariableValueEditorManager() {
+ loadVariableEditors();
+ }
- /**
- * Returns the singleton instance of this manager.
- * @return the singleton instance of this manager
- */
- public static VariableValueEditorManager getDefault() {
- if (fgManager == null) {
- fgManager= new VariableValueEditorManager();
- }
- return fgManager;
- }
+ /**
+ * Returns the singleton instance of this manager.
+ * @return the singleton instance of this manager
+ */
+ public static VariableValueEditorManager getDefault() {
+ if (fgManager == null) {
+ fgManager= new VariableValueEditorManager();
+ }
+ return fgManager;
+ }
- /**
- * Returns the variable value editor associated with the given debug
- * model identifier or <code>null</code> if no editor has been supplied
- * for the given debug model.
- * @param modelIdentifier the debug model identifier
- * @return the variable value editor associated with the given debug model
- * identifier or <code>null</code>
- */
- public IVariableValueEditor getVariableValueEditor(String modelIdentifier) {
- Object object = fEditorMap.get(modelIdentifier);
- IVariableValueEditor editor= null;
- if (object instanceof IVariableValueEditor) {
- editor= (IVariableValueEditor) object;
- } else if (object instanceof IConfigurationElement) {
- try {
- editor = (IVariableValueEditor) ((IConfigurationElement) object).createExecutableExtension("class"); //$NON-NLS-1$
- fEditorMap.put(modelIdentifier, editor);
- } catch (CoreException e) {
- // If an exception occurs, loading the extension, just log it and
- // return null.
- DebugUIPlugin.log(e);
- }
- }
- return editor;
- }
+ /**
+ * Returns the variable value editor associated with the given debug
+ * model identifier or <code>null</code> if no editor has been supplied
+ * for the given debug model.
+ * @param modelIdentifier the debug model identifier
+ * @return the variable value editor associated with the given debug model
+ * identifier or <code>null</code>
+ */
+ public IVariableValueEditor getVariableValueEditor(String modelIdentifier) {
+ Object object = fEditorMap.get(modelIdentifier);
+ IVariableValueEditor editor= null;
+ if (object instanceof IVariableValueEditor) {
+ editor= (IVariableValueEditor) object;
+ } else if (object instanceof IConfigurationElement) {
+ try {
+ editor = (IVariableValueEditor) ((IConfigurationElement) object).createExecutableExtension("class"); //$NON-NLS-1$
+ fEditorMap.put(modelIdentifier, editor);
+ } catch (CoreException e) {
+ // If an exception occurs, loading the extension, just log it and
+ // return null.
+ DebugUIPlugin.log(e);
+ }
+ }
+ return editor;
+ }
/**
* Loads contributors to the org.eclipse.debug.ui.variableValueEditors extension point,
@@ -101,11 +101,11 @@ public class VariableValueEditorManager {
IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_VARIABLE_VALUE_EDITORS);
IConfigurationElement[] elements = ep.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
- String modelId = element.getAttribute("modelId"); //$NON-NLS-1$
- if (modelId != null) {
- fEditorMap.put(modelId, element);
- }
- }
+ IConfigurationElement element = elements[i];
+ String modelId = element.getAttribute("modelId"); //$NON-NLS-1$
+ if (modelId != null) {
+ fEditorMap.put(modelId, element);
+ }
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
index 0a1293bfe..e6192a6da 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java
@@ -76,18 +76,18 @@ public abstract class AbstractDebugActionDelegate implements IViewActionDelegate
@Override
public void dispose(){
- fSelection= null;
+ fSelection= null;
}
@Override
public void run(IAction action){
- if (action.isEnabled()) {
+ if (action.isEnabled()) {
IStructuredSelection selection = getSelection();
// disable the action so it cannot be run again until an event or selection change
// updates the enablement
action.setEnabled(false);
runInForeground(selection, false);
- }
+ }
}
/**
@@ -96,7 +96,7 @@ public abstract class AbstractDebugActionDelegate implements IViewActionDelegate
*/
private void runInForeground(final IStructuredSelection selection, boolean isShift) {
fIsShift = isShift;
- final MultiStatus status=
+ final MultiStatus status=
new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, getStatusMessage(), null);
BusyIndicator.showWhile(Display.getCurrent(), () -> {
Iterator<?> selectionIter = selection.iterator();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
index 03e6fb189..59d220b26 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
@@ -17,39 +17,39 @@ package org.eclipse.debug.internal.ui.actions;
import org.eclipse.osgi.util.NLS;
public class ActionMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.actions.ActionMessages";//$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.actions.ActionMessages";//$NON-NLS-1$
- public static String AbstractLaunchHistoryAction_0;
- public static String AbstractLaunchHistoryAction_1;
- public static String AbstractLaunchHistoryAction_2;
- public static String AbstractLaunchHistoryAction_3;
- public static String AbstractLaunchHistoryAction_4;
+ public static String AbstractLaunchHistoryAction_0;
+ public static String AbstractLaunchHistoryAction_1;
+ public static String AbstractLaunchHistoryAction_2;
+ public static String AbstractLaunchHistoryAction_3;
+ public static String AbstractLaunchHistoryAction_4;
public static String AbstractLaunchHistoryAction_5;
public static String AbstractLaunchHistoryAction_6;
- public static String AddToFavoritesAction_1;
- public static String AddToFavoritesAction_2;
- public static String AddToFavoritesAction_3;
+ public static String AddToFavoritesAction_1;
+ public static String AddToFavoritesAction_2;
+ public static String AddToFavoritesAction_3;
- public static String ChangeVariableValue_errorDialogMessage;
- public static String ChangeVariableValue_errorDialogTitle;
- public static String ChangeVariableValue_title;
- public static String ChangeVariableValue_toolTipText;
- public static String ChangeVariableValue_1;
- public static String ChangeVariableValue_2;
- public static String ChangeVariableValue_3;
- public static String ChangeVariableValue_4;
+ public static String ChangeVariableValue_errorDialogMessage;
+ public static String ChangeVariableValue_errorDialogTitle;
+ public static String ChangeVariableValue_title;
+ public static String ChangeVariableValue_toolTipText;
+ public static String ChangeVariableValue_1;
+ public static String ChangeVariableValue_2;
+ public static String ChangeVariableValue_3;
+ public static String ChangeVariableValue_4;
- public static String CollapseAllAction_0;
+ public static String CollapseAllAction_0;
- public static String ConfigureColumnsAction_0;
+ public static String ConfigureColumnsAction_0;
public static String ConfigureColumnsAction_1;
public static String ConfigureColumnsAction_2;
- public static String CopyToClipboardActionDelegate_Problem_Copying_to_Clipboard_1;
- public static String CopyToClipboardActionDelegate_There_was_a_problem_when_accessing_the_system_clipboard__Retry__2;
+ public static String CopyToClipboardActionDelegate_Problem_Copying_to_Clipboard_1;
+ public static String CopyToClipboardActionDelegate_There_was_a_problem_when_accessing_the_system_clipboard__Retry__2;
public static String DebugLastAction_0;
@@ -62,21 +62,21 @@ public class ActionMessages extends NLS {
public static String DetailPaneAssignValueAction_2;
public static String DetailPaneAssignValueAction_3;
public static String DetailPaneAssignValueAction_4;
- public static String DetailPaneWordWrapAction_0;
- public static String DetailPaneMaxLengthAction_0;
+ public static String DetailPaneWordWrapAction_0;
+ public static String DetailPaneMaxLengthAction_0;
- public static String EditLaunchConfigurationAction_1;
+ public static String EditLaunchConfigurationAction_1;
- public static String EnableBreakpointAction_Enable_breakpoint_s__failed_2;
- public static String EnableBreakpointAction_Enabling_breakpoints_3;
- public static String EnableBreakpointAction_Exceptions_occurred_enabling_the_breakpoint_s___4;
+ public static String EnableBreakpointAction_Enable_breakpoint_s__failed_2;
+ public static String EnableBreakpointAction_Enabling_breakpoints_3;
+ public static String EnableBreakpointAction_Exceptions_occurred_enabling_the_breakpoint_s___4;
public static String LaunchConfigurationAction_0;
- public static String OpenBreakpointMarkerAction__Go_to_File_1;
- public static String OpenBreakpointMarkerAction_Exceptions_occurred_attempting_to_open_the_editor_for_the_breakpoint_resource_2;
- public static String OpenBreakpointMarkerAction_Go_to_Breakpoint_1;
- public static String OpenBreakpointMarkerAction_Go_to_File_for_Breakpoint_2;
+ public static String OpenBreakpointMarkerAction__Go_to_File_1;
+ public static String OpenBreakpointMarkerAction_Exceptions_occurred_attempting_to_open_the_editor_for_the_breakpoint_resource_2;
+ public static String OpenBreakpointMarkerAction_Go_to_Breakpoint_1;
+ public static String OpenBreakpointMarkerAction_Go_to_File_for_Breakpoint_2;
public static String OpenLaunchDialogAction_1;
@@ -88,22 +88,22 @@ public class ActionMessages extends NLS {
public static String ProfileLastAction_2;
public static String ProfileLastAction_3;
- public static String RelaunchActionDelegate_An_exception_occurred_while_launching_2;
- public static String RelaunchActionDelegate_Launch_Failed_1;
- public static String RelaunchLastAction_Cannot_relaunch_1;
- public static String RelaunchLastAction_Cannot_relaunch___0___because_it_does_not_support__2__mode_2;
- public static String RelaunchLastAction_Error_relaunching_3;
- public static String RelaunchLastAction_Error_encountered_attempting_to_relaunch_4;
+ public static String RelaunchActionDelegate_An_exception_occurred_while_launching_2;
+ public static String RelaunchActionDelegate_Launch_Failed_1;
+ public static String RelaunchLastAction_Cannot_relaunch_1;
+ public static String RelaunchLastAction_Cannot_relaunch___0___because_it_does_not_support__2__mode_2;
+ public static String RelaunchLastAction_Error_relaunching_3;
+ public static String RelaunchLastAction_Error_encountered_attempting_to_relaunch_4;
- public static String RemoveAllBreakpointsAction_0;
- public static String RemoveAllBreakpointsAction_1;
- public static String RemoveAllBreakpointsAction_2;
+ public static String RemoveAllBreakpointsAction_0;
+ public static String RemoveAllBreakpointsAction_1;
+ public static String RemoveAllBreakpointsAction_2;
public static String RemoveAllBreakpointsAction_3;
public static String RemoveAllBreakpointsAction_4;
- public static String RemoveBreakpointAction_0;
- public static String RemoveBreakpointAction_1;
- public static String RemoveBreakpointAction_2;
- public static String RemoveBreakpointAction_3;
+ public static String RemoveBreakpointAction_0;
+ public static String RemoveBreakpointAction_1;
+ public static String RemoveBreakpointAction_2;
+ public static String RemoveBreakpointAction_3;
public static String RemoveBreakpointAction_4;
public static String RemoveBreakpointAction_5;
public static String RemoveBreakpointAction_6;
@@ -124,93 +124,93 @@ public class ActionMessages extends NLS {
public static String RunLastAction_2;
public static String RunLastAction_3;
- public static String ShowSupportedBreakpointsAction_Show_For_Selected;
- public static String ShowSupportedBreakpointsAction_tooltip;
+ public static String ShowSupportedBreakpointsAction_Show_For_Selected;
+ public static String ShowSupportedBreakpointsAction_tooltip;
- public static String ShowTypesAction_Show__Type_Names_1;
- public static String ShowTypesAction_Show_Type_Names;
+ public static String ShowTypesAction_Show__Type_Names_1;
+ public static String ShowTypesAction_Show_Type_Names;
- public static String SkipAllBreakpointsAction_0;
- public static String SkipAllBreakpointsAction_2;
+ public static String SkipAllBreakpointsAction_0;
+ public static String SkipAllBreakpointsAction_2;
- public static String TerminateAndRelaunchAction_0;
- public static String TerminateAndRelaunchAction_3;
- public static String TerminateAndRelaunchAction_4;
- public static String TerminateAndRemoveAction_0;
- public static String TerminateAndRemoveAction_3;
+ public static String TerminateAndRelaunchAction_0;
+ public static String TerminateAndRelaunchAction_3;
+ public static String TerminateAndRelaunchAction_4;
+ public static String TerminateAndRemoveAction_0;
+ public static String TerminateAndRemoveAction_3;
- public static String ToggleDetailPaneAction_0;
+ public static String ToggleDetailPaneAction_0;
public static String ToggleDetailPaneAction_1;
- public static String ToggleDetailPaneAction_2;
+ public static String ToggleDetailPaneAction_2;
public static String ToggleDetailPaneAction_3;
- public static String ToggleDetailPaneAction_4;
- public static String ToggleDetailPaneAction_5;
- public static String ToggleDetailPaneAction_8;
- public static String ToggleBreakpointAction_0;
- public static String ToggleBreakpointAction_1;
- public static String ToggleBreakpointAction_2;
+ public static String ToggleDetailPaneAction_4;
+ public static String ToggleDetailPaneAction_5;
+ public static String ToggleDetailPaneAction_8;
+ public static String ToggleBreakpointAction_0;
+ public static String ToggleBreakpointAction_1;
+ public static String ToggleBreakpointAction_2;
public static String ToggleBreakpointAction_3;
public static String ToggleStepFiltersAction_0;
public static String ToggleStepFiltersAction_1;
- public static String WatchExpressionDialog_0;
- public static String WatchExpressionDialog_1;
- public static String WatchExpressionDialog_2;
- public static String WatchExpressionDialog_3;
- public static String WatchExpressionDialog_4;
+ public static String WatchExpressionDialog_0;
+ public static String WatchExpressionDialog_1;
+ public static String WatchExpressionDialog_2;
+ public static String WatchExpressionDialog_3;
+ public static String WatchExpressionDialog_4;
public static String WatchExpressionDialog_5;
public static String WatchExpressionDialogMenu_0;
public static String WatchExpressionDialogMenu_1;
public static String WatchExpressionDialogMenu_2;
- public static String WatchAction_0;
- public static String WatchAction_1;
+ public static String WatchAction_0;
+ public static String WatchAction_1;
- public static String RunToLineAction_0;
- public static String RunToLineAction_1;
+ public static String RunToLineAction_0;
+ public static String RunToLineAction_1;
public static String RunToLineAction_2;
public static String RunToLineAction_3;
- public static String RunToLineHandler_0;
- public static String RunToLineActionDelegate_4;
-
- public static String RetargetAction_2;
- public static String RetargetAction_3;
- public static String ModifyWatchpointAction_0;
- public static String ModifyWatchpointAction_1;
- public static String RemoveAllExpressionsAction_0;
- public static String RemoveAllExpressionsAction_1;
- public static String LaunchShortcutsAction_1;
- public static String FindDialog_1;
- public static String FindDialog_3;
- public static String FindAction_0;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
- }
-
- public static String AbstractDebugActionDelegate_0;
-
- public static String RetargetAddMemoryBlockAction_0;
- public static String RetargetAddMemoryBlockAction_1;
- public static String AddMemoryRenderingActionDelegate_0;
- public static String AddMemoryRenderingActionDelegate_1;
- public static String AddMemoryRenderingActionDelegate_2;
-
- public static String RulerEnableDisableBreakpointAction_0;
- public static String RulerEnableDisableBreakpointAction_1;
- public static String RulerEnableDisableBreakpointAction_2;
- public static String RulerEnableDisableBreakpointAction_3;
+ public static String RunToLineHandler_0;
+ public static String RunToLineActionDelegate_4;
+
+ public static String RetargetAction_2;
+ public static String RetargetAction_3;
+ public static String ModifyWatchpointAction_0;
+ public static String ModifyWatchpointAction_1;
+ public static String RemoveAllExpressionsAction_0;
+ public static String RemoveAllExpressionsAction_1;
+ public static String LaunchShortcutsAction_1;
+ public static String FindDialog_1;
+ public static String FindDialog_3;
+ public static String FindAction_0;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
+ }
+
+ public static String AbstractDebugActionDelegate_0;
+
+ public static String RetargetAddMemoryBlockAction_0;
+ public static String RetargetAddMemoryBlockAction_1;
+ public static String AddMemoryRenderingActionDelegate_0;
+ public static String AddMemoryRenderingActionDelegate_1;
+ public static String AddMemoryRenderingActionDelegate_2;
+
+ public static String RulerEnableDisableBreakpointAction_0;
+ public static String RulerEnableDisableBreakpointAction_1;
+ public static String RulerEnableDisableBreakpointAction_2;
+ public static String RulerEnableDisableBreakpointAction_3;
public static String RulerEnableDisableBreakpointAction_4;
- public static String DisconnectAction_0;
- public static String DisconnectAction_3;
- public static String DropToFrameAction_0;
- public static String DropToFrameAction_3;
- public static String LaunchAction_0;
+ public static String DisconnectAction_0;
+ public static String DisconnectAction_3;
+ public static String DropToFrameAction_0;
+ public static String DropToFrameAction_3;
+ public static String LaunchAction_0;
public static String LaunchAction_1;
@@ -218,23 +218,23 @@ public class ActionMessages extends NLS {
public static String RestartCommandAction__text;
- public static String RestartCommandAction_tooltip;
-
- public static String ResumeAction_0;
- public static String ResumeAction_3;
- public static String StepIntoAction_0;
- public static String StepIntoAction_3;
- public static String StepOverAction_0;
- public static String StepOverAction_3;
- public static String StepReturnAction_2;
- public static String StepReturnAction_3;
- public static String SuspendAction_0;
- public static String SuspendAction_3;
- public static String TerminateAction_0;
- public static String TerminateAction_3;
+ public static String RestartCommandAction_tooltip;
+
+ public static String ResumeAction_0;
+ public static String ResumeAction_3;
+ public static String StepIntoAction_0;
+ public static String StepIntoAction_3;
+ public static String StepOverAction_0;
+ public static String StepOverAction_3;
+ public static String StepReturnAction_2;
+ public static String StepReturnAction_3;
+ public static String SuspendAction_0;
+ public static String SuspendAction_3;
+ public static String TerminateAction_0;
+ public static String TerminateAction_3;
public static String TerminateAndLaunchFailure;
- public static String TerminateAllAction_2;
- public static String TerminateAllAction_3;
+ public static String TerminateAllAction_2;
+ public static String TerminateAllAction_3;
public static String DeleteWorkingsetsMessageDialog_0;
public static String DeleteWorkingsetsMessageDialog_1;
@@ -245,5 +245,5 @@ public class ActionMessages extends NLS {
public static String VirtualFindAction_1;
public static String ToggleBreakpointsTargetManager_defaultToggleTarget_name;
- public static String ToggleBreakpointsTargetManager_defaultToggleTarget_description;
+ public static String ToggleBreakpointsTargetManager_defaultToggleTarget_description;
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
index 7ae847bb9..74483bf22 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java
@@ -84,7 +84,7 @@ public class AddToFavoritesAction extends SelectionListenerAction {
if (configuration != null) {
ILaunchGroup group= DebugUITools.getLaunchGroup(configuration, getMode());
if (group == null) {
- return false;
+ return false;
}
setGroup(group);
setLaunchConfiguration(configuration);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/CollapseAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/CollapseAllAction.java
index a32cd70c4..7043872a7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/CollapseAllAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/CollapseAllAction.java
@@ -44,6 +44,6 @@ public class CollapseAllAction extends Action implements IUpdate {
@Override
public void update() {
- setEnabled( fViewer.getInput() != null && fViewer.getChildCount(TreePath.EMPTY) > 0 );
+ setEnabled( fViewer.getInput() != null && fViewer.getChildCount(TreePath.EMPTY) > 0 );
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java
index 26f3a0d35..88ee2a48d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetAction.java
@@ -73,7 +73,7 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
}
protected IWorkbenchPart getActivePart() {
- return fActivePart;
+ return fActivePart;
}
@Override
@@ -141,7 +141,7 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
fTargetAdapter = getAdapter((IAdaptable) object);
}
}
- action.setEnabled(fTargetAdapter != null && isTargetEnabled());
+ action.setEnabled(fTargetAdapter != null && isTargetEnabled());
}
}
@@ -219,9 +219,9 @@ public abstract class RetargetAction implements IWorkbenchWindowActionDelegate,
*/
protected boolean isTargetEnabled() {
if (fTargetAdapter != null) {
- if (fActivePart != null) {
- return canPerformAction(fTargetAdapter, getTargetSelection(), fActivePart);
- }
+ if (fActivePart != null) {
+ return canPerformAction(fTargetAdapter, getTargetSelection(), fActivePart);
+ }
}
return false;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java
index 083b01085..478489982 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RetargetRunToLineAction.java
@@ -45,8 +45,8 @@ public class RetargetRunToLineAction extends RetargetAction {
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
- fTargetElement = (ISuspendResume)
- DebugPlugin.getAdapter(ss.getFirstElement(), ISuspendResume.class);
+ fTargetElement = (ISuspendResume)
+ DebugPlugin.getAdapter(ss.getFirstElement(), ISuspendResume.class);
}
}
IAction action = getAction();
@@ -80,8 +80,8 @@ public class RetargetRunToLineAction extends RetargetAction {
@Override
public void init(IAction action) {
- super.init(action);
- action.setActionDefinitionId("org.eclipse.debug.ui.commands.RunToLine"); //$NON-NLS-1$
+ super.init(action);
+ action.setActionDefinitionId("org.eclipse.debug.ui.commands.RunToLine"); //$NON-NLS-1$
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
index eba6a00e3..6c9509d95 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java
@@ -77,660 +77,660 @@ import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
*/
public class ToggleBreakpointsTargetManager implements IToggleBreakpointsTargetManager {
- /**
- * Toggle breakpoints target ID which refers to a target contributed
- * through the legacy adapter mechanism.
- */
- public static String DEFAULT_TOGGLE_TARGET_ID = "default"; //$NON-NLS-1$
+ /**
+ * Toggle breakpoints target ID which refers to a target contributed
+ * through the legacy adapter mechanism.
+ */
+ public static String DEFAULT_TOGGLE_TARGET_ID = "default"; //$NON-NLS-1$
private static Set<String> DEFAULT_TOGGLE_TARGET_ID_SET = new TreeSet<>();
- static {
- DEFAULT_TOGGLE_TARGET_ID_SET.add(DEFAULT_TOGGLE_TARGET_ID);
- }
-
- /**
- * Acts as a proxy between the toggle breakpoints target manager and the factories
- * contributed to the extension point. Only loads information from the plug-in XML
- * and only instantiates the specified factory if required (lazy loading).
- */
- private static class ToggleTargetFactory implements IToggleBreakpointsTargetFactory {
-
- private IConfigurationElement fConfigElement;
- private IToggleBreakpointsTargetFactory fFactory;
- private Expression fEnablementExpression;
-
- public ToggleTargetFactory(IConfigurationElement configElement){
- fConfigElement = configElement;
- }
-
- /**
- * @return Returns the instantiated factory specified by the class property.
- */
- private IToggleBreakpointsTargetFactory getFactory() {
- if (fFactory != null) {
+ static {
+ DEFAULT_TOGGLE_TARGET_ID_SET.add(DEFAULT_TOGGLE_TARGET_ID);
+ }
+
+ /**
+ * Acts as a proxy between the toggle breakpoints target manager and the factories
+ * contributed to the extension point. Only loads information from the plug-in XML
+ * and only instantiates the specified factory if required (lazy loading).
+ */
+ private static class ToggleTargetFactory implements IToggleBreakpointsTargetFactory {
+
+ private IConfigurationElement fConfigElement;
+ private IToggleBreakpointsTargetFactory fFactory;
+ private Expression fEnablementExpression;
+
+ public ToggleTargetFactory(IConfigurationElement configElement){
+ fConfigElement = configElement;
+ }
+
+ /**
+ * @return Returns the instantiated factory specified by the class property.
+ */
+ private IToggleBreakpointsTargetFactory getFactory() {
+ if (fFactory != null) {
return fFactory;
}
- try{
- Object obj = fConfigElement.createExecutableExtension(IConfigurationElementConstants.CLASS);
- if(obj instanceof IToggleBreakpointsTargetFactory) {
- fFactory = (IToggleBreakpointsTargetFactory)obj;
- } else {
- throw new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactories extension failed to load breakpoint toggle target because the specified class does not implement org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory. Class specified was: " + obj, null)); //$NON-NLS-1$
- }
- } catch (CoreException e){
- DebugUIPlugin.log(e.getStatus());
- fFactory = null;
- }
- return fFactory;
- }
-
- /**
- * Checks if the enablement expression for the factory evaluates to true for the
- * given part and selection.
- * @param part The active part.
- * @param selection The current selection
- * @return whether the delegated target factory is enabled for given
- * part and selection.
- */
- public boolean isEnabled(IWorkbenchPart part, ISelection selection) {
- boolean enabled = false;
- Expression expression = getEnablementExpression();
- if (expression != null) {
- enabled = evalEnablementExpression(part, selection, expression);
- } else {
- enabled = true;
- }
- return enabled;
- }
-
- /**
- * Returns the active debug context given the active part. It is used
- * in creating the evaluation context for the factories' enablement expression.
- * @param part active part
- * @return current active debug context
- */
- private IStructuredSelection getDebugContext(IWorkbenchPart part) {
- ISelection selection = DebugUITools.getDebugContextManager().
- getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
- if (selection instanceof IStructuredSelection) {
- return (IStructuredSelection)selection;
- }
- return StructuredSelection.EMPTY;
- }
-
- /**
- * Evaluate the given expression within the given context and return
- * the result. Returns <code>true</code> iff result is either TRUE.
- *
- * @param part the {@link IWorkbenchPart} context
- * @param selection the current selection in the part
- * @param exp the current expression
- * @return the result of evaluating the expression
- */
- private boolean evalEnablementExpression(IWorkbenchPart part, ISelection selection, Expression exp) {
- if (exp != null){
- IEvaluationContext context = DebugUIPlugin.createEvaluationContext(part);
+ try{
+ Object obj = fConfigElement.createExecutableExtension(IConfigurationElementConstants.CLASS);
+ if(obj instanceof IToggleBreakpointsTargetFactory) {
+ fFactory = (IToggleBreakpointsTargetFactory)obj;
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactories extension failed to load breakpoint toggle target because the specified class does not implement org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory. Class specified was: " + obj, null)); //$NON-NLS-1$
+ }
+ } catch (CoreException e){
+ DebugUIPlugin.log(e.getStatus());
+ fFactory = null;
+ }
+ return fFactory;
+ }
+
+ /**
+ * Checks if the enablement expression for the factory evaluates to true for the
+ * given part and selection.
+ * @param part The active part.
+ * @param selection The current selection
+ * @return whether the delegated target factory is enabled for given
+ * part and selection.
+ */
+ public boolean isEnabled(IWorkbenchPart part, ISelection selection) {
+ boolean enabled = false;
+ Expression expression = getEnablementExpression();
+ if (expression != null) {
+ enabled = evalEnablementExpression(part, selection, expression);
+ } else {
+ enabled = true;
+ }
+ return enabled;
+ }
+
+ /**
+ * Returns the active debug context given the active part. It is used
+ * in creating the evaluation context for the factories' enablement expression.
+ * @param part active part
+ * @return current active debug context
+ */
+ private IStructuredSelection getDebugContext(IWorkbenchPart part) {
+ ISelection selection = DebugUITools.getDebugContextManager().
+ getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
+ if (selection instanceof IStructuredSelection) {
+ return (IStructuredSelection)selection;
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * Evaluate the given expression within the given context and return
+ * the result. Returns <code>true</code> iff result is either TRUE.
+ *
+ * @param part the {@link IWorkbenchPart} context
+ * @param selection the current selection in the part
+ * @param exp the current expression
+ * @return the result of evaluating the expression
+ */
+ private boolean evalEnablementExpression(IWorkbenchPart part, ISelection selection, Expression exp) {
+ if (exp != null){
+ IEvaluationContext context = DebugUIPlugin.createEvaluationContext(part);
List<Object> debugContextList = getDebugContext(part).toList();
- context.addVariable(IConfigurationElementConstants.DEBUG_CONTEXT, debugContextList);
+ context.addVariable(IConfigurationElementConstants.DEBUG_CONTEXT, debugContextList);
- if (selection instanceof IStructuredSelection) {
+ if (selection instanceof IStructuredSelection) {
List<Object> selectionList = ((IStructuredSelection) selection).toList();
- context.addVariable(IConfigurationElementConstants.SELECTION, selectionList);
- }
-
- if (part instanceof IEditorPart) {
- context.addVariable(IConfigurationElementConstants.EDITOR_INPUT, ((IEditorPart)part).getEditorInput());
- }
-
- try{
- EvaluationResult result = exp.evaluate(context);
- if (result == EvaluationResult.TRUE){
- return true;
- }
- } catch (CoreException e){
- // Evaluation failed
- }
- }
- return false;
- }
-
- /**
+ context.addVariable(IConfigurationElementConstants.SELECTION, selectionList);
+ }
+
+ if (part instanceof IEditorPart) {
+ context.addVariable(IConfigurationElementConstants.EDITOR_INPUT, ((IEditorPart)part).getEditorInput());
+ }
+
+ try{
+ EvaluationResult result = exp.evaluate(context);
+ if (result == EvaluationResult.TRUE){
+ return true;
+ }
+ } catch (CoreException e){
+ // Evaluation failed
+ }
+ }
+ return false;
+ }
+
+ /**
* @return Returns an expression that represents the enablement logic
* for the breakpoint toggle target.
*/
- private Expression getEnablementExpression(){
- if (fEnablementExpression == null) {
- try{
- IConfigurationElement[] elements = fConfigElement.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
- if (enablement != null) {
- fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
- }
- } catch (CoreException e){
- DebugUIPlugin.log(e.getStatus());
- fEnablementExpression = null;
- }
- }
- return fEnablementExpression;
- }
-
- /**
- * Instantiates the factory and asks it to produce the IToggleBreakpointsTarget
- * for the given ID
- * @param targetID ID to create toggle target for
- * @return The created toggle target, or null.
- */
- @Override
+ private Expression getEnablementExpression(){
+ if (fEnablementExpression == null) {
+ try{
+ IConfigurationElement[] elements = fConfigElement.getChildren(ExpressionTagNames.ENABLEMENT);
+ IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
+ if (enablement != null) {
+ fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
+ }
+ } catch (CoreException e){
+ DebugUIPlugin.log(e.getStatus());
+ fEnablementExpression = null;
+ }
+ }
+ return fEnablementExpression;
+ }
+
+ /**
+ * Instantiates the factory and asks it to produce the IToggleBreakpointsTarget
+ * for the given ID
+ * @param targetID ID to create toggle target for
+ * @return The created toggle target, or null.
+ */
+ @Override
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
- IToggleBreakpointsTargetFactory factory = getFactory();
- if (factory != null) {
- return factory.createToggleTarget(targetID);
- }
- return null;
- }
-
- /**
- * Instantiates the factory and asks it for the set of toggle target
- * IDs that the factory can produce for the given part and selection.
- * @param part The active part.
- * @param selection The current selection
- * @return Set of <code>String</code> IDs for possible toggle breakpoint
- * targets, possibly empty
- */
- @Override
+ IToggleBreakpointsTargetFactory factory = getFactory();
+ if (factory != null) {
+ return factory.createToggleTarget(targetID);
+ }
+ return null;
+ }
+
+ /**
+ * Instantiates the factory and asks it for the set of toggle target
+ * IDs that the factory can produce for the given part and selection.
+ * @param part The active part.
+ * @param selection The current selection
+ * @return Set of <code>String</code> IDs for possible toggle breakpoint
+ * targets, possibly empty
+ */
+ @Override
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
- IToggleBreakpointsTargetFactory factory = getFactory();
- if (factory != null) {
- return factory.getToggleTargets(part, selection);
- }
- return Collections.EMPTY_SET;
- }
-
- /**
- * Instantiates the factory and asks it to produce the name of the toggle target
- * for the given ID.
- * @param targetID toggle breakpoints target identifier
- * @return toggle target name
- */
- @Override
+ IToggleBreakpointsTargetFactory factory = getFactory();
+ if (factory != null) {
+ return factory.getToggleTargets(part, selection);
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * Instantiates the factory and asks it to produce the name of the toggle target
+ * for the given ID.
+ * @param targetID toggle breakpoints target identifier
+ * @return toggle target name
+ */
+ @Override
public String getToggleTargetName(String targetID) {
- IToggleBreakpointsTargetFactory factory = getFactory();
- if (factory != null) {
- return factory.getToggleTargetName(targetID);
- }
- return null;
- }
-
- /**
- * Instantiates the factory and asks it to produce the description of the toggle
- * target for the given ID.
- * @param targetID toggle breakpoints target identifier
- * @return toggle target name or <code>null</code> if none
- */
- @Override
+ IToggleBreakpointsTargetFactory factory = getFactory();
+ if (factory != null) {
+ return factory.getToggleTargetName(targetID);
+ }
+ return null;
+ }
+
+ /**
+ * Instantiates the factory and asks it to produce the description of the toggle
+ * target for the given ID.
+ * @param targetID toggle breakpoints target identifier
+ * @return toggle target name or <code>null</code> if none
+ */
+ @Override
public String getToggleTargetDescription(String targetID) {
- IToggleBreakpointsTargetFactory factory = getFactory();
- if (factory != null) {
- return factory.getToggleTargetDescription(targetID);
- }
- return null;
- }
-
- /**
- * Instantiates the factory and asks it for the toggle tareget ID that
- * the factory considers the default for the given part and selection.
- * @param part The active part.
- * @param selection The current selection
- * @return a breakpoint toggle target identifier or <code>null</code>
- */
- @Override
+ IToggleBreakpointsTargetFactory factory = getFactory();
+ if (factory != null) {
+ return factory.getToggleTargetDescription(targetID);
+ }
+ return null;
+ }
+
+ /**
+ * Instantiates the factory and asks it for the toggle tareget ID that
+ * the factory considers the default for the given part and selection.
+ * @param part The active part.
+ * @param selection The current selection
+ * @return a breakpoint toggle target identifier or <code>null</code>
+ */
+ @Override
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
- IToggleBreakpointsTargetFactory factory = getFactory();
- if (factory != null) {
- return factory.getDefaultToggleTarget(part, selection);
- }
- return null;
- }
- }
-
-
- /**
- * Factory for toggle breakpoints targets contributed through the
- * adapter mechanism.
- */
- private static class ToggleBreakpointsTargetAdapterFactory implements IToggleBreakpointsTargetFactory {
-
- private Object getSelectionElement(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- return ss.getFirstElement();
- }
- return null;
- }
-
- /**
- * Checks whether the given element is adaptable to the toggle breakpoints target.
- * This method does not force loading of the adapter.
- * @param adaptable Element to adapt.
- * @return returns true if element can be adapted.
- */
- private boolean canGetToggleBreakpointsTarget(Object adaptable) {
- if (adaptable != null) {
- IToggleBreakpointsTarget adapter = null;
- if (adaptable instanceof IAdaptable) {
- adapter = ((IAdaptable)adaptable).getAdapter(IToggleBreakpointsTarget.class);
- }
- if (adapter == null) {
- IAdapterManager adapterManager = Platform.getAdapterManager();
- if (adapterManager.hasAdapter(adaptable, IToggleBreakpointsTarget.class.getName())) {
- return true;
- }
- } else {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Finds the toggle breakpoints target for the active part and selection.
- * It first looks for the target using the factories registered using an
- * extension point. If not found it uses the <code>IAdaptable</code>
- * mechanism.
- * @param part The workbench part in which toggle target is to be used
- * @param element The selection element to retrieve the toggle adapter from
- * @return The toggle breakpoints target, or <code>null</code> if not found.
- */
- private IToggleBreakpointsTarget getToggleBreakpointsTarget(IWorkbenchPart part, Object element) {
- IToggleBreakpointsTarget target = null;
- if (element != null) {
- target = (IToggleBreakpointsTarget) DebugPlugin.getAdapter(element, IToggleBreakpointsTarget.class);
- }
- if (target == null) {
- target = (IToggleBreakpointsTarget) DebugPlugin.getAdapter(part, IToggleBreakpointsTarget.class);
- }
- return target;
- }
-
- /**
- * Checks if there is an adaptable object for the given part and
- * selection, and if there is, it checks whether an
- * <code>IToggleBreakpointsTarget</code> can be obtained as an adapter.
- * @param part The workbench part in which toggle target is to be used
- * @param selection The active selection to use with toggle target
- * @return Whether the adapter (default) toggle target is available.
- */
- public boolean isEnabled(IWorkbenchPart part, ISelection selection) {
- return canGetToggleBreakpointsTarget(getSelectionElement(selection)) || canGetToggleBreakpointsTarget(part);
- }
-
- /**
- * Not implemented use {@link #createDefaultToggleTarget(IWorkbenchPart, ISelection)}
- * instead.
- * @param targetID not used
- * @return always returns null
- */
- @Override
+ IToggleBreakpointsTargetFactory factory = getFactory();
+ if (factory != null) {
+ return factory.getDefaultToggleTarget(part, selection);
+ }
+ return null;
+ }
+ }
+
+
+ /**
+ * Factory for toggle breakpoints targets contributed through the
+ * adapter mechanism.
+ */
+ private static class ToggleBreakpointsTargetAdapterFactory implements IToggleBreakpointsTargetFactory {
+
+ private Object getSelectionElement(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ return ss.getFirstElement();
+ }
+ return null;
+ }
+
+ /**
+ * Checks whether the given element is adaptable to the toggle breakpoints target.
+ * This method does not force loading of the adapter.
+ * @param adaptable Element to adapt.
+ * @return returns true if element can be adapted.
+ */
+ private boolean canGetToggleBreakpointsTarget(Object adaptable) {
+ if (adaptable != null) {
+ IToggleBreakpointsTarget adapter = null;
+ if (adaptable instanceof IAdaptable) {
+ adapter = ((IAdaptable)adaptable).getAdapter(IToggleBreakpointsTarget.class);
+ }
+ if (adapter == null) {
+ IAdapterManager adapterManager = Platform.getAdapterManager();
+ if (adapterManager.hasAdapter(adaptable, IToggleBreakpointsTarget.class.getName())) {
+ return true;
+ }
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Finds the toggle breakpoints target for the active part and selection.
+ * It first looks for the target using the factories registered using an
+ * extension point. If not found it uses the <code>IAdaptable</code>
+ * mechanism.
+ * @param part The workbench part in which toggle target is to be used
+ * @param element The selection element to retrieve the toggle adapter from
+ * @return The toggle breakpoints target, or <code>null</code> if not found.
+ */
+ private IToggleBreakpointsTarget getToggleBreakpointsTarget(IWorkbenchPart part, Object element) {
+ IToggleBreakpointsTarget target = null;
+ if (element != null) {
+ target = (IToggleBreakpointsTarget) DebugPlugin.getAdapter(element, IToggleBreakpointsTarget.class);
+ }
+ if (target == null) {
+ target = (IToggleBreakpointsTarget) DebugPlugin.getAdapter(part, IToggleBreakpointsTarget.class);
+ }
+ return target;
+ }
+
+ /**
+ * Checks if there is an adaptable object for the given part and
+ * selection, and if there is, it checks whether an
+ * <code>IToggleBreakpointsTarget</code> can be obtained as an adapter.
+ * @param part The workbench part in which toggle target is to be used
+ * @param selection The active selection to use with toggle target
+ * @return Whether the adapter (default) toggle target is available.
+ */
+ public boolean isEnabled(IWorkbenchPart part, ISelection selection) {
+ return canGetToggleBreakpointsTarget(getSelectionElement(selection)) || canGetToggleBreakpointsTarget(part);
+ }
+
+ /**
+ * Not implemented use {@link #createDefaultToggleTarget(IWorkbenchPart, ISelection)}
+ * instead.
+ * @param targetID not used
+ * @return always returns null
+ */
+ @Override
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
- return null;
- }
-
- /**
- * @param part The workbench part in which toggle target is to be used
- * @param selection The active selection to use with toggle target
- * @return Returns a toggle target for the given part and selection, obtained
- * through the adapter mechanism.
- */
- public IToggleBreakpointsTarget createDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
- return getToggleBreakpointsTarget(part, getSelectionElement(selection));
- }
-
- @Override
+ return null;
+ }
+
+ /**
+ * @param part The workbench part in which toggle target is to be used
+ * @param selection The active selection to use with toggle target
+ * @return Returns a toggle target for the given part and selection, obtained
+ * through the adapter mechanism.
+ */
+ public IToggleBreakpointsTarget createDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
+ return getToggleBreakpointsTarget(part, getSelectionElement(selection));
+ }
+
+ @Override
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
- if (isEnabled(part, selection)) {
- return DEFAULT_TOGGLE_TARGET_ID_SET;
- }
- return Collections.EMPTY_SET;
- }
+ if (isEnabled(part, selection)) {
+ return DEFAULT_TOGGLE_TARGET_ID_SET;
+ }
+ return Collections.EMPTY_SET;
+ }
- @Override
+ @Override
public String getToggleTargetName(String targetID) {
- return ActionMessages.ToggleBreakpointsTargetManager_defaultToggleTarget_name;
- }
+ return ActionMessages.ToggleBreakpointsTargetManager_defaultToggleTarget_name;
+ }
- @Override
+ @Override
public String getToggleTargetDescription(String targetID) {
- return ActionMessages.ToggleBreakpointsTargetManager_defaultToggleTarget_description;
- }
+ return ActionMessages.ToggleBreakpointsTargetManager_defaultToggleTarget_description;
+ }
- @Override
+ @Override
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
- return DEFAULT_TOGGLE_TARGET_ID;
- }
- }
+ return DEFAULT_TOGGLE_TARGET_ID;
+ }
+ }
- /**
- * Preference key for storing the preferred targets map.
- * @see #storePreferredTargets()
- * @see #loadPreferredTargets()
- */
- public static final String PREF_TARGETS = "preferredTargets"; //$NON-NLS-1$
+ /**
+ * Preference key for storing the preferred targets map.
+ * @see #storePreferredTargets()
+ * @see #loadPreferredTargets()
+ */
+ public static final String PREF_TARGETS = "preferredTargets"; //$NON-NLS-1$
- /**
- * There should only ever be once instance of this manager for the workbench.
- */
- private static ToggleBreakpointsTargetManager fgSingleton;
+ /**
+ * There should only ever be once instance of this manager for the workbench.
+ */
+ private static ToggleBreakpointsTargetManager fgSingleton;
- public static ToggleBreakpointsTargetManager getDefault(){
- if (fgSingleton == null) {
+ public static ToggleBreakpointsTargetManager getDefault(){
+ if (fgSingleton == null) {
fgSingleton = new ToggleBreakpointsTargetManager();
}
- return fgSingleton;
- }
+ return fgSingleton;
+ }
- /**
- * Maps the IDs of toggle breakpoint targets to their instances. The target
- * IDs must be unique.
- */
+ /**
+ * Maps the IDs of toggle breakpoint targets to their instances. The target
+ * IDs must be unique.
+ */
private Map<String, IToggleBreakpointsTargetFactory> fKnownFactories;
- /**
- * Maps a Set of target id's to the one target id that is preferred.
- */
+ /**
+ * Maps a Set of target id's to the one target id that is preferred.
+ */
private Map<Set<String>, String> fPreferredTargets;
- /**
- * Maps the IDs of toggle targets to the factory that can create them.
- * There can currently only be one factory for a given toggle target.
- */
+ /**
+ * Maps the IDs of toggle targets to the factory that can create them.
+ * There can currently only be one factory for a given toggle target.
+ */
private Map<String, IToggleBreakpointsTargetFactory> fFactoriesByTargetID = new HashMap<>();
- /**
- * List of listeners to changes in the preferred toggle targets list.
- */
+ /**
+ * List of listeners to changes in the preferred toggle targets list.
+ */
private ListenerList<IToggleBreakpointsTargetManagerListener> fChangedListners = new ListenerList<>();
- /**
- * Initializes the collection of known factories from extension point contributions.
- */
- private void initializeFactories() {
+ /**
+ * Initializes the collection of known factories from extension point contributions.
+ */
+ private void initializeFactories() {
fKnownFactories = new LinkedHashMap<>();
- fKnownFactories.put(DEFAULT_TOGGLE_TARGET_ID, new ToggleBreakpointsTargetAdapterFactory());
- IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_TOGGLE_BREAKPOINTS_TARGET_FACTORIES);
- IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- String id = elements[i].getAttribute(IConfigurationElementConstants.ID);
- if (id != null && id.length() != 0) {
- if (fKnownFactories.containsKey(id)) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactory extension failed to load breakpoint toggle target because the specified id is already registered. Specified ID is: " + id, null)); //$NON-NLS-1$
- } else {
- fKnownFactories.put(id, new ToggleTargetFactory(elements[i]));
- }
- } else {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactory extension failed to load breakpoint toggle target because the specified id is empty.", null)); //$NON-NLS-1$
- }
- }
-
- // If there are any factories contributed through the extension point,
- // set a system property for use in enabling actions.
- System.setProperty(IDebugUIConstants.SYS_PROP_BREAKPOINT_TOGGLE_FACTORIES_USED,
- fKnownFactories.size() > 1 ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Returns the set of IToggleBreakpointsTargetFactory objects (they will be
- * ToggleTargetFactory) that were contributed to the extension point and
- * are enabled for the given part and selection (enabled if the factory
- * does not have an enablement expression or if the enablement expression
- * evaluates to true).
- *
- * @param part active part
- * @param selection active selection in part
- * @return The factories enabled for the part and selection or an empty
- * collection.
- */
+ fKnownFactories.put(DEFAULT_TOGGLE_TARGET_ID, new ToggleBreakpointsTargetAdapterFactory());
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_TOGGLE_BREAKPOINTS_TARGET_FACTORIES);
+ IConfigurationElement[] elements = ep.getConfigurationElements();
+ for (int i= 0; i < elements.length; i++) {
+ String id = elements[i].getAttribute(IConfigurationElementConstants.ID);
+ if (id != null && id.length() != 0) {
+ if (fKnownFactories.containsKey(id)) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactory extension failed to load breakpoint toggle target because the specified id is already registered. Specified ID is: " + id, null)); //$NON-NLS-1$
+ } else {
+ fKnownFactories.put(id, new ToggleTargetFactory(elements[i]));
+ }
+ } else {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.toggleBreakpointsTargetFactory extension failed to load breakpoint toggle target because the specified id is empty.", null)); //$NON-NLS-1$
+ }
+ }
+
+ // If there are any factories contributed through the extension point,
+ // set a system property for use in enabling actions.
+ System.setProperty(IDebugUIConstants.SYS_PROP_BREAKPOINT_TOGGLE_FACTORIES_USED,
+ fKnownFactories.size() > 1 ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Returns the set of IToggleBreakpointsTargetFactory objects (they will be
+ * ToggleTargetFactory) that were contributed to the extension point and
+ * are enabled for the given part and selection (enabled if the factory
+ * does not have an enablement expression or if the enablement expression
+ * evaluates to true).
+ *
+ * @param part active part
+ * @param selection active selection in part
+ * @return The factories enabled for the part and selection or an empty
+ * collection.
+ */
private Set<IToggleBreakpointsTargetFactory> getEnabledFactories(IWorkbenchPart part, ISelection selection) {
- if (fKnownFactories == null) {
+ if (fKnownFactories == null) {
initializeFactories();
}
Set<IToggleBreakpointsTargetFactory> set = new HashSet<>();
for (Entry<String, IToggleBreakpointsTargetFactory> entry : fKnownFactories.entrySet()) {
IToggleBreakpointsTargetFactory factory = entry.getValue();
- if (factory instanceof ToggleTargetFactory &&
- ((ToggleTargetFactory)factory).isEnabled(part, selection)) {
- set.add(factory);
- } else if (factory instanceof ToggleBreakpointsTargetAdapterFactory &&
- ((ToggleBreakpointsTargetAdapterFactory)factory).isEnabled(part, selection)) {
- set.add(factory);
- }
- }
- return set;
- }
-
- /**
- * Produces the set of IDs for all possible toggle targets that can be used for
- * the given part and selection.
- *
- * @param factoriesToQuery The collection of factories to check
- * @param part active part
- * @param selection active selection in part
- * @return Set of toggle target IDs or an empty set
- */
+ if (factory instanceof ToggleTargetFactory &&
+ ((ToggleTargetFactory)factory).isEnabled(part, selection)) {
+ set.add(factory);
+ } else if (factory instanceof ToggleBreakpointsTargetAdapterFactory &&
+ ((ToggleBreakpointsTargetAdapterFactory)factory).isEnabled(part, selection)) {
+ set.add(factory);
+ }
+ }
+ return set;
+ }
+
+ /**
+ * Produces the set of IDs for all possible toggle targets that can be used for
+ * the given part and selection.
+ *
+ * @param factoriesToQuery The collection of factories to check
+ * @param part active part
+ * @param selection active selection in part
+ * @return Set of toggle target IDs or an empty set
+ */
private Set<String> getEnabledTargetIDs(Set<IToggleBreakpointsTargetFactory> factoriesToQuery, IWorkbenchPart part, ISelection selection) {
Set<String> idsForSelection = new TreeSet<>();
for (IToggleBreakpointsTargetFactory factory : factoriesToQuery) {
for(String targetID : factory.getToggleTargets(part, selection)) {
- fFactoriesByTargetID.put(targetID, factory);
- idsForSelection.add(targetID);
- }
- }
- return idsForSelection;
- }
-
- @Override
+ fFactoriesByTargetID.put(targetID, factory);
+ idsForSelection.add(targetID);
+ }
+ }
+ return idsForSelection;
+ }
+
+ @Override
public Set<String> getEnabledToggleBreakpointsTargetIDs(IWorkbenchPart part, ISelection selection) {
- return getEnabledTargetIDs(getEnabledFactories(part, selection), part, selection);
- }
+ return getEnabledTargetIDs(getEnabledFactories(part, selection), part, selection);
+ }
- @Override
+ @Override
public String getPreferredToggleBreakpointsTargetID(IWorkbenchPart part, ISelection selection) {
Set<IToggleBreakpointsTargetFactory> factories = getEnabledFactories(part, selection);
Set<String> possibleIDs = getEnabledTargetIDs(factories, part, selection);
- return chooseToggleTargetIDInSet(possibleIDs, part, selection);
- }
+ return chooseToggleTargetIDInSet(possibleIDs, part, selection);
+ }
- @Override
+ @Override
public IToggleBreakpointsTarget getToggleBreakpointsTarget(IWorkbenchPart part, ISelection selection) {
- String id = getPreferredToggleBreakpointsTargetID(part, selection);
- IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(id);
- if (factory != null) {
- if (DEFAULT_TOGGLE_TARGET_ID.equals(id)) {
- return ((ToggleBreakpointsTargetAdapterFactory)factory).createDefaultToggleTarget(part, selection);
- } else {
- return factory.createToggleTarget(id);
- }
- }
- return null;
- }
-
- @Override
+ String id = getPreferredToggleBreakpointsTargetID(part, selection);
+ IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(id);
+ if (factory != null) {
+ if (DEFAULT_TOGGLE_TARGET_ID.equals(id)) {
+ return ((ToggleBreakpointsTargetAdapterFactory)factory).createDefaultToggleTarget(part, selection);
+ } else {
+ return factory.createToggleTarget(id);
+ }
+ }
+ return null;
+ }
+
+ @Override
public String getToggleBreakpointsTargetName(String id) {
- IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(id);
- if (factory != null) {
- return factory.getToggleTargetName(id);
- }
- return null;
- }
-
- @Override
+ IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(id);
+ if (factory != null) {
+ return factory.getToggleTargetName(id);
+ }
+ return null;
+ }
+
+ @Override
public String getToggleBreakpointsTargetDescription(String id) {
- IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(id);
- if (factory != null) {
- return factory.getToggleTargetDescription(id);
- }
- return null;
- }
-
- @Override
+ IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(id);
+ if (factory != null) {
+ return factory.getToggleTargetDescription(id);
+ }
+ return null;
+ }
+
+ @Override
public void addChangedListener(IToggleBreakpointsTargetManagerListener listener) {
- fChangedListners.add(listener);
- }
+ fChangedListners.add(listener);
+ }
- @Override
+ @Override
public void removeChangedListener(IToggleBreakpointsTargetManagerListener listener) {
- fChangedListners.remove(listener);
- }
-
- /**
- * Stores the map of preferred target IDs to the preference store in the format:
- *
- * Key1A,Key1B:Value1|Key2A,Key2B,Key2C:Value2|
- *
- * Where the sub keys (Key1A, Key1B, etc.) are the elements of the set used at the
- * key in the mapping and the values are the associated String value in the mapping.
- */
- private void storePreferredTargets() {
- StringBuilder buffer= new StringBuilder();
+ fChangedListners.remove(listener);
+ }
+
+ /**
+ * Stores the map of preferred target IDs to the preference store in the format:
+ *
+ * Key1A,Key1B:Value1|Key2A,Key2B,Key2C:Value2|
+ *
+ * Where the sub keys (Key1A, Key1B, etc.) are the elements of the set used at the
+ * key in the mapping and the values are the associated String value in the mapping.
+ */
+ private void storePreferredTargets() {
+ StringBuilder buffer= new StringBuilder();
for (Entry<Set<String>, String> entry : fPreferredTargets.entrySet()) {
for (String currentID : entry.getKey()) {
- buffer.append(currentID);
- buffer.append(',');
- }
- buffer.deleteCharAt(buffer.length()-1);
- buffer.append(':');
- buffer.append(entry.getValue());
- buffer.append('|');
- }
- IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
- if(prefs != null) {
- prefs.put(PREF_TARGETS, buffer.toString());
- }
- }
-
- /**
- * Loads the map of preferred target IDs from the preference store.
- *
- * @see #storePreferredTargets()
- */
- private void loadPreferredTargets() {
+ buffer.append(currentID);
+ buffer.append(',');
+ }
+ buffer.deleteCharAt(buffer.length()-1);
+ buffer.append(':');
+ buffer.append(entry.getValue());
+ buffer.append('|');
+ }
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
+ if(prefs != null) {
+ prefs.put(PREF_TARGETS, buffer.toString());
+ }
+ }
+
+ /**
+ * Loads the map of preferred target IDs from the preference store.
+ *
+ * @see #storePreferredTargets()
+ */
+ private void loadPreferredTargets() {
fPreferredTargets = new HashMap<>();
- String preferenceValue = Platform.getPreferencesService().getString(
- DebugUIPlugin.getUniqueIdentifier(),
- PREF_TARGETS,
- null,
- null);
- if(preferenceValue == null) {
- return;
- }
- StringTokenizer entryTokenizer = new StringTokenizer(preferenceValue,"|"); //$NON-NLS-1$
- while (entryTokenizer.hasMoreTokens()){
- String token = entryTokenizer.nextToken();
- int valueStart = token.indexOf(':');
- StringTokenizer keyTokenizer = new StringTokenizer(token.substring(0,valueStart),","); //$NON-NLS-1$
+ String preferenceValue = Platform.getPreferencesService().getString(
+ DebugUIPlugin.getUniqueIdentifier(),
+ PREF_TARGETS,
+ null,
+ null);
+ if(preferenceValue == null) {
+ return;
+ }
+ StringTokenizer entryTokenizer = new StringTokenizer(preferenceValue,"|"); //$NON-NLS-1$
+ while (entryTokenizer.hasMoreTokens()){
+ String token = entryTokenizer.nextToken();
+ int valueStart = token.indexOf(':');
+ StringTokenizer keyTokenizer = new StringTokenizer(token.substring(0,valueStart),","); //$NON-NLS-1$
Set<String> keys = new TreeSet<>();
- while (keyTokenizer.hasMoreTokens()){
- keys.add(keyTokenizer.nextToken());
- }
- fPreferredTargets.put(keys, token.substring(valueStart+1));
- }
- }
-
- /**
- * Adds or updates the mapping to set which target ID is preferred for a certain
- * set of possible IDs.
- *
- * @param possibleIDs The set of possible IDs
- * @param preferredID The preferred ID in the set.
- */
+ while (keyTokenizer.hasMoreTokens()){
+ keys.add(keyTokenizer.nextToken());
+ }
+ fPreferredTargets.put(keys, token.substring(valueStart+1));
+ }
+ }
+
+ /**
+ * Adds or updates the mapping to set which target ID is preferred for a certain
+ * set of possible IDs.
+ *
+ * @param possibleIDs The set of possible IDs
+ * @param preferredID The preferred ID in the set.
+ */
public void setPreferredTarget(Set<String> possibleIDs, String preferredID) {
- if (possibleIDs == null) {
+ if (possibleIDs == null) {
return;
}
- if (fKnownFactories == null) {
+ if (fKnownFactories == null) {
initializeFactories();
}
- if (fPreferredTargets == null){
- loadPreferredTargets();
- }
- String currentKey = fPreferredTargets.get(possibleIDs);
- if (currentKey == null || !currentKey.equals(preferredID)){
- fPreferredTargets.put(possibleIDs, preferredID);
- storePreferredTargets();
- firePreferredTargetsChanged();
- }
- }
-
- /**
- * Returns the preferred toggle target ID from the given set if the mapping has been set.
- *
- * @param possibleTargetIDs The set of possible toggle target IDs
- * @return The preferred ID or null
- */
+ if (fPreferredTargets == null){
+ loadPreferredTargets();
+ }
+ String currentKey = fPreferredTargets.get(possibleIDs);
+ if (currentKey == null || !currentKey.equals(preferredID)){
+ fPreferredTargets.put(possibleIDs, preferredID);
+ storePreferredTargets();
+ firePreferredTargetsChanged();
+ }
+ }
+
+ /**
+ * Returns the preferred toggle target ID from the given set if the mapping has been set.
+ *
+ * @param possibleTargetIDs The set of possible toggle target IDs
+ * @return The preferred ID or null
+ */
private String getUserPreferredTarget(Set<String> possibleTargetIDs) {
- if (fPreferredTargets == null){
- loadPreferredTargets();
- }
- return fPreferredTargets.get(possibleTargetIDs);
- }
-
- /**
- * Given a set of possible toggle target IDs, this method will determine which target is
- * preferred and should be used to toggle breakpoints. This method chooses a toggle target
- * by storing previous choices and can be set using a context menu.
- *
- * @param possibleTargetIDs The set of possible toggle target IDs
- * @param part The workbench part in which toggle target is to be used
- * @param selection The active selection to use with toggle target
- * @return The preferred toggle target ID or null
- */
+ if (fPreferredTargets == null){
+ loadPreferredTargets();
+ }
+ return fPreferredTargets.get(possibleTargetIDs);
+ }
+
+ /**
+ * Given a set of possible toggle target IDs, this method will determine which target is
+ * preferred and should be used to toggle breakpoints. This method chooses a toggle target
+ * by storing previous choices and can be set using a context menu.
+ *
+ * @param possibleTargetIDs The set of possible toggle target IDs
+ * @param part The workbench part in which toggle target is to be used
+ * @param selection The active selection to use with toggle target
+ * @return The preferred toggle target ID or null
+ */
private String chooseToggleTargetIDInSet(Set<String> possibleTargetIDs, IWorkbenchPart part, ISelection selection) {
- if (possibleTargetIDs == null || possibleTargetIDs.isEmpty()){
- return null;
- }
+ if (possibleTargetIDs == null || possibleTargetIDs.isEmpty()){
+ return null;
+ }
- String preferredID = getUserPreferredTarget(possibleTargetIDs);
+ String preferredID = getUserPreferredTarget(possibleTargetIDs);
- if (preferredID == null){
- // If there is no preferred pane already set, check the factories to see there is a default target
+ if (preferredID == null){
+ // If there is no preferred pane already set, check the factories to see there is a default target
Iterator<String> possibleIDsIterator = possibleTargetIDs.iterator();
- while (preferredID == null && possibleIDsIterator.hasNext()) {
- IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(possibleIDsIterator.next());
- if (factory != null) {
- preferredID = factory.getDefaultToggleTarget(part, selection);
- }
- }
- // If the factories don't have a default, just pick the first one.
- // Also make sure that the default is among the available toggle target
- // IDs (bug 352502).
- if (preferredID == null || !possibleTargetIDs.contains(preferredID)) {
- preferredID= possibleTargetIDs.iterator().next();
- }
- setPreferredTarget(possibleTargetIDs, preferredID);
- }
-
- return preferredID;
- }
-
- /**
- * Notifies the change listeners that the preferred targets changed.
- */
- private void firePreferredTargetsChanged() {
+ while (preferredID == null && possibleIDsIterator.hasNext()) {
+ IToggleBreakpointsTargetFactory factory = fFactoriesByTargetID.get(possibleIDsIterator.next());
+ if (factory != null) {
+ preferredID = factory.getDefaultToggleTarget(part, selection);
+ }
+ }
+ // If the factories don't have a default, just pick the first one.
+ // Also make sure that the default is among the available toggle target
+ // IDs (bug 352502).
+ if (preferredID == null || !possibleTargetIDs.contains(preferredID)) {
+ preferredID= possibleTargetIDs.iterator().next();
+ }
+ setPreferredTarget(possibleTargetIDs, preferredID);
+ }
+
+ return preferredID;
+ }
+
+ /**
+ * Notifies the change listeners that the preferred targets changed.
+ */
+ private void firePreferredTargetsChanged() {
for (IToggleBreakpointsTargetManagerListener iToggleBreakpointsTargetManagerListener : fChangedListners) {
iToggleBreakpointsTargetManagerListener.preferredTargetsChanged();
- }
- }
-
- public IBreakpoint getBeakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
- IDocumentProvider provider = editor.getDocumentProvider();
- if(provider == null) {
- return null;
- }
- IEditorInput input = editor.getEditorInput();
- IAnnotationModel annotationModel = provider.getAnnotationModel(input);
+ }
+ }
+
+ public IBreakpoint getBeakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
+ IDocumentProvider provider = editor.getDocumentProvider();
+ if(provider == null) {
+ return null;
+ }
+ IEditorInput input = editor.getEditorInput();
+ IAnnotationModel annotationModel = provider.getAnnotationModel(input);
if (annotationModel != null) {
IDocument document = provider.getDocument(input);
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
@@ -756,6 +756,6 @@ public class ToggleBreakpointsTargetManager implements IToggleBreakpointsTargetM
}
}
}
- return null;
- }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java
index 08c3118ba..8ae8e52b1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java
@@ -26,30 +26,30 @@ import org.eclipse.ui.IViewPart;
*/
public abstract class AbstractBreakpointsViewAction implements IViewActionDelegate, IActionDelegate2 {
- /**
- * The breakpoints view that this action has been contributed to.
- */
- protected BreakpointsView fView;
+ /**
+ * The breakpoints view that this action has been contributed to.
+ */
+ protected BreakpointsView fView;
- @Override
+ @Override
public void init(IViewPart view) {
- fView= (BreakpointsView) view;
- }
+ fView= (BreakpointsView) view;
+ }
@Override
public void selectionChanged(IAction action, ISelection selection) {
}
- @Override
+ @Override
public void dispose() {
- }
+ }
- @Override
+ @Override
public void init(IAction action) {
- }
+ }
- @Override
+ @Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java
index 7c2924527..0266e600c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java
@@ -29,18 +29,18 @@ public class AdvancedGroupBreakpointsByAction extends Action {
private BreakpointsView fView;
public AdvancedGroupBreakpointsByAction(BreakpointsView view) {
- super(IInternalDebugCoreConstants.EMPTY_STRING, IAction.AS_RADIO_BUTTON);
+ super(IInternalDebugCoreConstants.EMPTY_STRING, IAction.AS_RADIO_BUTTON);
fView= view;
}
@Override
public void run() {
- if (isChecked()) {
- GroupBreakpointsByDialog dialog = new GroupBreakpointsByDialog(fView);
- if (dialog.open() == Window.OK) {
- fView.setBreakpointOrganizers(dialog.getOrganizers());
- }
- }
+ if (isChecked()) {
+ GroupBreakpointsByDialog dialog = new GroupBreakpointsByDialog(fView);
+ if (dialog.open() == Window.OK) {
+ fView.setBreakpointOrganizers(dialog.getOrganizers());
+ }
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java
index eac4412df..2c6cdf1e6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java
@@ -21,26 +21,26 @@ import org.eclipse.ui.actions.SelectionListenerAction;
*/
public abstract class BreakpointSelectionAction extends SelectionListenerAction {
- private BreakpointsView fView;
+ private BreakpointsView fView;
- /**
- * Constructs an action for the breakpoints view.
- *
- * @param text action name
- * @param view breakpoints view
- */
- public BreakpointSelectionAction(String text, BreakpointsView view) {
- super(text);
- fView = view;
- }
+ /**
+ * Constructs an action for the breakpoints view.
+ *
+ * @param text action name
+ * @param view breakpoints view
+ */
+ public BreakpointSelectionAction(String text, BreakpointsView view) {
+ super(text);
+ fView = view;
+ }
- /**
- * Returns the breakpoints view.
- *
- * @return breakpoints view
- */
- protected BreakpointsView getBreakpointsView() {
- return fView;
- }
+ /**
+ * Returns the breakpoints view.
+ *
+ * @return breakpoints view
+ */
+ protected BreakpointsView getBreakpointsView() {
+ return fView;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java
index 4ae178eac..57233bed6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java
@@ -26,37 +26,37 @@ import org.eclipse.ui.IViewPart;
*/
public abstract class BreakpointWorkingSetAction extends AbstractBreakpointsViewAction implements IPropertyChangeListener {
- protected IAction fAction;
+ protected IAction fAction;
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- update();
- }
+ update();
+ }
- @Override
+ @Override
public void init(IViewPart view) {
- super.init(view);
- DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
- }
+ super.init(view);
+ DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+ }
- @Override
+ @Override
public void dispose() {
- DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
- super.dispose();
- }
- @Override
+ DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
+ super.dispose();
+ }
+ @Override
public void init(IAction action) {
- fAction = action;
- super.init(action);
- update();
- }
+ fAction = action;
+ super.init(action);
+ update();
+ }
- @Override
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME)) {
- update();
- }
+ if (event.getProperty().equals(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME)) {
+ update();
+ }
- }
- protected abstract void update();
+ }
+ protected abstract void update();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java
index d78ae062a..8bce2c6bc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java
@@ -21,13 +21,13 @@ import org.eclipse.jface.action.IAction;
*/
public class ClearDefaultBreakpointGroupAction extends BreakpointWorkingSetAction {
- @Override
+ @Override
public void run(IAction action) {
- BreakpointSetOrganizer.setDefaultWorkingSet(null);
- }
+ BreakpointSetOrganizer.setDefaultWorkingSet(null);
+ }
- @Override
+ @Override
protected void update() {
- fAction.setEnabled(BreakpointSetOrganizer.getDefaultWorkingSet() != null);
- }
+ fAction.setEnabled(BreakpointSetOrganizer.getDefaultWorkingSet() != null);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java
index 02a8f1ca4..53a3c1863 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsActionDelegate.java
@@ -48,14 +48,14 @@ public class CopyBreakpointsActionDelegate extends VirtualCopyToClipboardActionD
fStamp = System.currentTimeMillis();
LocalSelectionTransfer.getTransfer().setSelectionSetTime(fStamp);
IAction pasteAction = ((AbstractDebugView)getView()).getAction(IDebugView.PASTE_ACTION);
- // update the enablement of the paste action
- // workaround since the clipboard does not suppot callbacks
- if (pasteAction instanceof PasteBreakpointsAction) {
- PasteBreakpointsAction pba = (PasteBreakpointsAction) pasteAction;
- if (pba.getStructuredSelection() != null) {
- pba.selectionChanged(pba.getStructuredSelection());
- }
- }
+ // update the enablement of the paste action
+ // workaround since the clipboard does not suppot callbacks
+ if (pasteAction instanceof PasteBreakpointsAction) {
+ PasteBreakpointsAction pba = (PasteBreakpointsAction) pasteAction;
+ if (pba.getStructuredSelection() != null) {
+ pba.selectionChanged(pba.getStructuredSelection());
+ }
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java
index 4dd706d75..f85c6bd47 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java
@@ -38,9 +38,9 @@ public class EditBreakpointGroupAction extends AbstractBreakpointsViewAction {
@Override
public void run(IAction action) {
- IWorkingSetEditWizard editWizard = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetEditWizard(fSet);
- WizardDialog dialog = new WizardDialog(DebugUIPlugin.getShell(), editWizard);
- dialog.open();
+ IWorkingSetEditWizard editWizard = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetEditWizard(fSet);
+ WizardDialog dialog = new WizardDialog(DebugUIPlugin.getShell(), editWizard);
+ dialog.open();
}
@Override
@@ -49,17 +49,17 @@ public class EditBreakpointGroupAction extends AbstractBreakpointsViewAction {
if (sel instanceof IStructuredSelection) {
IStructuredSelection selection= (IStructuredSelection) sel;
- if (selection.size() == 1) {
- Object element = selection.getFirstElement();
+ if (selection.size() == 1) {
+ Object element = selection.getFirstElement();
if (element instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer)element;
- IAdaptable category = container.getCategory();
- if (category instanceof WorkingSetCategory) {
- IWorkingSet set = ((WorkingSetCategory)category).getWorkingSet();
- action.setEnabled(true);
- fSet = set;
- return;
- }
+ IBreakpointContainer container = (IBreakpointContainer)element;
+ IAdaptable category = container.getCategory();
+ if (category instanceof WorkingSetCategory) {
+ IWorkingSet set = ((WorkingSetCategory)category).getWorkingSet();
+ action.setEnabled(true);
+ fSet = set;
+ return;
+ }
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java
index 4ddc632a2..365efdeb9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java
@@ -26,39 +26,39 @@ import org.eclipse.jface.action.IAction;
*/
public class GroupBreakpointsAction extends Action {
- private IBreakpointOrganizer fOrganzier;
- private BreakpointsView fView;
+ private IBreakpointOrganizer fOrganzier;
+ private BreakpointsView fView;
- /**
- * Creates a new action which will group breakpoints in the given
- * breakpoint view using the given breakpoint container factory
- * @param factory the factory that will be applied to the given view
- * when this action is run
- * @param view the breakpoints view
- */
- public GroupBreakpointsAction(IBreakpointOrganizer organizer, BreakpointsView view) {
- super(IInternalDebugCoreConstants.EMPTY_STRING, IAction.AS_RADIO_BUTTON);
- fOrganzier= organizer;
- fView= view;
- }
+ /**
+ * Creates a new action which will group breakpoints in the given
+ * breakpoint view using the given breakpoint container factory
+ * @param factory the factory that will be applied to the given view
+ * when this action is run
+ * @param view the breakpoints view
+ */
+ public GroupBreakpointsAction(IBreakpointOrganizer organizer, BreakpointsView view) {
+ super(IInternalDebugCoreConstants.EMPTY_STRING, IAction.AS_RADIO_BUTTON);
+ fOrganzier= organizer;
+ fView= view;
+ }
- @Override
+ @Override
public void run() {
- if (isChecked()) {
- if (fOrganzier == null) {
- fView.setBreakpointOrganizers(null);
- } else {
- fView.setBreakpointOrganizers(new IBreakpointOrganizer[]{fOrganzier});
- }
- }
- }
+ if (isChecked()) {
+ if (fOrganzier == null) {
+ fView.setBreakpointOrganizers(null);
+ } else {
+ fView.setBreakpointOrganizers(new IBreakpointOrganizer[]{fOrganzier});
+ }
+ }
+ }
- /**
- * Returns this action's organizer.
- *
- * @return breakpoint organizer
- */
- public IBreakpointOrganizer getOrganizer() {
- return fOrganzier;
- }
+ /**
+ * Returns this action's organizer.
+ *
+ * @return breakpoint organizer
+ */
+ public IBreakpointOrganizer getOrganizer() {
+ return fOrganzier;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
index 524eb1591..cf304ff3a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
@@ -44,17 +44,17 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
public void run(IAction action) {
}
- @Override
+ @Override
public void dispose() {
- }
+ }
- @Override
+ @Override
public Menu getMenu(Control parent) {
- // Never called
- return null;
- }
+ // Never called
+ return null;
+ }
- @Override
+ @Override
public Menu getMenu(Menu parent) {
Menu menu = new Menu(parent);
menu.addMenuListener(new MenuAdapter() {
@@ -69,9 +69,9 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
}
});
return menu;
- }
+ }
- /**
+ /**
* Fill pull down menu with the "group by" options
*/
private void fillMenu(Menu menu) {
@@ -89,72 +89,72 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
organizer = organizers[0];
}
- int accel = 1;
- // Add hard-coded action for flat breakpoints list
- IAction action = new GroupBreakpointsAction(null, fView);
- addAccel(accel, action, BreakpointGroupMessages.GroupBreakpointsByAction_0);
- accel++;
- action.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS));
- action.setChecked(none);
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(menu, -1);
+ int accel = 1;
+ // Add hard-coded action for flat breakpoints list
+ IAction action = new GroupBreakpointsAction(null, fView);
+ addAccel(accel, action, BreakpointGroupMessages.GroupBreakpointsByAction_0);
+ accel++;
+ action.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS));
+ action.setChecked(none);
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(menu, -1);
// Add actions for each contributed organizer
List<IAction> actions = getActions(accel);
- accel = accel + actions.size();
+ accel = accel + actions.size();
Iterator<IAction> actionIter = actions.iterator();
- while (actionIter.hasNext()) {
+ while (actionIter.hasNext()) {
GroupBreakpointsAction bpAction = (GroupBreakpointsAction) actionIter.next();
bpAction.setChecked(bpAction.getOrganizer().equals(organizer));
item= new ActionContributionItem(bpAction);
item.fill(menu, -1);
- }
+ }
- // advanced action
- AdvancedGroupBreakpointsByAction advancedAction = new AdvancedGroupBreakpointsByAction(fView);
- addAccel(accel, advancedAction,BreakpointGroupMessages.GroupBreakpointsByAction_1);
- advancedAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_HIERARCHICAL));
- advancedAction.setChecked(advanced);
+ // advanced action
+ AdvancedGroupBreakpointsByAction advancedAction = new AdvancedGroupBreakpointsByAction(fView);
+ addAccel(accel, advancedAction,BreakpointGroupMessages.GroupBreakpointsByAction_1);
+ advancedAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_HIERARCHICAL));
+ advancedAction.setChecked(advanced);
item= new ActionContributionItem(advancedAction);
item.fill(menu, -1);
}
public List<IAction> getActions(int accel) {
List<IAction> actions = new ArrayList<>();
- IBreakpointOrganizer[] organizers = BreakpointOrganizerManager.getDefault().getOrganizers();
- for (int i = 0; i < organizers.length; i++) {
- IBreakpointOrganizer organizer = organizers[i];
- IAction action = new GroupBreakpointsAction(organizer, fView);
- addAccel(accel, action, organizer.getLabel());
- accel++;
- action.setImageDescriptor(organizer.getImageDescriptor());
- actions.add(action);
- }
- return actions;
- }
-
- private void addAccel(int accel, IAction action, String label) {
- StringBuilder actionLabel= new StringBuilder();
- if (accel != 10) {
- if (accel < 10) {
- // add the numerical accelerators 1 through 9
- actionLabel.append('&');
- }
- actionLabel.append(accel);
- } else {
- actionLabel.append("1&0"); //$NON-NLS-1$
- }
- accel++;
- actionLabel.append(' ');
- actionLabel.append(label);
- action.setText(actionLabel.toString());
- }
+ IBreakpointOrganizer[] organizers = BreakpointOrganizerManager.getDefault().getOrganizers();
+ for (int i = 0; i < organizers.length; i++) {
+ IBreakpointOrganizer organizer = organizers[i];
+ IAction action = new GroupBreakpointsAction(organizer, fView);
+ addAccel(accel, action, organizer.getLabel());
+ accel++;
+ action.setImageDescriptor(organizer.getImageDescriptor());
+ actions.add(action);
+ }
+ return actions;
+ }
+
+ private void addAccel(int accel, IAction action, String label) {
+ StringBuilder actionLabel= new StringBuilder();
+ if (accel != 10) {
+ if (accel < 10) {
+ // add the numerical accelerators 1 through 9
+ actionLabel.append('&');
+ }
+ actionLabel.append(accel);
+ } else {
+ actionLabel.append("1&0"); //$NON-NLS-1$
+ }
+ accel++;
+ actionLabel.append(' ');
+ actionLabel.append(label);
+ action.setText(actionLabel.toString());
+ }
@Override
public void selectionChanged(IAction action, ISelection selection) {
- if (action != fAction) {
- action.setMenuCreator(this);
- fAction= action;
- }
+ if (action != fAction) {
+ action.setMenuCreator(this);
+ fAction= action;
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
index 4dcefe773..5635b98fe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
@@ -113,7 +113,7 @@ public class GroupBreakpointsByDialog extends TrayDialog {
Composite composite= new Composite(parentComposite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
- composite.setLayout(layout);
+ composite.setLayout(layout);
GridData data= new GridData(GridData.FILL_BOTH);
data.heightHint= 400;
composite.setLayoutData(data);
@@ -123,7 +123,7 @@ public class GroupBreakpointsByDialog extends TrayDialog {
label.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_0);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
- label.setLayoutData(gridData);
+ label.setLayoutData(gridData);
createAvailableViewer(composite, labelProvider);
createButtons(composite);
@@ -152,11 +152,11 @@ public class GroupBreakpointsByDialog extends TrayDialog {
fAvailableOrganizersProvider.addAvailable(organizers[i]);
}
organizers = fView.getBreakpointOrganizers();
- if (organizers != null) {
- for (int i = 0; i < organizers.length; i++) {
- fSelectedOrganizersProvider.addSelected(organizers[i]);
- }
- }
+ if (organizers != null) {
+ for (int i = 0; i < organizers.length; i++) {
+ fSelectedOrganizersProvider.addSelected(organizers[i]);
+ }
+ }
}
/**
@@ -177,7 +177,7 @@ public class GroupBreakpointsByDialog extends TrayDialog {
Label label= new Label(availableComposite, SWT.WRAP);
label.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_1);
gridData = new GridData(GridData.FILL_HORIZONTAL);
- label.setLayoutData(gridData);
+ label.setLayoutData(gridData);
fAvailableViewer= new TableViewer(availableComposite);
fAvailableViewer.setContentProvider(fAvailableOrganizersProvider);
@@ -220,7 +220,7 @@ public class GroupBreakpointsByDialog extends TrayDialog {
label.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_3);
gridData = new GridData();
gridData.horizontalSpan = 2;
- label.setLayoutData(gridData);
+ label.setLayoutData(gridData);
fSelectedViewer= new TreeViewer(selectedComposite);
fSelectedViewer.setContentProvider(fSelectedOrganizersProvider);
@@ -230,11 +230,11 @@ public class GroupBreakpointsByDialog extends TrayDialog {
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
tree.setFont(parent.getFont());
fSelectedViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
+ @Override
public void doubleClick(DoubleClickEvent event) {
- handleRemovePressed();
- }
- });
+ handleRemovePressed();
+ }
+ });
fSelectedViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
@@ -405,13 +405,13 @@ public class GroupBreakpointsByDialog extends TrayDialog {
/**
* Content provider that provides the list of breakpoint organaisers
- * that are available but not currently selected.
+ * that are available but not currently selected.
*/
private class AvailableOrganizersProvider implements IStructuredContentProvider {
protected List<IBreakpointOrganizer> availableOrganziers = new ArrayList<>();
public void addAvailable(IBreakpointOrganizer organizer) {
- availableOrganziers.add(organizer);
+ availableOrganziers.add(organizer);
fSelectedOrganizersProvider.selectedOrganizers.remove(organizer);
}
@@ -437,23 +437,23 @@ public class GroupBreakpointsByDialog extends TrayDialog {
protected List<Object> selectedOrganizers = new ArrayList<>();
public void addSelected(IBreakpointOrganizer organizer) {
- selectedOrganizers.add(organizer);
+ selectedOrganizers.add(organizer);
fAvailableOrganizersProvider.availableOrganziers.remove(organizer);
}
public void moveUp(Object object) {
int index = selectedOrganizers.indexOf(object);
if (index > 0) {
- selectedOrganizers.remove(object);
- selectedOrganizers.add(index - 1, object);
+ selectedOrganizers.remove(object);
+ selectedOrganizers.add(index - 1, object);
}
}
public void moveDown(Object object) {
int index = selectedOrganizers.indexOf(object);
if (index < selectedOrganizers.size() - 1) {
- selectedOrganizers.remove(object);
- selectedOrganizers.add(index + 1, object);
+ selectedOrganizers.remove(object);
+ selectedOrganizers.add(index + 1, object);
}
}
@@ -533,9 +533,9 @@ public class GroupBreakpointsByDialog extends TrayDialog {
}
}
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_7);
- }
+ super.configureShell(shell);
+ shell.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_7);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java
index 8cf07a7de..9a3c0ad82 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java
@@ -33,60 +33,60 @@ import org.eclipse.ui.PlatformUI;
*/
public class PasteBreakpointsAction extends BreakpointSelectionAction {
- /**
- * Creates a new action.
- *
- * @param view the view of this action
- */
- public PasteBreakpointsAction(BreakpointsView view) {
- super(BreakpointGroupMessages.PasteBreakpointsAction_0, view);
- setToolTipText(BreakpointGroupMessages.PasteBreakpointsAction_1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PASTE_BREAKPOINTS_ACTION);
- }
+ /**
+ * Creates a new action.
+ *
+ * @param view the view of this action
+ */
+ public PasteBreakpointsAction(BreakpointsView view) {
+ super(BreakpointGroupMessages.PasteBreakpointsAction_0, view);
+ setToolTipText(BreakpointGroupMessages.PasteBreakpointsAction_1);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PASTE_BREAKPOINTS_ACTION);
+ }
- /**
- * Returns the actual target of the paste action. Returns null
- * if no valid target is selected.
- *
- * @return the actual target of the paste action
- */
- private Object getTarget() {
+ /**
+ * Returns the actual target of the paste action. Returns null
+ * if no valid target is selected.
+ *
+ * @return the actual target of the paste action
+ */
+ private Object getTarget() {
List<?> selectedNonResources = getSelectedNonResources();
- if (selectedNonResources.size() == 1) {
- Object target = selectedNonResources.get(0);
- if (target instanceof IBreakpointContainer) {
- return target;
- }
- }
- return null;
- }
+ if (selectedNonResources.size() == 1) {
+ Object target = selectedNonResources.get(0);
+ if (target instanceof IBreakpointContainer) {
+ return target;
+ }
+ }
+ return null;
+ }
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- @Override
+ /**
+ * Implementation of method defined on <code>IAction</code>.
+ */
+ @Override
public void run() {
if (getBreakpointsView().canPaste(getTarget(), LocalSelectionTransfer.getTransfer().getSelection())) {
getBreakpointsView().performPaste(getTarget(), LocalSelectionTransfer.getTransfer().getSelection());
}
- }
+ }
- /**
- * Returns whether this action should be enabled based on the selection
- * in the clipboard. Only updates when the breakpoints view has focus.
- */
- @Override
+ /**
+ * Returns whether this action should be enabled based on the selection
+ * in the clipboard. Only updates when the breakpoints view has focus.
+ */
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
- // can't paste into "Others" (only move)
- Object target = getTarget();
- if (target instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) target;
- if (container.getCategory() instanceof OtherBreakpointCategory) {
- return false;
- }
+ // can't paste into "Others" (only move)
+ Object target = getTarget();
+ if (target instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) target;
+ if (container.getCategory() instanceof OtherBreakpointCategory) {
+ return false;
+ }
return true;
- }
+ }
// don't access clipboard - causes Hang -see bug 84870
return false;
- }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
index 5b39f7701..8f39efebf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
@@ -32,88 +32,88 @@ import org.eclipse.jface.viewers.TreePath;
*/
public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
- private BreakpointSetElement[] fBreakpoints;
+ private BreakpointSetElement[] fBreakpoints;
/**
- * Constructs action to remove breakpoints from a category.
- *
- * @param view
- */
- public RemoveFromWorkingSetAction(BreakpointsView view) {
- super(BreakpointGroupMessages.RemoveFromWorkingSetAction_0, view);
- }
-
- @Override
+ * Constructs action to remove breakpoints from a category.
+ *
+ * @param view
+ */
+ public RemoveFromWorkingSetAction(BreakpointsView view) {
+ super(BreakpointGroupMessages.RemoveFromWorkingSetAction_0, view);
+ }
+
+ @Override
public void run() {
- if (fBreakpoints != null) {
- for (int i = 0; i < fBreakpoints.length; i++) {
- fBreakpoints[i].container.getOrganizer().removeBreakpoint(fBreakpoints[i].breakpoint, fBreakpoints[i].container.getCategory());
- }
- }
- }
-
- protected static class BreakpointSetElement {
- BreakpointSetElement(IBreakpoint b, IBreakpointContainer c) { breakpoint = b; container = c; }
- IBreakpoint breakpoint;
- IBreakpointContainer container;
- }
-
- /**
- * Returns a array of breakpoint/container pairs for the selection
- *
- * All the returned elements contain a breakpoint and a working set container the breakpoint is contained and the breakpoint
- * can be removed from.
- *
- * @param selection
- * @return
- */
- protected BreakpointSetElement[] getRemovableBreakpoints(IStructuredSelection selection) {
+ if (fBreakpoints != null) {
+ for (int i = 0; i < fBreakpoints.length; i++) {
+ fBreakpoints[i].container.getOrganizer().removeBreakpoint(fBreakpoints[i].breakpoint, fBreakpoints[i].container.getCategory());
+ }
+ }
+ }
+
+ protected static class BreakpointSetElement {
+ BreakpointSetElement(IBreakpoint b, IBreakpointContainer c) { breakpoint = b; container = c; }
+ IBreakpoint breakpoint;
+ IBreakpointContainer container;
+ }
+
+ /**
+ * Returns a array of breakpoint/container pairs for the selection
+ *
+ * All the returned elements contain a breakpoint and a working set container the breakpoint is contained and the breakpoint
+ * can be removed from.
+ *
+ * @param selection
+ * @return
+ */
+ protected BreakpointSetElement[] getRemovableBreakpoints(IStructuredSelection selection) {
List<BreakpointSetElement> res = new ArrayList<>();
- if (selection instanceof ITreeSelection) {
- ITreeSelection tSel = (ITreeSelection)selection;
-
- TreePath[] paths = tSel.getPaths();
- for (int i = 0; i < paths.length; i++) {
- TreePath path = paths[i];
-
- // We can remove Breakpoints from their working set if any of their parents is a non "Other" breakpoint working set
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
- if (breakpoint != null) {
- TreePath parents = path.getParentPath();
-
- for (int j = 0; j < parents.getSegmentCount(); j++) {
- Object parent = parents.getSegment(j);
-
- if (parent instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer)parent;
-
- // Test if this is a working set container.
- if (container.getCategory() instanceof WorkingSetCategory) {
- // Test if this container allows to remove this breakpoint.
- if (container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
- res.add(new BreakpointSetElement(breakpoint, container));
- }
- }
- }
- }
- }
- }
- }
- return res.toArray(new BreakpointSetElement[res.size()]);
- }
-
- @Override
+ if (selection instanceof ITreeSelection) {
+ ITreeSelection tSel = (ITreeSelection)selection;
+
+ TreePath[] paths = tSel.getPaths();
+ for (int i = 0; i < paths.length; i++) {
+ TreePath path = paths[i];
+
+ // We can remove Breakpoints from their working set if any of their parents is a non "Other" breakpoint working set
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
+ if (breakpoint != null) {
+ TreePath parents = path.getParentPath();
+
+ for (int j = 0; j < parents.getSegmentCount(); j++) {
+ Object parent = parents.getSegment(j);
+
+ if (parent instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer)parent;
+
+ // Test if this is a working set container.
+ if (container.getCategory() instanceof WorkingSetCategory) {
+ // Test if this container allows to remove this breakpoint.
+ if (container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
+ res.add(new BreakpointSetElement(breakpoint, container));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return res.toArray(new BreakpointSetElement[res.size()]);
+ }
+
+ @Override
public boolean isEnabled() {
- if(fBreakpoints != null) {
- return fBreakpoints.length > 0;
- }
- return false;
- }
+ if(fBreakpoints != null) {
+ return fBreakpoints.length > 0;
+ }
+ return false;
+ }
- @Override
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
- fBreakpoints = getRemovableBreakpoints(selection);
- return fBreakpoints.length > 0;
- }
+ fBreakpoints = getRemovableBreakpoints(selection);
+ return fBreakpoints.length > 0;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java
index 6b7936e6b..344700d66 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java
@@ -25,20 +25,20 @@ import org.eclipse.ui.IWorkingSet;
*/
public class SetDefaultBreakpointGroupAction extends AbstractBreakpointsViewAction {
- @Override
+ @Override
public void run(IAction action) {
- SelectBreakpointWorkingsetDialog sbwsd = new SelectBreakpointWorkingsetDialog(DebugUIPlugin.getShell());
- sbwsd.setTitle(BreakpointGroupMessages.SetDefaultBreakpointGroupAction_0);
- IWorkingSet workingSet = BreakpointSetOrganizer.getDefaultWorkingSet();
- if (workingSet != null){
- sbwsd.setInitialSelections(new Object[]{workingSet});
- }
- if(sbwsd.open() == Window.OK) {
- BreakpointSetOrganizer.setDefaultWorkingSet((IWorkingSet) sbwsd.getResult()[0]);
- }
- }
+ SelectBreakpointWorkingsetDialog sbwsd = new SelectBreakpointWorkingsetDialog(DebugUIPlugin.getShell());
+ sbwsd.setTitle(BreakpointGroupMessages.SetDefaultBreakpointGroupAction_0);
+ IWorkingSet workingSet = BreakpointSetOrganizer.getDefaultWorkingSet();
+ if (workingSet != null){
+ sbwsd.setInitialSelections(new Object[]{workingSet});
+ }
+ if(sbwsd.open() == Window.OK) {
+ BreakpointSetOrganizer.setDefaultWorkingSet((IWorkingSet) sbwsd.getResult()[0]);
+ }
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java
index 3f9df0015..4d406d6b3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java
@@ -27,42 +27,42 @@ import org.eclipse.ui.IWorkingSet;
*/
public class ToggleDefaultGroupAction extends AbstractBreakpointsViewAction {
- private IWorkingSet fSelectedSet;
+ private IWorkingSet fSelectedSet;
- @Override
+ @Override
public void run(IAction action) {
- IWorkingSet defaultWorkingSet = BreakpointSetOrganizer.getDefaultWorkingSet();
- IWorkingSet set = null;
- if (!fSelectedSet.equals(defaultWorkingSet)) {
- set = fSelectedSet;
- }
- BreakpointSetOrganizer.setDefaultWorkingSet(set);
- }
+ IWorkingSet defaultWorkingSet = BreakpointSetOrganizer.getDefaultWorkingSet();
+ IWorkingSet set = null;
+ if (!fSelectedSet.equals(defaultWorkingSet)) {
+ set = fSelectedSet;
+ }
+ BreakpointSetOrganizer.setDefaultWorkingSet(set);
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection sel) {
- fSelectedSet = null;
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) sel;
- if (selection.size() == 1) {
- Object firstElement = selection.getFirstElement();
- if (firstElement instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) firstElement;
- if (container.getCategory() instanceof WorkingSetCategory) {
- WorkingSetCategory category = (WorkingSetCategory)container.getCategory();
- if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(category.getWorkingSet().getId())) {
- IWorkingSet set = category.getWorkingSet();
- action.setEnabled(true);
- boolean isDefault = set == BreakpointSetOrganizer.getDefaultWorkingSet();
- action.setChecked(isDefault);
- fSelectedSet = set;
- return;
- }
- }
- }
- }
- }
- action.setEnabled(false);
- action.setChecked(false);
- }
+ fSelectedSet = null;
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ if (selection.size() == 1) {
+ Object firstElement = selection.getFirstElement();
+ if (firstElement instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) firstElement;
+ if (container.getCategory() instanceof WorkingSetCategory) {
+ WorkingSetCategory category = (WorkingSetCategory)container.getCategory();
+ if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(category.getWorkingSet().getId())) {
+ IWorkingSet set = category.getWorkingSet();
+ action.setEnabled(true);
+ boolean isDefault = set == BreakpointSetOrganizer.getDefaultWorkingSet();
+ action.setChecked(isDefault);
+ fSelectedSet = set;
+ return;
+ }
+ }
+ }
+ }
+ }
+ action.setEnabled(false);
+ action.setChecked(false);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java
index cbeab4594..be3df6af9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java
@@ -24,12 +24,12 @@ import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
*/
public class WorkingSetsAction extends AbstractBreakpointsViewAction {
- @Override
+ @Override
public void run(IAction action) {
- IWorkingSetSelectionDialog selectionDialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(
- DebugUIPlugin.getShell(),
- false,
- new String[] {IDebugUIConstants.BREAKPOINT_WORKINGSET_ID});
- selectionDialog.open();
- }
+ IWorkingSetSelectionDialog selectionDialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(
+ DebugUIPlugin.getShell(),
+ false,
+ new String[] {IDebugUIConstants.BREAKPOINT_WORKINGSET_ID});
+ selectionDialog.open();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java
index e98aa12a0..c1c8d1965 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java
@@ -40,17 +40,17 @@ public class SortBreakpointsByAction extends AbstractBreakpointsViewAction imple
public void run(IAction action) {
}
- @Override
+ @Override
public void dispose() {
- }
+ }
- @Override
+ @Override
public Menu getMenu(Control parent) {
- // Never called
- return null;
- }
+ // Never called
+ return null;
+ }
- @Override
+ @Override
public Menu getMenu(Menu parent) {
Menu menu = new Menu(parent);
menu.addMenuListener(new MenuAdapter() {
@@ -65,9 +65,9 @@ public class SortBreakpointsByAction extends AbstractBreakpointsViewAction imple
}
});
return menu;
- }
+ }
- /**
+ /**
* Fill pull down menu with the "group by" options
*/
private void fillMenu(Menu menu) {
@@ -86,9 +86,9 @@ public class SortBreakpointsByAction extends AbstractBreakpointsViewAction imple
@Override
public void selectionChanged(IAction action, ISelection selection) {
- if (action != fAction) {
- action.setMenuCreator(this);
- fAction= action;
- }
+ if (action != fAction) {
+ action.setMenuCreator(this);
+ fAction= action;
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/AccessWatchpointToggleAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/AccessWatchpointToggleAction.java
index b83810354..186e8ae09 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/AccessWatchpointToggleAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/AccessWatchpointToggleAction.java
@@ -21,23 +21,23 @@ import org.eclipse.debug.core.model.IWatchpoint;
*/
public class AccessWatchpointToggleAction extends ModifyWatchpointAction {
- @Override
+ @Override
protected boolean isEnabled(IWatchpoint watchpoint) {
- return watchpoint.supportsAccess();
- }
+ return watchpoint.supportsAccess();
+ }
- @Override
+ @Override
protected void toggleWatchpoint(IWatchpoint watchpoint, boolean b) throws CoreException {
- watchpoint.setAccess(b);
- }
+ watchpoint.setAccess(b);
+ }
- @Override
+ @Override
protected boolean isChecked(IWatchpoint watchpoint) {
- try {
- return watchpoint.isAccess();
- } catch (CoreException e) {
- }
- return false;
- }
+ try {
+ return watchpoint.isAccess();
+ } catch (CoreException e) {
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java
index 094a8634c..5727490ad 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java
@@ -44,11 +44,11 @@ public class BreakpointsCollapseAllAction implements IViewActionDelegate, IActio
@Override
public void init(IViewPart view) {
fView = (AbstractDebugView) view;
- IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)fView.getViewer();
- if (viewer != null) {
- viewer.addViewerUpdateListener(this);
- viewer.addModelChangedListener(this);
- }
+ IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)fView.getViewer();
+ if (viewer != null) {
+ viewer.addViewerUpdateListener(this);
+ viewer.addModelChangedListener(this);
+ }
}
@Override
@@ -62,11 +62,11 @@ public class BreakpointsCollapseAllAction implements IViewActionDelegate, IActio
@Override
public void dispose() {
- ITreeModelViewer viewer = (ITreeModelViewer)fView.getViewer();
- if (viewer != null) {
- viewer.removeViewerUpdateListener(this);
- viewer.removeModelChangedListener(this);
- }
+ ITreeModelViewer viewer = (ITreeModelViewer)fView.getViewer();
+ if (viewer != null) {
+ viewer.removeViewerUpdateListener(this);
+ viewer.removeModelChangedListener(this);
+ }
}
@Override
@@ -80,36 +80,36 @@ public class BreakpointsCollapseAllAction implements IViewActionDelegate, IActio
run(action);
}
- @Override
+ @Override
public void viewerUpdatesBegin() {
- }
+ }
- @Override
+ @Override
public void viewerUpdatesComplete() {
- }
+ }
- @Override
+ @Override
public void updateStarted(IViewerUpdate update) {
- }
+ }
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {
- if (!update.isCanceled()) {
- if (TreePath.EMPTY.equals(update.getElementPath())) {
- update();
- }
- }
- }
-
- private void update() {
- IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)fView.getViewer();
- if (viewer != null && fAction != null) {
- fAction.setEnabled(viewer.getInput() != null && viewer.getChildCount(TreePath.EMPTY) > 0);
- }
- }
-
- @Override
+ if (!update.isCanceled()) {
+ if (TreePath.EMPTY.equals(update.getElementPath())) {
+ update();
+ }
+ }
+ }
+
+ private void update() {
+ IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)fView.getViewer();
+ if (viewer != null && fAction != null) {
+ fAction.setEnabled(viewer.getInput() != null && viewer.getChildCount(TreePath.EMPTY) > 0);
+ }
+ }
+
+ @Override
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- update();
- }
+ update();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java
index 849bd741a..3792bb28d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java
@@ -35,32 +35,32 @@ import org.eclipse.ui.IViewPart;
*/
public class BreakpointsExpandAllAction implements IViewActionDelegate, IActionDelegate2, IViewerUpdateListener, IModelChangedListener {
- private IAction fAction;
+ private IAction fAction;
private BreakpointsView fView;
- @Override
+ @Override
public void init(IAction action) {
- fAction = action;
- }
+ fAction = action;
+ }
@Override
public void init(IViewPart view) {
fView = (BreakpointsView) view;
IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)fView.getViewer();
if (viewer != null) {
- viewer.addViewerUpdateListener(this);
- viewer.addModelChangedListener(this);
+ viewer.addViewerUpdateListener(this);
+ viewer.addModelChangedListener(this);
}
}
- @Override
+ @Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
@Override
public void run(IAction action) {
- fView.expandAllElementsInViewer();
+ fView.expandAllElementsInViewer();
}
@Override
@@ -68,45 +68,45 @@ public class BreakpointsExpandAllAction implements IViewActionDelegate, IActionD
}
- @Override
+ @Override
public void dispose() {
- ITreeModelViewer viewer = (ITreeModelViewer)fView.getViewer();
- if (viewer != null) {
- viewer.removeViewerUpdateListener(this);
- viewer.removeModelChangedListener(this);
- }
- }
-
- @Override
+ ITreeModelViewer viewer = (ITreeModelViewer)fView.getViewer();
+ if (viewer != null) {
+ viewer.removeViewerUpdateListener(this);
+ viewer.removeModelChangedListener(this);
+ }
+ }
+
+ @Override
public void viewerUpdatesBegin() {
- }
+ }
- @Override
+ @Override
public void viewerUpdatesComplete() {
- }
+ }
- @Override
+ @Override
public void updateStarted(IViewerUpdate update) {
- }
+ }
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {
- if (!update.isCanceled()) {
- if (TreePath.EMPTY.equals(update.getElementPath())) {
- update();
- }
- }
- }
-
- private void update() {
- IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)fView.getViewer();
- if (viewer != null && fAction != null) {
- fAction.setEnabled(viewer.getInput() != null && viewer.getChildCount(TreePath.EMPTY) > 0);
- }
- }
-
- @Override
+ if (!update.isCanceled()) {
+ if (TreePath.EMPTY.equals(update.getElementPath())) {
+ update();
+ }
+ }
+ }
+
+ private void update() {
+ IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)fView.getViewer();
+ if (viewer != null && fAction != null) {
+ fAction.setEnabled(viewer.getInput() != null && viewer.getChildCount(TreePath.EMPTY) > 0);
+ }
+ }
+
+ @Override
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- update();
- }
+ update();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
index dfb5c959d..1d7fbfe49 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
@@ -150,20 +150,20 @@ public class EnableBreakpointsAction implements IViewActionDelegate, IPartListen
boolean allDisabled= true;
while (itr.hasNext()) {
Object selected= itr.next();
- IBreakpoint bp = (IBreakpoint)DebugPlugin.getAdapter(selected, IBreakpoint.class);
-
- if (bp != null) {
- try {
- if (bp.isEnabled()) {
- allDisabled= false;
- } else {
- allEnabled= false;
- }
- } catch (CoreException ce) {
- handleException(ce);
- }
- }
- else if (selected instanceof IBreakpointContainer) {
+ IBreakpoint bp = (IBreakpoint)DebugPlugin.getAdapter(selected, IBreakpoint.class);
+
+ if (bp != null) {
+ try {
+ if (bp.isEnabled()) {
+ allDisabled= false;
+ } else {
+ allEnabled= false;
+ }
+ } catch (CoreException ce) {
+ handleException(ce);
+ }
+ }
+ else if (selected instanceof IBreakpointContainer) {
IBreakpoint[] breakpoints = ((IBreakpointContainer) selected).getBreakpoints();
for (int i = 0; i < breakpoints.length; i++) {
try {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModificationWatchpointToggleAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModificationWatchpointToggleAction.java
index f5289d267..e179cbc3e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModificationWatchpointToggleAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModificationWatchpointToggleAction.java
@@ -21,23 +21,23 @@ import org.eclipse.debug.core.model.IWatchpoint;
*/
public class ModificationWatchpointToggleAction extends ModifyWatchpointAction {
- @Override
+ @Override
protected boolean isEnabled(IWatchpoint watchpoint) {
- return watchpoint.supportsModification();
- }
+ return watchpoint.supportsModification();
+ }
- @Override
+ @Override
protected void toggleWatchpoint(IWatchpoint watchpoint, boolean b) throws CoreException {
- watchpoint.setModification(b);
- }
+ watchpoint.setModification(b);
+ }
- @Override
+ @Override
protected boolean isChecked(IWatchpoint watchpoint) {
- try {
- return watchpoint.isModification();
- } catch (CoreException e) {
- }
- return false;
- }
+ try {
+ return watchpoint.isModification();
+ } catch (CoreException e) {
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModifyWatchpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModifyWatchpointAction.java
index 505a62454..096fde496 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModifyWatchpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ModifyWatchpointAction.java
@@ -32,88 +32,88 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public abstract class ModifyWatchpointAction implements IObjectActionDelegate, IActionDelegate2 {
- private IStructuredSelection fWatchpoints = null;
+ private IStructuredSelection fWatchpoints = null;
- @Override
+ @Override
public void run(IAction action) {
- try {
- if (fWatchpoints != null) {
+ try {
+ if (fWatchpoints != null) {
Iterator<?> iterator = fWatchpoints.iterator();
- while (iterator.hasNext()) {
- IWatchpoint watchpoint = (IWatchpoint)iterator.next();
- toggleWatchpoint(watchpoint, action.isChecked());
- }
- }
- } catch (CoreException e) {
- DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), ActionMessages.ModifyWatchpointAction_0, ActionMessages.ModifyWatchpointAction_1, e.getStatus()); //
- }
+ while (iterator.hasNext()) {
+ IWatchpoint watchpoint = (IWatchpoint)iterator.next();
+ toggleWatchpoint(watchpoint, action.isChecked());
+ }
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), ActionMessages.ModifyWatchpointAction_0, ActionMessages.ModifyWatchpointAction_1, e.getStatus()); //
+ }
- }
+ }
- /**
- * Toggles the watch point attribute to the given value.
- *
- * @param watchpoint the watchpoint to toggle
- * @param b on or off
- * @throws CoreException if an exception occurs
- */
- protected abstract void toggleWatchpoint(IWatchpoint watchpoint, boolean b) throws CoreException;
+ /**
+ * Toggles the watch point attribute to the given value.
+ *
+ * @param watchpoint the watchpoint to toggle
+ * @param b on or off
+ * @throws CoreException if an exception occurs
+ */
+ protected abstract void toggleWatchpoint(IWatchpoint watchpoint, boolean b) throws CoreException;
- @Override
+ @Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- fWatchpoints = (IStructuredSelection) selection;
- if (!selection.isEmpty()) {
+ if (selection instanceof IStructuredSelection) {
+ fWatchpoints = (IStructuredSelection) selection;
+ if (!selection.isEmpty()) {
Iterator<?> iterator = fWatchpoints.iterator();
- while (iterator.hasNext()) {
- Object next = iterator.next();
- if (next instanceof IWatchpoint) {
- IWatchpoint watchpoint = (IWatchpoint) next;
- action.setChecked(isChecked(watchpoint));
- if (!isEnabled(watchpoint)) {
- action.setEnabled(false);
- return;
- }
- }
- }
- action.setEnabled(true);
- return;
- }
- }
- action.setEnabled(false);
- }
+ while (iterator.hasNext()) {
+ Object next = iterator.next();
+ if (next instanceof IWatchpoint) {
+ IWatchpoint watchpoint = (IWatchpoint) next;
+ action.setChecked(isChecked(watchpoint));
+ if (!isEnabled(watchpoint)) {
+ action.setEnabled(false);
+ return;
+ }
+ }
+ }
+ action.setEnabled(true);
+ return;
+ }
+ }
+ action.setEnabled(false);
+ }
- /**
- * Returns whether the action should be checke for the current selection
- *
- * @param watchpoint selected watchpoint
- * @return whether the action should be checked for the current selection
- */
- protected abstract boolean isChecked(IWatchpoint watchpoint);
+ /**
+ * Returns whether the action should be checke for the current selection
+ *
+ * @param watchpoint selected watchpoint
+ * @return whether the action should be checked for the current selection
+ */
+ protected abstract boolean isChecked(IWatchpoint watchpoint);
- /**
- * Returns whether this action is enabled for the given watchpoint.
- *
- * @param watchpoint the watchpoint to examine
- * @return whether this action is enabled for the given watchpoint
- */
- protected abstract boolean isEnabled(IWatchpoint watchpoint);
+ /**
+ * Returns whether this action is enabled for the given watchpoint.
+ *
+ * @param watchpoint the watchpoint to examine
+ * @return whether this action is enabled for the given watchpoint
+ */
+ protected abstract boolean isEnabled(IWatchpoint watchpoint);
- @Override
+ @Override
public void init(IAction action) {
- }
+ }
- @Override
+ @Override
public void dispose() {
- fWatchpoints = null;
- }
+ fWatchpoints = null;
+ }
- @Override
+ @Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java
index da7c25c57..aebb39bfd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java
@@ -69,13 +69,13 @@ public class OpenBreakpointMarkerAction extends SelectionProviderAction {
IEditorPart part= null;
if (input != null) {
String editorId = fgPresentation.getEditorId(input, breakpoint);
- if (editorId != null) {
- try {
- part= page.openEditor(input, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
- } catch (PartInitException e) {
- DebugUIPlugin.errorDialog(dwindow.getShell(), ActionMessages.OpenBreakpointMarkerAction_Go_to_Breakpoint_1, ActionMessages.OpenBreakpointMarkerAction_Exceptions_occurred_attempting_to_open_the_editor_for_the_breakpoint_resource_2, e); //
- }
- }
+ if (editorId != null) {
+ try {
+ part= page.openEditor(input, editorId, true, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
+ } catch (PartInitException e) {
+ DebugUIPlugin.errorDialog(dwindow.getShell(), ActionMessages.OpenBreakpointMarkerAction_Go_to_Breakpoint_1, ActionMessages.OpenBreakpointMarkerAction_Exceptions_occurred_attempting_to_open_the_editor_for_the_breakpoint_resource_2, e); //
+ }
+ }
}
if (part != null) {
IDE.gotoMarker(part, breakpoint.getMarker());
@@ -85,7 +85,7 @@ public class OpenBreakpointMarkerAction extends SelectionProviderAction {
@Override
public void selectionChanged(IStructuredSelection sel) {
if (sel.size() == 1) {
- breakpoint = (IBreakpoint)DebugPlugin.getAdapter(sel.getFirstElement(), IBreakpoint.class);
+ breakpoint = (IBreakpoint)DebugPlugin.getAdapter(sel.getFirstElement(), IBreakpoint.class);
if (breakpoint != null) {
input= fgPresentation.getEditorInput(breakpoint);
if (input != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
index 7195fd293..83d7618eb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
@@ -117,10 +117,10 @@ public class RemoveBreakpointAction extends AbstractSelectionActionDelegate {
}
}
if(deleteAll) {
- IBreakpoint[] breakpoints = bpc.getBreakpoints();
- for (int i = 0; i < breakpoints.length; i++) {
- breakpointsToDelete.add(breakpoints[i]);
- }
+ IBreakpoint[] breakpoints = bpc.getBreakpoints();
+ for (int i = 0; i < breakpoints.length; i++) {
+ breakpointsToDelete.add(breakpoints[i]);
+ }
}
}
}
@@ -130,22 +130,22 @@ public class RemoveBreakpointAction extends AbstractSelectionActionDelegate {
((BreakpointsView)getView()).preserveSelection(getSelection());
}
new Job(ActionMessages.RemoveBreakpointAction_2) {
- @Override
+ @Override
protected IStatus run(IProgressMonitor pmonitor) {
- try {
+ try {
Shell shell= getView() != null ? getView().getSite().getShell() : null;
DebugUITools.deleteBreakpoints(breakpoints, shell, pmonitor);
- for (int i = 0; i < sets.length; i++) {
- PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(sets[i]);
+ for (int i = 0; i < sets.length; i++) {
+ PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(sets[i]);
}
- return Status.OK_STATUS;
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- return Status.CANCEL_STATUS;
- }
- }.schedule();
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ return Status.CANCEL_STATUS;
+ }
+ }.schedule();
}
};
try {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RetargetBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RetargetBreakpointAction.java
index bbae8ce4a..ca09ef775 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RetargetBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RetargetBreakpointAction.java
@@ -34,61 +34,61 @@ import org.eclipse.ui.IWorkbenchWindow;
*/
public abstract class RetargetBreakpointAction extends RetargetAction implements IToggleBreakpointsTargetManagerListener {
- private IAction fAction;
+ private IAction fAction;
@Override
protected Class<?> getAdapterClass() {
return IToggleBreakpointsTarget.class;
}
- @Override
+ @Override
protected Object getAdapter(IAdaptable adaptable) {
- IToggleBreakpointsTargetManager manager = DebugUITools.getToggleBreakpointsTargetManager();
+ IToggleBreakpointsTargetManager manager = DebugUITools.getToggleBreakpointsTargetManager();
IWorkbenchPart activePart = getActivePart();
- if (activePart != null) {
+ if (activePart != null) {
return manager.getToggleBreakpointsTarget(activePart, getTargetSelection());
- }
- return null;
- }
+ }
+ return null;
+ }
- @Override
+ @Override
public void init(IWorkbenchWindow window) {
- super.init(window);
- DebugUITools.getToggleBreakpointsTargetManager().addChangedListener(this);
- }
+ super.init(window);
+ DebugUITools.getToggleBreakpointsTargetManager().addChangedListener(this);
+ }
- @Override
+ @Override
public void init(IAction action) {
- super.init(action);
- DebugUITools.getToggleBreakpointsTargetManager().addChangedListener(this);
- }
+ super.init(action);
+ DebugUITools.getToggleBreakpointsTargetManager().addChangedListener(this);
+ }
- @Override
+ @Override
public void dispose() {
- DebugUITools.getToggleBreakpointsTargetManager().removeChangedListener(this);
- super.dispose();
- }
+ DebugUITools.getToggleBreakpointsTargetManager().removeChangedListener(this);
+ super.dispose();
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- fAction = action;
- super.selectionChanged(action, selection);
- }
+ fAction = action;
+ super.selectionChanged(action, selection);
+ }
- @Override
+ @Override
public void preferredTargetsChanged() {
- if (fAction != null) {
- IWorkbenchPart activePart = getActivePart();
- if (activePart != null) {
- ISelectionProvider provider = activePart.getSite().getSelectionProvider();
- if (provider != null) {
- ISelection selection = provider.getSelection();
- // Force the toggle target to be refreshed.
- super.clearPart(activePart);
- super.partActivated(activePart);
- super.selectionChanged(fAction, selection);
- }
- }
- }
- }
+ if (fAction != null) {
+ IWorkbenchPart activePart = getActivePart();
+ if (activePart != null) {
+ ISelectionProvider provider = activePart.getSite().getSelectionProvider();
+ if (provider != null) {
+ ISelection selection = provider.getSelection();
+ // Force the toggle target to be refreshed.
+ super.clearPart(activePart);
+ super.partActivated(activePart);
+ super.selectionChanged(fAction, selection);
+ }
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java
index fc38a2b7c..f3b5d2822 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ToggleBreakpointObjectActionDelegate.java
@@ -47,7 +47,7 @@ public abstract class ToggleBreakpointObjectActionDelegate implements IObjectAct
@Override
public void run(IAction action) {
IToggleBreakpointsTarget target =
- DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
+ DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
if (target != null) {
try {
performAction(target, fPart, fSelection);
@@ -76,9 +76,9 @@ public abstract class ToggleBreakpointObjectActionDelegate implements IObjectAct
// selectionChagned() can sometimes be called before setActivePart().
// Guard here against that possibility.
if (fPart != null) {
- IToggleBreakpointsTarget target =
- DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
- enabled = target != null;
+ IToggleBreakpointsTarget target =
+ DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
+ enabled = target != null;
}
}
action.setEnabled(enabled);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java
index 76897c4f1..551ba9223 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressinInPlaceAction.java
@@ -30,60 +30,60 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
*/
public class EditWatchExpressinInPlaceAction extends Action implements ISelectionChangedListener {
- private ExpressionView fView;
- private TreeModelViewer fViewer;
- private EditWatchExpressionAction fEditActionDelegate = new EditWatchExpressionAction();
+ private ExpressionView fView;
+ private TreeModelViewer fViewer;
+ private EditWatchExpressionAction fEditActionDelegate = new EditWatchExpressionAction();
- public EditWatchExpressinInPlaceAction(ExpressionView view) {
- fView = view;
- fViewer = (TreeModelViewer)view.getViewer();
- fEditActionDelegate.init(view);
- ISelectionProvider selectionProvider = fView.getSite().getSelectionProvider();
- selectionProvider.addSelectionChangedListener(this);
- fEditActionDelegate.selectionChanged(this, selectionProvider.getSelection());
- }
+ public EditWatchExpressinInPlaceAction(ExpressionView view) {
+ fView = view;
+ fViewer = (TreeModelViewer)view.getViewer();
+ fEditActionDelegate.init(view);
+ ISelectionProvider selectionProvider = fView.getSite().getSelectionProvider();
+ selectionProvider.addSelectionChangedListener(this);
+ fEditActionDelegate.selectionChanged(this, selectionProvider.getSelection());
+ }
- @Override
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = fEditActionDelegate.getCurrentSelection();
- setEnabled(selection != null && selection.size() == 1);
- }
+ IStructuredSelection selection = fEditActionDelegate.getCurrentSelection();
+ setEnabled(selection != null && selection.size() == 1);
+ }
- public void dispose() {
- fView.getSite().getSelectionProvider().removeSelectionChangedListener(this);
- }
+ public void dispose() {
+ fView.getSite().getSelectionProvider().removeSelectionChangedListener(this);
+ }
- @Override
+ @Override
public void run() {
- IStructuredSelection selelection = fEditActionDelegate.getCurrentSelection();
+ IStructuredSelection selelection = fEditActionDelegate.getCurrentSelection();
- if (selelection.size() != 1) {
- return;
- }
+ if (selelection.size() != 1) {
+ return;
+ }
- // Always edit multi-line expressions in dialog. Otherwise try to find the expression
- // column and activate cell editor there.
- int expressionColumn = getExpressionColumnIndex();
- IWatchExpression[] expressions = fEditActionDelegate.getSelectedExpressions();
- if (expressionColumn != -1 && !isWatchExpressionWithNewLine(expressions)) {
- fViewer.editElement(selelection.getFirstElement(), expressionColumn);
- } else if (expressions.length == 1) {
- fEditActionDelegate.run(this);
- }
- }
+ // Always edit multi-line expressions in dialog. Otherwise try to find the expression
+ // column and activate cell editor there.
+ int expressionColumn = getExpressionColumnIndex();
+ IWatchExpression[] expressions = fEditActionDelegate.getSelectedExpressions();
+ if (expressionColumn != -1 && !isWatchExpressionWithNewLine(expressions)) {
+ fViewer.editElement(selelection.getFirstElement(), expressionColumn);
+ } else if (expressions.length == 1) {
+ fEditActionDelegate.run(this);
+ }
+ }
- private boolean isWatchExpressionWithNewLine(IWatchExpression[] expressions) {
- return expressions.length == 1 &&
- expressions[0].getExpressionText().indexOf('\n') != -1;
- }
+ private boolean isWatchExpressionWithNewLine(IWatchExpression[] expressions) {
+ return expressions.length == 1 &&
+ expressions[0].getExpressionText().indexOf('\n') != -1;
+ }
- private int getExpressionColumnIndex() {
- Object[] columnProperties = fViewer.getColumnProperties();
- for (int i = 0; columnProperties != null && i < columnProperties.length; i++) {
- if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnProperties[i])) {
- return i;
- }
- }
- return -1;
- }
+ private int getExpressionColumnIndex() {
+ Object[] columnProperties = fViewer.getColumnProperties();
+ for (int i = 0; columnProperties != null && i < columnProperties.length; i++) {
+ if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnProperties[i])) {
+ return i;
+ }
+ }
+ return -1;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressionAction.java
index 0ee090903..d91eecd41 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EditWatchExpressionAction.java
@@ -38,6 +38,6 @@ public class EditWatchExpressionAction extends WatchExpressionAction {
@Override
public void selectionChanged(IAction action, ISelection sel) {
- action.setEnabled(getSelectedExpressions().length == 1);
+ action.setEnabled(getSelectedExpressions().length == 1);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java
index c309965b9..06365e72b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java
@@ -51,8 +51,8 @@ public class EnableWatchExpressionAction implements IViewActionDelegate, IAction
while (iter.hasNext()) {
expression= getWatchExpression(iter.next());
if (expression != null) {
- expression.setEnabled(fEnable);
- fireWatchExpressionChanged(expression);
+ expression.setEnabled(fEnable);
+ fireWatchExpressionChanged(expression);
}
}
} else if (fSelection instanceof IWatchExpression) {
@@ -92,12 +92,12 @@ public class EnableWatchExpressionAction implements IViewActionDelegate, IAction
}
private IWatchExpression getWatchExpression(Object element) {
- if (element instanceof IWatchExpression) {
- return (IWatchExpression)element;
- } else if (element instanceof IAdaptable) {
- return ((IAdaptable)element).getAdapter(IWatchExpression.class);
- }
- return null;
+ if (element instanceof IWatchExpression) {
+ return (IWatchExpression)element;
+ } else if (element instanceof IAdaptable) {
+ return ((IAdaptable)element).getAdapter(IWatchExpression.class);
+ }
+ return null;
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/ReevaluateWatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/ReevaluateWatchExpressionAction.java
index 1fc07820b..ee9857152 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/ReevaluateWatchExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/ReevaluateWatchExpressionAction.java
@@ -36,35 +36,35 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public class ReevaluateWatchExpressionAction implements IObjectActionDelegate {
- @Override
+ @Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
+ }
- /**
- * Finds the currently selected context in the UI.
- * @return the current debug context
- */
- protected IDebugElement getContext() {
- IAdaptable object = DebugUITools.getDebugContext();
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- return context;
- }
+ /**
+ * Finds the currently selected context in the UI.
+ * @return the current debug context
+ */
+ protected IDebugElement getContext() {
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ return context;
+ }
- protected IStructuredSelection getCurrentSelection() {
- IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
- if (page != null) {
- ISelection selection = page.getSelection();
- if (selection instanceof IStructuredSelection) {
- return (IStructuredSelection) selection;
- }
- }
- return null;
- }
+ protected IStructuredSelection getCurrentSelection() {
+ IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ if (page != null) {
+ ISelection selection = page.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return (IStructuredSelection) selection;
+ }
+ }
+ return null;
+ }
/**
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java
index 9f1f41122..6a5eae9f6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/RemoveExpressionAction.java
@@ -43,10 +43,10 @@ public class RemoveExpressionAction extends AbstractSelectionActionDelegate {
if (segment instanceof IExpression) {
expressions.add((IExpression) segment);
} else if (segment instanceof IAdaptable) {
- IExpression expression = ((IAdaptable)segment).getAdapter(IExpression.class);
- if (expression != null) {
- expressions.add(expression);
- }
+ IExpression expression = ((IAdaptable)segment).getAdapter(IExpression.class);
+ if (expression != null) {
+ expressions.add(expression);
+ }
}
}
return expressions.toArray(new IExpression[expressions.size()]);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/SelectAllExpressionsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/SelectAllExpressionsAction.java
index 9a39a09d3..2e9315cc3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/SelectAllExpressionsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/SelectAllExpressionsAction.java
@@ -50,9 +50,9 @@ public class SelectAllExpressionsAction extends SelectAllAction implements IExpr
public void expressionsChanged(IExpression[] expressions) {
}
- @Override
+ @Override
public void dispose() {
- super.dispose();
- DebugPlugin.getDefault().getExpressionManager().removeExpressionListener(this);
- }
+ super.dispose();
+ DebugPlugin.getDefault().getExpressionManager().removeExpressionListener(this);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java
index 32abad36a..6a4f76013 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionAction.java
@@ -44,46 +44,46 @@ public abstract class WatchExpressionAction implements IViewActionDelegate {
@Override
public void init(IViewPart view) {
- fPart = view;
+ fPart = view;
}
- /**
- * Finds the currently selected context in the UI.
- * @return the current debug context
- */
- protected IDebugElement getContext() {
- IAdaptable object = DebugUITools.getDebugContext();
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- return context;
- }
+ /**
+ * Finds the currently selected context in the UI.
+ * @return the current debug context
+ */
+ protected IDebugElement getContext() {
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ return context;
+ }
protected IWatchExpression[] getSelectedExpressions() {
- List<Object> list = new LinkedList<>();
- IStructuredSelection currentSelection = getCurrentSelection();
- if (currentSelection == null) {
- return EMPTY_EXPRESSION_ARRAY;
- }
+ List<Object> list = new LinkedList<>();
+ IStructuredSelection currentSelection = getCurrentSelection();
+ if (currentSelection == null) {
+ return EMPTY_EXPRESSION_ARRAY;
+ }
- for (Iterator<?> iter= currentSelection.iterator(); iter.hasNext();) {
- Object element = iter.next();
- if (element instanceof IWatchExpression) {
- list.add(element);
- } else if (element instanceof IAdaptable) {
- IWatchExpression expr = ((IAdaptable)element).getAdapter(IWatchExpression.class);
- if (expr != null) {
- list.add(expr);
- } else {
- return EMPTY_EXPRESSION_ARRAY;
- }
- } else {
- return EMPTY_EXPRESSION_ARRAY;
- }
- }
+ for (Iterator<?> iter= currentSelection.iterator(); iter.hasNext();) {
+ Object element = iter.next();
+ if (element instanceof IWatchExpression) {
+ list.add(element);
+ } else if (element instanceof IAdaptable) {
+ IWatchExpression expr = ((IAdaptable)element).getAdapter(IWatchExpression.class);
+ if (expr != null) {
+ list.add(expr);
+ } else {
+ return EMPTY_EXPRESSION_ARRAY;
+ }
+ } else {
+ return EMPTY_EXPRESSION_ARRAY;
+ }
+ }
return list.toArray(new IWatchExpression[list.size()]);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionFactoryTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionFactoryTester.java
index 67aca51b0..13e1428e8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionFactoryTester.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionFactoryTester.java
@@ -35,22 +35,22 @@ public class WatchExpressionFactoryTester extends PropertyTester {
@Override
public boolean test(Object element, String property, Object[] args, Object expectedValue) {
if (CAN_CREATE_WATCH_EXPRESSION_PROPERTY.equals(property)){
- if (element instanceof IVariable) {
- IVariable variable = (IVariable)element;
- if (DebugPlugin.getDefault().getExpressionManager().hasWatchExpressionDelegate(variable.getModelIdentifier())) {
- IWatchExpressionFactoryAdapter factory = WatchHandler.getFactory(variable);
- if (factory instanceof IWatchExpressionFactoryAdapterExtension) {
- IWatchExpressionFactoryAdapterExtension ext = (IWatchExpressionFactoryAdapterExtension) factory;
- return ext.canCreateWatchExpression(variable);
- }
- return true;
- }
- } else {
- IWatchExpressionFactoryAdapter2 factory2 = WatchHandler.getFactory2(element);
- if (factory2 != null) {
- return factory2.canCreateWatchExpression(element);
- }
- }
+ if (element instanceof IVariable) {
+ IVariable variable = (IVariable)element;
+ if (DebugPlugin.getDefault().getExpressionManager().hasWatchExpressionDelegate(variable.getModelIdentifier())) {
+ IWatchExpressionFactoryAdapter factory = WatchHandler.getFactory(variable);
+ if (factory instanceof IWatchExpressionFactoryAdapterExtension) {
+ IWatchExpressionFactoryAdapterExtension ext = (IWatchExpressionFactoryAdapterExtension) factory;
+ return ext.canCreateWatchExpression(variable);
+ }
+ return true;
+ }
+ } else {
+ IWatchExpressionFactoryAdapter2 factory2 = WatchHandler.getFactory2(element);
+ if (factory2 != null) {
+ return factory2.canCreateWatchExpression(element);
+ }
+ }
}
return false;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java
index 6305324c4..1c4955f02 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java
@@ -45,94 +45,94 @@ import org.eclipse.ui.handlers.HandlerUtil;
*/
public class WatchHandler extends AbstractHandler {
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- Iterator<?> iter = ((IStructuredSelection)selection).iterator();
- while (iter.hasNext()) {
- Object element = iter.next();
- createExpression(element);
- }
- }
- return null;
- }
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ Iterator<?> iter = ((IStructuredSelection)selection).iterator();
+ while (iter.hasNext()) {
+ Object element = iter.next();
+ createExpression(element);
+ }
+ }
+ return null;
+ }
- private void showExpressionsView() {
- IWorkbenchPage page = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- if (part == null) {
- try {
- page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- } catch (PartInitException e) {
- }
- } else {
- page.bringToTop(part);
- }
+ private void showExpressionsView() {
+ IWorkbenchPage page = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ if (part == null) {
+ try {
+ page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ } catch (PartInitException e) {
+ }
+ } else {
+ page.bringToTop(part);
+ }
- }
+ }
- private void createExpression(Object element) {
- String expressionString;
- try {
- if (element instanceof IVariable) {
- IVariable variable = (IVariable)element;
- IWatchExpressionFactoryAdapter factory = getFactory(variable);
- expressionString = variable.getName();
- if (factory != null) {
- expressionString = factory.createWatchExpression(variable);
- }
- } else {
- IWatchExpressionFactoryAdapter2 factory2 = getFactory2(element);
- if (factory2 != null) {
- expressionString = factory2.createWatchExpression(element);
- } else {
- // Action should not have been enabled
- return;
- }
- }
- } catch (CoreException e) {
- DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), ActionMessages.WatchAction_0, ActionMessages.WatchAction_1, e); //
- return;
- }
+ private void createExpression(Object element) {
+ String expressionString;
+ try {
+ if (element instanceof IVariable) {
+ IVariable variable = (IVariable)element;
+ IWatchExpressionFactoryAdapter factory = getFactory(variable);
+ expressionString = variable.getName();
+ if (factory != null) {
+ expressionString = factory.createWatchExpression(variable);
+ }
+ } else {
+ IWatchExpressionFactoryAdapter2 factory2 = getFactory2(element);
+ if (factory2 != null) {
+ expressionString = factory2.createWatchExpression(element);
+ } else {
+ // Action should not have been enabled
+ return;
+ }
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), ActionMessages.WatchAction_0, ActionMessages.WatchAction_1, e); //
+ return;
+ }
- IWatchExpression expression;
- expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(expressionString);
- DebugPlugin.getDefault().getExpressionManager().addExpression(expression);
- IAdaptable object = DebugUITools.getDebugContext();
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- expression.setExpressionContext(context);
- showExpressionsView();
- }
+ IWatchExpression expression;
+ expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(expressionString);
+ DebugPlugin.getDefault().getExpressionManager().addExpression(expression);
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ expression.setExpressionContext(context);
+ showExpressionsView();
+ }
- /**
- * Returns the factory adapter for the given variable or <code>null</code> if none.
- *
- * @param variable the variable to get the factory for
- * @return factory or <code>null</code>
- */
- static IWatchExpressionFactoryAdapter getFactory(IVariable variable) {
- return variable.getAdapter(IWatchExpressionFactoryAdapter.class);
- }
+ /**
+ * Returns the factory adapter for the given variable or <code>null</code> if none.
+ *
+ * @param variable the variable to get the factory for
+ * @return factory or <code>null</code>
+ */
+ static IWatchExpressionFactoryAdapter getFactory(IVariable variable) {
+ return variable.getAdapter(IWatchExpressionFactoryAdapter.class);
+ }
- /**
- * Returns the factory adapter for the given variable or <code>null</code> if none.
- *
- * @param element the element to try and adapt
- * @return factory or <code>null</code>
- */
- static IWatchExpressionFactoryAdapter2 getFactory2(Object element) {
- if (element instanceof IAdaptable) {
- return ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
- }
- return null;
- }
+ /**
+ * Returns the factory adapter for the given variable or <code>null</code> if none.
+ *
+ * @param element the element to try and adapt
+ * @return factory or <code>null</code>
+ */
+ static IWatchExpressionFactoryAdapter2 getFactory2(Object element) {
+ if (element instanceof IAdaptable) {
+ return ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueAction.java
index e0ed1ed70..f2793f51d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueAction.java
@@ -47,14 +47,14 @@ import com.ibm.icu.text.MessageFormat;
public class ChangeVariableValueAction extends SelectionProviderAction {
protected IVariable fVariable;
- private VariablesView fView;
- private boolean fEditing= false;
- private boolean isApplicable = false;
-
- /**
- * Creates a new ChangeVariableValueAction for the given variables view
- * @param view the variables view in which this action will appear
- */
+ private VariablesView fView;
+ private boolean fEditing= false;
+ private boolean isApplicable = false;
+
+ /**
+ * Creates a new ChangeVariableValueAction for the given variables view
+ * @param view the variables view in which this action will appear
+ */
public ChangeVariableValueAction(VariablesView view) {
super(view.getViewer(), ActionMessages.ChangeVariableValue_title);
setDescription(ActionMessages.ChangeVariableValue_toolTipText);
@@ -74,7 +74,7 @@ public class ChangeVariableValueAction extends SelectionProviderAction {
* @return if this action applies to the current selection
*/
public boolean isApplicable() {
- return isApplicable;
+ return isApplicable;
}
/**
@@ -82,16 +82,16 @@ public class ChangeVariableValueAction extends SelectionProviderAction {
* @param variable run the action on the given variable
*/
protected void doActionPerformed(final IVariable variable) {
- Shell shell = fView.getViewSite().getShell();
+ Shell shell = fView.getViewSite().getShell();
// If a previous edit is still in progress, don't start another
- if (fEditing) {
- return;
- }
- fEditing= true;
+ if (fEditing) {
+ return;
+ }
+ fEditing= true;
fVariable = variable;
- if (!delegateEdit(shell)) {
- doDefaultEdit(shell);
- }
+ if (!delegateEdit(shell)) {
+ doDefaultEdit(shell);
+ }
fEditing= false;
}
@@ -101,24 +101,24 @@ public class ChangeVariableValueAction extends SelectionProviderAction {
* <code>true</code> if a delegate handled the edit, <code>false</code>
* if the variable still needs to be edited.
*
- * @param shell a shell for prompting the user
- * @return whether or not a delegate attempted to edit the variable
- */
- private boolean delegateEdit(Shell shell) {
- String modelIdentifier = fVariable.getModelIdentifier();
- IVariableValueEditor editor= VariableValueEditorManager.getDefault().getVariableValueEditor(modelIdentifier);
- if (editor != null) {
- return editor.editVariable(fVariable, shell);
- }
- return false;
- }
-
- /**
- * Edits the variable using the default variable editor
- * @param shell a shell for prompting the user
- */
- protected void doDefaultEdit(Shell shell) {
- String name= IInternalDebugCoreConstants.EMPTY_STRING;
+ * @param shell a shell for prompting the user
+ * @return whether or not a delegate attempted to edit the variable
+ */
+ private boolean delegateEdit(Shell shell) {
+ String modelIdentifier = fVariable.getModelIdentifier();
+ IVariableValueEditor editor= VariableValueEditorManager.getDefault().getVariableValueEditor(modelIdentifier);
+ if (editor != null) {
+ return editor.editVariable(fVariable, shell);
+ }
+ return false;
+ }
+
+ /**
+ * Edits the variable using the default variable editor
+ * @param shell a shell for prompting the user
+ */
+ protected void doDefaultEdit(Shell shell) {
+ String name= IInternalDebugCoreConstants.EMPTY_STRING;
String value= IInternalDebugCoreConstants.EMPTY_STRING;
try {
name= fVariable.getName();
@@ -163,12 +163,12 @@ public class ChangeVariableValueAction extends SelectionProviderAction {
* @param sel the selection to update
*/
protected void update(IStructuredSelection sel) {
- isApplicable = false;
+ isApplicable = false;
Iterator<Object> iter = sel.iterator();
if (iter.hasNext()) {
Object object= iter.next();
if (object instanceof IValueModification) {
- isApplicable = true;
+ isApplicable = true;
IValueModification varMod= (IValueModification)object;
if (!varMod.supportsValueModification()) {
setEnabled(false);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueInputDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueInputDialog.java
index e1573b63e..081a4a43a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueInputDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueInputDialog.java
@@ -263,15 +263,15 @@ public class ChangeVariableValueInputDialog extends TrayDialog {
return IDebugUIConstants.PLUGIN_ID + ".CHANGE_VARIABLE_VALUE_DIALOG_SECTION"; //$NON-NLS-1$
}
- @Override
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
- if (section == null) {
- section = settings.addNewSection(getDialogSettingsSectionName());
- }
- return section;
- }
+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
+ if (section == null) {
+ section = settings.addNewSection(getDialogSettingsSectionName());
+ }
+ return section;
+ }
@Override
protected void handleShellCloseEvent() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java
index 03bb94293..95f1774b8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java
@@ -46,7 +46,7 @@ import com.ibm.icu.text.MessageFormat;
*/
public class DetailPaneAssignValueAction extends Action{
- private IHandlerActivation fHandlerActivation;
+ private IHandlerActivation fHandlerActivation;
private IViewSite fViewSite;
private ITextViewer fTextViewer;
private IStructuredSelection fCurrentSelection;
@@ -67,46 +67,46 @@ public class DetailPaneAssignValueAction extends Action{
String modelIdentifier = variable.getModelIdentifier();
IVariableValueEditor editor = VariableValueEditorManager.getDefault().getVariableValueEditor(modelIdentifier);
if (editor != null) {
- if (editor.saveVariable(variable, newValueExpression, shell)) {
- // If we successfully delegate to an editor which performs the save,
- // don't do any more work.
- return;
- }
+ if (editor.saveVariable(variable, newValueExpression, shell)) {
+ // If we successfully delegate to an editor which performs the save,
+ // don't do any more work.
+ return;
+ }
}
try {
- // If we failed to delegate to anyone, perform the default assignment.
+ // If we failed to delegate to anyone, perform the default assignment.
if (variable.verifyValue(newValueExpression)) {
variable.setValue(newValueExpression);
} else {
- if (shell != null) {
+ if (shell != null) {
DebugUIPlugin.errorDialog(shell, ActionMessages.DetailPaneAssignValueAction_2, MessageFormat.format(ActionMessages.DetailPaneAssignValueAction_3, new Object[] {
newValueExpression, variable.getName() }), new StatusInfo(IStatus.ERROR, ActionMessages.DetailPaneAssignValueAction_4)); //
- }
+ }
}
} catch (DebugException e) {
- MessageDialog.openError(shell, ActionMessages.DetailPaneAssignValueAction_0, e.getStatus().getMessage());
+ MessageDialog.openError(shell, ActionMessages.DetailPaneAssignValueAction_0, e.getStatus().getMessage());
}
}
public DetailPaneAssignValueAction(ITextViewer textViewer, IViewSite viewSite) {
super(ActionMessages.DetailPaneAssignValueAction_1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DETAIL_PANE_ASSIGN_VALUE_ACTION);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DETAIL_PANE_ASSIGN_VALUE_ACTION);
fTextViewer = textViewer;
fViewSite = viewSite;
setEnabled(false);
- IHandlerService service = fViewSite.getService(IHandlerService.class);
- ActionHandler handler = new ActionHandler(this);
- fHandlerActivation = service.activateHandler(getActionDefinitionId(), handler);
+ IHandlerService service = fViewSite.getService(IHandlerService.class);
+ ActionHandler handler = new ActionHandler(this);
+ fHandlerActivation = service.activateHandler(getActionDefinitionId(), handler);
}
public void dispose() {
- IHandlerService service = fViewSite.getService(IHandlerService.class);
- service.deactivateHandler(fHandlerActivation);
- }
+ IHandlerService service = fViewSite.getService(IHandlerService.class);
+ service.deactivateHandler(fHandlerActivation);
+ }
public void updateCurrentVariable(IStructuredSelection selection) {
boolean enabled = false;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java
index 7f97b1faf..7778425fe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java
@@ -94,30 +94,30 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
@Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- Label label = new Label(composite, SWT.WRAP);
- label.setText(VariablesViewMessages.DetailPaneMaxLengthDialog_1);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(parent.getFont());
- fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
- fTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- fTextWidget.setText(fValue);
- fTextWidget.addModifyListener(new ModifyListener() {
- @Override
+ Composite composite = (Composite) super.createDialogArea(parent);
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(VariablesViewMessages.DetailPaneMaxLengthDialog_1);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ fTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ fTextWidget.setText(fValue);
+ fTextWidget.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
- validateInput();
- fValue = fTextWidget.getText();
- }
- });
- fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
- fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL));
- fErrorTextWidget.setBackground(fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- setErrorMessage(fErrorMessage);
- applyDialogFont(composite);
- return composite;
+ validateInput();
+ fValue = fTextWidget.getText();
+ }
+ });
+ fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
+ fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ fErrorTextWidget.setBackground(fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ setErrorMessage(fErrorMessage);
+ applyDialogFont(composite);
+ return composite;
}
@Override
@@ -133,43 +133,43 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
}
/**
- * Returns the string typed into this input dialog.
- *
- * @return the input string
- * @since 3.3
- */
- public String getValue() {
- return fValue;
- }
+ * Returns the string typed into this input dialog.
+ *
+ * @return the input string
+ * @since 3.3
+ */
+ public String getValue() {
+ return fValue;
+ }
- /**
- * Validates the current input
- * @since 3.3
- */
- private void validateInput() {
- String errorMessage = null;
- if (fValidator != null) {
- errorMessage = fValidator.isValid(fTextWidget.getText());
- }
- setErrorMessage(errorMessage);
- }
+ /**
+ * Validates the current input
+ * @since 3.3
+ */
+ private void validateInput() {
+ String errorMessage = null;
+ if (fValidator != null) {
+ errorMessage = fValidator.isValid(fTextWidget.getText());
+ }
+ setErrorMessage(errorMessage);
+ }
- /**
- * Sets the current error message or none if null
- * @param errorMessage the message to display
- * @since 3.3
- */
- public void setErrorMessage(String errorMessage) {
- fErrorMessage = errorMessage;
- if (fErrorTextWidget != null && !fErrorTextWidget.isDisposed()) {
- fErrorTextWidget.setText(errorMessage == null ? IInternalDebugCoreConstants.EMPTY_STRING : errorMessage);
- fErrorTextWidget.getParent().update();
- // Access the ok button by id, in case clients have overridden button creation.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
- Control button = getButton(IDialogConstants.OK_ID);
- if (button != null) {
- button.setEnabled(errorMessage == null);
- }
- }
- }
+ /**
+ * Sets the current error message or none if null
+ * @param errorMessage the message to display
+ * @since 3.3
+ */
+ public void setErrorMessage(String errorMessage) {
+ fErrorMessage = errorMessage;
+ if (fErrorTextWidget != null && !fErrorTextWidget.isDisposed()) {
+ fErrorTextWidget.setText(errorMessage == null ? IInternalDebugCoreConstants.EMPTY_STRING : errorMessage);
+ fErrorTextWidget.getParent().update();
+ // Access the ok button by id, in case clients have overridden button creation.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
+ Control button = getButton(IDialogConstants.OK_ID);
+ if (button != null) {
+ button.setEnabled(errorMessage == null);
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java
index 997b219ff..784518d97 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java
@@ -28,28 +28,28 @@ import org.eclipse.debug.core.model.IBreakpoint;
*/
public interface IBreakpointContainer {
- /**
- * Returns the breakpoint organizer that this container uses.
- */
- IBreakpointOrganizer getOrganizer();
+ /**
+ * Returns the breakpoint organizer that this container uses.
+ */
+ IBreakpointOrganizer getOrganizer();
- /**
- * Returns the breakpoint category that this container is based on.
- * @return
- */
- IAdaptable getCategory();
+ /**
+ * Returns the breakpoint category that this container is based on.
+ * @return
+ */
+ IAdaptable getCategory();
- /**
- * Returns whether this breakpoint container contains the given breakpoint.
- *
- * @param breakpoint Breakpoint to check
- * @return Returns <code>true</code> if this container contains the
- * given breakpoint.
- */
- boolean contains(IBreakpoint breakpoint);
+ /**
+ * Returns whether this breakpoint container contains the given breakpoint.
+ *
+ * @param breakpoint Breakpoint to check
+ * @return Returns <code>true</code> if this container contains the
+ * given breakpoint.
+ */
+ boolean contains(IBreakpoint breakpoint);
- /**
- * Returns the array of breakpoints in this container.
- */
- IBreakpoint[] getBreakpoints();
+ /**
+ * Returns the array of breakpoints in this container.
+ */
+ IBreakpoint[] getBreakpoints();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java
index 49cca1221..c7c6d2d2e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java
@@ -33,34 +33,34 @@ import org.eclipse.jface.resource.ImageDescriptor;
*/
public interface IBreakpointOrganizer extends IBreakpointOrganizerDelegate {
- /**
- * Returns a label for this breakpoint organizer.
- *
- * @return a label for this breakpoint organizer
- */
- String getLabel();
+ /**
+ * Returns a label for this breakpoint organizer.
+ *
+ * @return a label for this breakpoint organizer
+ */
+ String getLabel();
- /**
- * Returns an image descriptor for this breakpoint organizer or <code>null</code>.
- *
- * @return an image descriptor for this breakpoint organizer or <code>null</code>
- */
- ImageDescriptor getImageDescriptor();
+ /**
+ * Returns an image descriptor for this breakpoint organizer or <code>null</code>.
+ *
+ * @return an image descriptor for this breakpoint organizer or <code>null</code>
+ */
+ ImageDescriptor getImageDescriptor();
- /**
- * Returns a unique identifier for this breakpoint organizer.
- *
- * @return a unique identifier for this breakpoint organizer
- */
- String getIdentifier();
+ /**
+ * Returns a unique identifier for this breakpoint organizer.
+ *
+ * @return a unique identifier for this breakpoint organizer
+ */
+ String getIdentifier();
- /**
- * Returns the label for breakpoints that do not fall into a category
- * for this organizer.
- *
- * @return label for breakpoints that do not fall into a category
- * for this organizer
- */
- String getOthersLabel();
+ /**
+ * Returns the label for breakpoints that do not fall into a category
+ * for this organizer.
+ *
+ * @return label for breakpoints that do not fall into a category
+ * for this organizer
+ */
+ String getOthersLabel();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java
index 8e4b027f0..9d572a681 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java
@@ -19,49 +19,49 @@ package org.eclipse.debug.internal.ui.breakpoints.provisional;
* @since 3.6
*/
public interface IBreakpointUIConstants {
- /**
- * Breakpoints presentation context property used to retrieve the array of
- * breakpoint organizers. The expected property type is
- * <code>IBreakpointOrganizer[]</code>. If property value is <code>null</code>,
- * the breakpoint categories should not be shown.
- *
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
- */
- String PROP_BREAKPOINTS_ORGANIZERS = "BreakpointOrganizers"; //$NON-NLS-1$
+ /**
+ * Breakpoints presentation context property used to retrieve the array of
+ * breakpoint organizers. The expected property type is
+ * <code>IBreakpointOrganizer[]</code>. If property value is <code>null</code>,
+ * the breakpoint categories should not be shown.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ String PROP_BREAKPOINTS_ORGANIZERS = "BreakpointOrganizers"; //$NON-NLS-1$
- /**
- * Breakpoints presentation context property used to retrieve a flag
- * indicating whether the list of breakpoints should be filtered based
- * on the active debug context. The returned property value should
- * be of type <code>java.lang.Boolean</code>. If property value is
- * <code>null</code>, then value should be treated the same as
- * <code>Boolean.FALSE</code>.
- *
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
- */
- String PROP_BREAKPOINTS_FILTER_SELECTION = "FilterSelection"; //$NON-NLS-1$
+ /**
+ * Breakpoints presentation context property used to retrieve a flag
+ * indicating whether the list of breakpoints should be filtered based
+ * on the active debug context. The returned property value should
+ * be of type <code>java.lang.Boolean</code>. If property value is
+ * <code>null</code>, then value should be treated the same as
+ * <code>Boolean.FALSE</code>.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ String PROP_BREAKPOINTS_FILTER_SELECTION = "FilterSelection"; //$NON-NLS-1$
- /**
- * Breakpoints presentation context property used to retrieve a flag
- * indicating whether breakpoints view selection should be updated
- * upon a breakpoint event in debug model. The returned property value
- * should be of type <code>java.lang.Boolean</code>. If property value is
- * <code>null</code>, then value should be treated the same as
- * <code>Boolean.FALSE</code>.
- *
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
- */
- String PROP_BREAKPOINTS_TRACK_SELECTION = "TrackSelection"; //$NON-NLS-1$
+ /**
+ * Breakpoints presentation context property used to retrieve a flag
+ * indicating whether breakpoints view selection should be updated
+ * upon a breakpoint event in debug model. The returned property value
+ * should be of type <code>java.lang.Boolean</code>. If property value is
+ * <code>null</code>, then value should be treated the same as
+ * <code>Boolean.FALSE</code>.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ String PROP_BREAKPOINTS_TRACK_SELECTION = "TrackSelection"; //$NON-NLS-1$
- /**
- * Breakpoints presentation context property used to retrieve a
- * comparator for sorting breakpoints. The returned property value should
- * be of type <code>java.util.Comparator</code>. If property value is
- * <code>null</code>, the breakpoints should not be sorted.
- *
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
- */
- String PROP_BREAKPOINTS_ELEMENT_COMPARATOR = "ElementComparator"; //$NON-NLS-1$
+ /**
+ * Breakpoints presentation context property used to retrieve a
+ * comparator for sorting breakpoints. The returned property value should
+ * be of type <code>java.util.Comparator</code>. If property value is
+ * <code>null</code>, the breakpoints should not be sorted.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ String PROP_BREAKPOINTS_ELEMENT_COMPARATOR = "ElementComparator"; //$NON-NLS-1$
String PROP_BREAKPOINTS_ELEMENT_COMPARATOR_SORT = "ElementComparatorSort"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java
index 9705e1459..07fedbb26 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java
@@ -37,58 +37,58 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
public class OtherBreakpointCategory extends PlatformObject implements IWorkbenchAdapter {
private static Map<IBreakpointOrganizer, IAdaptable[]> fOthers = new HashMap<>();
- private IBreakpointOrganizer fOrganizer;
+ private IBreakpointOrganizer fOrganizer;
- public static IAdaptable[] getCategories(IBreakpointOrganizer organizer) {
- IAdaptable[] others = fOthers.get(organizer);
- if (others == null) {
- others = new IAdaptable[]{new OtherBreakpointCategory(organizer)};
- fOthers.put(organizer, others);
- }
- return others;
- }
+ public static IAdaptable[] getCategories(IBreakpointOrganizer organizer) {
+ IAdaptable[] others = fOthers.get(organizer);
+ if (others == null) {
+ others = new IAdaptable[]{new OtherBreakpointCategory(organizer)};
+ fOthers.put(organizer, others);
+ }
+ return others;
+ }
- /**
- * Constructs an 'other' category for the given organizer.
- *
- * @param organizer breakpoint organizer
- */
- private OtherBreakpointCategory(IBreakpointOrganizer organizer) {
- fOrganizer = organizer;
- }
+ /**
+ * Constructs an 'other' category for the given organizer.
+ *
+ * @param organizer breakpoint organizer
+ */
+ private OtherBreakpointCategory(IBreakpointOrganizer organizer) {
+ fOrganizer = organizer;
+ }
- @Override
+ @Override
public Object[] getChildren(Object o) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS);
- }
+ return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS);
+ }
- @Override
+ @Override
public String getLabel(Object o) {
- return fOrganizer.getOthersLabel();
- }
+ return fOrganizer.getOthersLabel();
+ }
- @Override
+ @Override
public Object getParent(Object o) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- if (obj instanceof OtherBreakpointCategory) {
- OtherBreakpointCategory category = (OtherBreakpointCategory) obj;
- return fOrganizer.equals(category.fOrganizer);
- }
- return false;
- }
+ if (obj instanceof OtherBreakpointCategory) {
+ OtherBreakpointCategory category = (OtherBreakpointCategory) obj;
+ return fOrganizer.equals(category.fOrganizer);
+ }
+ return false;
+ }
- @Override
+ @Override
public int hashCode() {
- return fOrganizer.hashCode();
- }
+ return fOrganizer.hashCode();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java
index 543811965..6bcd36dfd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandActionDelegate.java
@@ -30,40 +30,40 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public abstract class DebugCommandActionDelegate implements IWorkbenchWindowActionDelegate, IActionDelegate2 {
/**
- *The real action for this delegate
+ *The real action for this delegate
*/
private DebugCommandAction fDebugAction;
protected void setAction(DebugCommandAction action) {
- fDebugAction = action;
+ fDebugAction = action;
}
@Override
public void dispose() {
- fDebugAction.dispose();
+ fDebugAction.dispose();
}
- @Override
+ @Override
public void init(IAction action) {
- fDebugAction.setActionProxy(action);
- }
+ fDebugAction.setActionProxy(action);
+ }
- @Override
+ @Override
public void init(IWorkbenchWindow window) {
- fDebugAction.init(window);
+ fDebugAction.init(window);
}
@Override
public void run(IAction action) {
- fDebugAction.run();
+ fDebugAction.run();
}
@Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection s) {
// do nothing
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
index 4fe6ec3dc..dcfc2e279 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java
@@ -247,9 +247,9 @@ public class DebugCommandService implements IDebugContextListener {
*/
private Map<IDebugCommandHandler, List<Object>> collate(Object[] elements, Class<?> handlerType) {
Map<IDebugCommandHandler, List<Object>> map = new HashMap<>();
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
- IDebugCommandHandler handler = getHandler(element, handlerType);
+ for (int i = 0; i < elements.length; i++) {
+ Object element = elements[i];
+ IDebugCommandHandler handler = getHandler(element, handlerType);
if (handler == null) {
return null;
} else {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java
index 7c7a95f6f..ee57b97ef 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandAction.java
@@ -27,44 +27,44 @@ import org.eclipse.jface.resource.ImageDescriptor;
*/
public class DisconnectCommandAction extends DebugCommandAction{
- public DisconnectCommandAction() {
- setActionDefinitionId("org.eclipse.debug.ui.commands.Disconnect"); //$NON-NLS-1$
- }
+ public DisconnectCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.Disconnect"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getText() {
- return ActionMessages.DisconnectAction_0;
- }
+ return ActionMessages.DisconnectAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.disconnect_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.disconnect_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.toolbar.disconnect"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.toolbar.disconnect"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.DisconnectAction_3;
- }
+ return ActionMessages.DisconnectAction_3;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT);
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT);
- }
+ return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT);
- }
+ return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT);
+ }
@Override
protected Class<IDisconnectHandler> getCommandType() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java
index 9a3ff7cb1..be5c2c649 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DisconnectCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class DisconnectCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IDisconnectHandler> getCommandType() {
- return IDisconnectHandler.class;
- }
+ return IDisconnectHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java
index 99c626d83..c9aafc8d4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandAction.java
@@ -27,39 +27,39 @@ import org.eclipse.jface.resource.ImageDescriptor;
*/
public class DropToFrameCommandAction extends DebugCommandAction {
- public DropToFrameCommandAction() {
- setActionDefinitionId("org.eclipse.debug.ui.commands.DropToFrame"); //$NON-NLS-1$
- }
+ public DropToFrameCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.DropToFrame"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getText() {
- return ActionMessages.DropToFrameAction_0;
- }
+ return ActionMessages.DropToFrameAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.drop_to_frame_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.drop_to_frame_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.toolbar.dropToFrame"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.toolbar.dropToFrame"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.DropToFrameAction_3;
- }
+ return ActionMessages.DropToFrameAction_3;
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DROP_TO_FRAME);
+ }
@Override
public ImageDescriptor getDisabledImageDescriptor() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java
index e55513950..6e25f25a0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DropToFrameCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class DropToFrameCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IDropToFrameHandler> getCommandType() {
- return IDropToFrameHandler.class;
- }
+ return IDropToFrameHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java
index be54459b9..dea989ae2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ExecuteActionRequest.java
@@ -33,29 +33,29 @@ public class ExecuteActionRequest extends DebugCommandRequest {
super(elements);
}
- @Override
+ @Override
public void done() {
- if (fParticipant != null) {
+ if (fParticipant != null) {
fParticipant.requestDone(this);
fParticipant = null;
}
- final IStatus status = getStatus();
- if (status != null) {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
+ final IStatus status = getStatus();
+ if (status != null) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openError(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
- break;
- case IStatus.WARNING:
+ break;
+ case IStatus.WARNING:
DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openWarning(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
- break;
- case IStatus.INFO:
+ break;
+ case IStatus.INFO:
DebugUIPlugin.getStandardDisplay().asyncExec(() -> MessageDialog.openInformation(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, status.getMessage()));
- break;
+ break;
default:
break;
- }
- }
- }
+ }
+ }
+ }
public void setCommandParticipant(ICommandParticipant participant) {
fParticipant = participant;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/IEnabledTarget.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/IEnabledTarget.java
index adfc68e20..c46dc71cf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/IEnabledTarget.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/IEnabledTarget.java
@@ -17,5 +17,5 @@ package org.eclipse.debug.internal.ui.commands.actions;
*
*/
public interface IEnabledTarget {
- void setEnabled(boolean enabled);
+ void setEnabled(boolean enabled);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java
index 0bd831c86..7adc14347 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java
@@ -28,49 +28,49 @@ import org.eclipse.jface.resource.ImageDescriptor;
*/
public class RestartCommandAction extends DebugCommandAction {
- public RestartCommandAction() {
- setActionDefinitionId("org.eclipse.debug.ui.commands.Restart"); //$NON-NLS-1$
- }
+ public RestartCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.Restart"); //$NON-NLS-1$
+ }
- @Override
+ @Override
protected Class<IRestartHandler> getCommandType() {
- return IRestartHandler.class;
- }
+ return IRestartHandler.class;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESTART);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESTART);
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.restart_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.restart_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESTART);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESTART);
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.actions.Restart"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.actions.Restart"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESTART);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESTART);
+ }
- @Override
+ @Override
public String getText() {
- return ActionMessages.RestartCommandAction__text;
- }
+ return ActionMessages.RestartCommandAction__text;
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.RestartCommandAction_tooltip;
- }
+ return ActionMessages.RestartCommandAction_tooltip;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java
index dba235d9e..7f413108a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java
@@ -29,36 +29,36 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
*/
public class RestartCommandActionDelegate implements IWorkbenchWindowActionDelegate, IActionDelegate2 {
- private DebugCommandAction fDebugAction = new RestartCommandAction();
+ private DebugCommandAction fDebugAction = new RestartCommandAction();
- @Override
+ @Override
public void dispose() {
- fDebugAction.dispose();
- }
+ fDebugAction.dispose();
+ }
- @Override
+ @Override
public void init(IWorkbenchWindow window) {
- fDebugAction.init(window);
- }
+ fDebugAction.init(window);
+ }
- @Override
+ @Override
public void run(IAction action) {
- fDebugAction.run();
- }
+ fDebugAction.run();
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
+ // do nothing
+ }
- @Override
+ @Override
public void init(IAction action) {
- fDebugAction.setActionProxy(action);
+ fDebugAction.setActionProxy(action);
- }
+ }
- @Override
+ @Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandHandler.java
index e11c920b8..dab0b811a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandHandler.java
@@ -24,9 +24,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class RestartCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IRestartHandler> getCommandType() {
- return IRestartHandler.class;
- }
+ return IRestartHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java
index ffab51b78..b53706650 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandAction.java
@@ -31,40 +31,40 @@ public class ResumeCommandAction extends DebugCommandAction{
setActionDefinitionId("org.eclipse.debug.ui.commands.Resume"); //$NON-NLS-1$
}
- @Override
+ @Override
public String getText() {
- return ActionMessages.ResumeAction_0;
- }
+ return ActionMessages.ResumeAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.resume_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.resume_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.toolbar.resume"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.toolbar.resume"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.ResumeAction_3;
- }
+ return ActionMessages.ResumeAction_3;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESUME);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESUME);
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME);
+ }
@Override
protected Class<IResumeHandler> getCommandType() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java
index 783322f51..762356a13 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandActionDelegate.java
@@ -29,36 +29,36 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
*/
public class ResumeCommandActionDelegate implements IWorkbenchWindowActionDelegate, IActionDelegate2 {
- private DebugCommandAction fDebugAction = new ResumeCommandAction();
+ private DebugCommandAction fDebugAction = new ResumeCommandAction();
- @Override
+ @Override
public void dispose() {
- fDebugAction.dispose();
- }
+ fDebugAction.dispose();
+ }
- @Override
+ @Override
public void init(IWorkbenchWindow window) {
- fDebugAction.init(window);
- }
+ fDebugAction.init(window);
+ }
- @Override
+ @Override
public void run(IAction action) {
- fDebugAction.run();
- }
+ fDebugAction.run();
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
+ // do nothing
+ }
- @Override
+ @Override
public void init(IAction action) {
- fDebugAction.setActionProxy(action);
+ fDebugAction.setActionProxy(action);
- }
+ }
- @Override
+ @Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java
index 7b701790d..a9e747135 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ResumeCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class ResumeCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IResumeHandler> getCommandType() {
- return IResumeHandler.class;
- }
+ return IResumeHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java
index 13387bc1a..6efe806ca 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandAction.java
@@ -31,40 +31,40 @@ public class StepIntoCommandAction extends DebugCommandAction {
setActionDefinitionId("org.eclipse.debug.ui.commands.StepInto"); //$NON-NLS-1$
}
- @Override
+ @Override
public String getText() {
- return ActionMessages.StepIntoAction_0;
- }
+ return ActionMessages.StepIntoAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.step_into_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.step_into_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.toolbar.stepInto"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.toolbar.stepInto"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.StepIntoAction_3;
- }
+ return ActionMessages.StepIntoAction_3;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_INTO);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_INTO);
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_INTO);
+ }
@Override
protected Class<IStepIntoHandler> getCommandType() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java
index 0c7f9dac8..142262430 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandActionDelegate.java
@@ -21,10 +21,10 @@ package org.eclipse.debug.internal.ui.commands.actions;
*/
public class StepIntoCommandActionDelegate extends DebugCommandActionDelegate {
- public StepIntoCommandActionDelegate() {
- super();
- setAction(new StepIntoCommandAction());
- }
+ public StepIntoCommandActionDelegate() {
+ super();
+ setAction(new StepIntoCommandAction());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java
index 6479d08e3..be170bb87 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepIntoCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class StepIntoCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IStepIntoHandler> getCommandType() {
- return IStepIntoHandler.class;
- }
+ return IStepIntoHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java
index 9ef7235be..530a8254b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandAction.java
@@ -32,40 +32,40 @@ public class StepOverCommandAction extends DebugCommandAction {
setActionDefinitionId("org.eclipse.debug.ui.commands.StepOver"); //$NON-NLS-1$
}
- @Override
+ @Override
public String getText() {
- return ActionMessages.StepOverAction_0;
- }
+ return ActionMessages.StepOverAction_0;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_OVER);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_OVER);
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.step_over_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.step_over_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER);
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.toolbar.stepOver"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.toolbar.stepOver"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_OVER);
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.StepOverAction_3;
- }
+ return ActionMessages.StepOverAction_3;
+ }
@Override
protected Class<IStepOverHandler> getCommandType() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java
index 3dfa7fe3f..a0d6fa9fa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandActionDelegate.java
@@ -23,15 +23,15 @@ import org.eclipse.jface.action.IAction;
*/
public class StepOverCommandActionDelegate extends DebugCommandActionDelegate {
- public StepOverCommandActionDelegate() {
- super();
- setAction(new StepOverCommandAction());
- }
+ public StepOverCommandActionDelegate() {
+ super();
+ setAction(new StepOverCommandAction());
+ }
- @Override
+ @Override
public void init(IAction action) {
- super.init(action);
- }
+ super.init(action);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java
index a0f65c34f..0200431d6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepOverCommandHandler.java
@@ -24,9 +24,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class StepOverCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IStepOverHandler> getCommandType() {
- return IStepOverHandler.class;
- }
+ return IStepOverHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java
index 15b1721fb..171e9c5dd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandAction.java
@@ -32,40 +32,40 @@ public class StepReturnCommandAction extends DebugCommandAction {
setActionDefinitionId("org.eclipse.debug.ui.commands.StepReturn"); //$NON-NLS-1$
}
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_RETURN);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEP_RETURN);
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.step_return_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.step_return_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.toolbar.stepReturn"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.toolbar.stepReturn"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEP_RETURN);
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.StepReturnAction_2;
- }
+ return ActionMessages.StepReturnAction_2;
+ }
- @Override
+ @Override
public String getText() {
- return ActionMessages.StepReturnAction_3;
- }
+ return ActionMessages.StepReturnAction_3;
+ }
@Override
protected Class<IStepReturnHandler> getCommandType() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java
index 847f85f68..8a1cab3b6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandActionDelegate.java
@@ -21,10 +21,10 @@ package org.eclipse.debug.internal.ui.commands.actions;
*/
public class StepReturnCommandActionDelegate extends DebugCommandActionDelegate {
- public StepReturnCommandActionDelegate() {
- super();
- setAction(new StepReturnCommandAction());
- }
+ public StepReturnCommandActionDelegate() {
+ super();
+ setAction(new StepReturnCommandAction());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java
index c838fde75..02aacafd2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/StepReturnCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class StepReturnCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IStepReturnHandler> getCommandType() {
- return IStepReturnHandler.class;
- }
+ return IStepReturnHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java
index a25e4a59d..e32cd6bae 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandAction.java
@@ -27,44 +27,44 @@ import org.eclipse.jface.resource.ImageDescriptor;
*/
public class SuspendCommandAction extends DebugCommandAction {
- public SuspendCommandAction() {
- setActionDefinitionId("org.eclipse.debug.ui.commands.Suspend"); //$NON-NLS-1$
- }
+ public SuspendCommandAction() {
+ setActionDefinitionId("org.eclipse.debug.ui.commands.Suspend"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getText() {
- return ActionMessages.SuspendAction_0;
- }
+ return ActionMessages.SuspendAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.suspend_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.suspend_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.commands.Suspend"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.commands.Suspend"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.SuspendAction_3;
- }
+ return ActionMessages.SuspendAction_3;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_SUSPEND);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_SUSPEND);
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SUSPEND);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SUSPEND);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SUSPEND);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SUSPEND);
+ }
@Override
protected Class<ISuspendHandler> getCommandType() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java
index 3c7386d56..de72598f5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandActionDelegate.java
@@ -21,10 +21,10 @@ package org.eclipse.debug.internal.ui.commands.actions;
*/
public class SuspendCommandActionDelegate extends DebugCommandActionDelegate {
- public SuspendCommandActionDelegate() {
- super();
- setAction(new SuspendCommandAction());
- }
+ public SuspendCommandActionDelegate() {
+ super();
+ setAction(new SuspendCommandAction());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java
index b2ad3106a..8c8e8e20b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/SuspendCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class SuspendCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<ISuspendHandler> getCommandType() {
- return ISuspendHandler.class;
- }
+ return ISuspendHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
index 65c811c6b..31a513e95 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java
@@ -39,9 +39,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
*/
public class TerminateAndRelaunchAction extends DebugCommandAction {
- @Override
+ @Override
public void postExecute(IRequest request, final Object[] targets) {
- if (request.getStatus() == null || request.getStatus().isOK()) {
+ if (request.getStatus() == null || request.getStatus().isOK()) {
DebugUIPlugin.getStandardDisplay().asyncExec(() -> {
// Must be run in the UI thread since the launch can require
// prompting to proceed
@@ -52,26 +52,26 @@ public class TerminateAndRelaunchAction extends DebugCommandAction {
}
}
});
- }
- }
+ }
+ }
- @Override
+ @Override
protected ISelection getContext() {
- // Convert action context to contain only launch objects (bug 356651).
- ISelection context = super.getContext();
- if (context instanceof IStructuredSelection && !context.isEmpty()) {
- IStructuredSelection ss = (IStructuredSelection)context;
+ // Convert action context to contain only launch objects (bug 356651).
+ ISelection context = super.getContext();
+ if (context instanceof IStructuredSelection && !context.isEmpty()) {
+ IStructuredSelection ss = (IStructuredSelection)context;
Set<ILaunch> launches = new HashSet<>(ss.size());
for (Iterator<Object> itr = ss.iterator(); itr.hasNext();) {
- ILaunch launch = DebugUIPlugin.getLaunch(itr.next());
- if (launch != null) {
- launches.add(launch);
- }
- }
- return new StructuredSelection(launches.toArray());
- }
- return super.getContext();
- }
+ ILaunch launch = DebugUIPlugin.getLaunch(itr.next());
+ if (launch != null) {
+ launches.add(launch);
+ }
+ }
+ return new StructuredSelection(launches.toArray());
+ }
+ return super.getContext();
+ }
@Override
@@ -94,54 +94,54 @@ public class TerminateAndRelaunchAction extends DebugCommandAction {
super.debugContextChanged(event);
}
- protected boolean canRelaunch(Object element) {
- ILaunch launch = DebugUIPlugin.getLaunch(element);
- if (launch != null) {
- ILaunchConfiguration configuration = launch.getLaunchConfiguration();
- if (configuration != null) {
- return LaunchConfigurationManager.isVisible(configuration);
- }
- }
+ protected boolean canRelaunch(Object element) {
+ ILaunch launch = DebugUIPlugin.getLaunch(element);
+ if (launch != null) {
+ ILaunchConfiguration configuration = launch.getLaunchConfiguration();
+ if (configuration != null) {
+ return LaunchConfigurationManager.isVisible(configuration);
+ }
+ }
return false;
- }
+ }
- @Override
+ @Override
public String getActionDefinitionId() {
- return ActionMessages.TerminateAndRelaunchAction_0;
- }
+ return ActionMessages.TerminateAndRelaunchAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.terminate_and_relaunch_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.terminate_and_relaunch_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.popupMenu.TerminateAndRelaunch"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.popupMenu.TerminateAndRelaunch"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getText() {
- return ActionMessages.TerminateAndRelaunchAction_3;
- }
+ return ActionMessages.TerminateAndRelaunchAction_3;
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.TerminateAndRelaunchAction_4;
- }
+ return ActionMessages.TerminateAndRelaunchAction_4;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_RELAUNCH);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_RELAUNCH);
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_RELAUNCH);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
index 3eaf360ca..40ad431b6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java
@@ -53,120 +53,120 @@ public class TerminateAndRemoveAction extends DebugCommandAction {
*/
private IWorkbenchPart fMyPart = null;
- @Override
+ @Override
public String getText() {
- return ActionMessages.TerminateAndRemoveAction_0;
- }
+ return ActionMessages.TerminateAndRemoveAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.terminate_and_remove_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.terminate_and_remove_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.popupMenu.terminateAndRemove"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.popupMenu.terminateAndRemove"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.TerminateAndRemoveAction_3;
- }
+ return ActionMessages.TerminateAndRemoveAction_3;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_REMOVE);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE_AND_REMOVE);
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE_AND_REMOVE);
+ }
- @Override
+ @Override
protected Class<ITerminateHandler> getCommandType() {
return ITerminateHandler.class;
}
- @Override
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- boolean isAllTerminated = true;
- ISelection context = event.getContext();
- if (context instanceof IStructuredSelection) {
- Object[] elements = ((IStructuredSelection)context).toArray();
- for (int i = 0; i < elements.length; i++) {
- if (!isTerminated(elements[i])) {
- isAllTerminated = false;
- break;
- }
- }
- }
- // IF all elements are terminated, we don't need to query the terminate handler, just
- // enable the action, which whill just remove the terminated launches (bug 324959).
- fCanTerminate = !isAllTerminated;
- if (isAllTerminated) {
- setEnabled(true);
- } else {
- super.debugContextChanged(event);
- }
- }
-
- protected boolean isTerminated(Object element) {
- ILaunch launch = DebugUIPlugin.getLaunch(element);
- if (launch != null) {
- return launch.isTerminated();
- }
- return false;
- }
-
-
- @Override
+ boolean isAllTerminated = true;
+ ISelection context = event.getContext();
+ if (context instanceof IStructuredSelection) {
+ Object[] elements = ((IStructuredSelection)context).toArray();
+ for (int i = 0; i < elements.length; i++) {
+ if (!isTerminated(elements[i])) {
+ isAllTerminated = false;
+ break;
+ }
+ }
+ }
+ // IF all elements are terminated, we don't need to query the terminate handler, just
+ // enable the action, which whill just remove the terminated launches (bug 324959).
+ fCanTerminate = !isAllTerminated;
+ if (isAllTerminated) {
+ setEnabled(true);
+ } else {
+ super.debugContextChanged(event);
+ }
+ }
+
+ protected boolean isTerminated(Object element) {
+ ILaunch launch = DebugUIPlugin.getLaunch(element);
+ if (launch != null) {
+ return launch.isTerminated();
+ }
+ return false;
+ }
+
+
+ @Override
protected void postExecute(IRequest request, Object[] targets) {
- IStatus status = request.getStatus();
- if(status == null || status.isOK()) {
- for (int i = 0; i < targets.length; i++) {
- ILaunch launch = DebugUIPlugin.getLaunch(targets[i]);
- if (launch != null) {
+ IStatus status = request.getStatus();
+ if(status == null || status.isOK()) {
+ for (int i = 0; i < targets.length; i++) {
+ ILaunch launch = DebugUIPlugin.getLaunch(targets[i]);
+ if (launch != null) {
DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
}
- }
- }
- }
+ }
+ }
+ }
- @Override
+ @Override
public void runWithEvent(Event event) {
- if (fCanTerminate) {
+ if (fCanTerminate) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- if (!MessageDialog.openQuestion(window.getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_1, DebugUIViewsMessages.LaunchView_Terminate_and_remove_selected__2)) {
+ if (window != null) {
+ if (!MessageDialog.openQuestion(window.getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_1, DebugUIViewsMessages.LaunchView_Terminate_and_remove_selected__2)) {
return;
}
- }
- super.runWithEvent(event);
- } else {
- // don't terminate, just remove
- // TODO: make #getContext() API in next release
- ISelection sel = null;
- if (fMyPart != null) {
- sel = getDebugContextService().getActiveContext(fMyPart.getSite().getId());
- } else {
- sel = getDebugContextService().getActiveContext();
- }
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) sel;
- postExecute(new Request(), ss.toArray());
- }
- }
- }
-
- @Override
+ }
+ super.runWithEvent(event);
+ } else {
+ // don't terminate, just remove
+ // TODO: make #getContext() API in next release
+ ISelection sel = null;
+ if (fMyPart != null) {
+ sel = getDebugContextService().getActiveContext(fMyPart.getSite().getId());
+ } else {
+ sel = getDebugContextService().getActiveContext();
+ }
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) sel;
+ postExecute(new Request(), ss.toArray());
+ }
+ }
+ }
+
+ @Override
public void init(IWorkbenchPart part) {
- super.init(part); // TODO: if #getContext() was API, this would not be needed
- fMyPart = part;
- }
+ super.init(part); // TODO: if #getContext() was API, this would not be needed
+ fMyPart = part;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java
index 84ae64f28..8c60f211a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandAction.java
@@ -31,40 +31,40 @@ public class TerminateCommandAction extends DebugCommandAction {
setActionDefinitionId("org.eclipse.debug.ui.commands.Terminate"); //$NON-NLS-1$
}
- @Override
+ @Override
public String getText() {
- return ActionMessages.TerminateAction_0;
- }
+ return ActionMessages.TerminateAction_0;
+ }
- @Override
+ @Override
public String getHelpContextId() {
- return "org.eclipse.debug.ui.terminate_action_context"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.terminate_action_context"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getId() {
- return "org.eclipse.debug.ui.debugview.toolbar.terminate"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.debugview.toolbar.terminate"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getToolTipText() {
- return ActionMessages.TerminateAction_3;
- }
+ return ActionMessages.TerminateAction_3;
+ }
- @Override
+ @Override
public ImageDescriptor getDisabledImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE);
+ }
- @Override
+ @Override
public ImageDescriptor getHoverImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE);
- }
+ return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE);
+ }
@Override
protected Class<ITerminateHandler> getCommandType() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java
index d2c5d1ce5..7f1a77480 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandActionDelegate.java
@@ -21,10 +21,10 @@ package org.eclipse.debug.internal.ui.commands.actions;
*/
public class TerminateCommandActionDelegate extends DebugCommandActionDelegate {
- public TerminateCommandActionDelegate() {
- super();
- setAction(new TerminateCommandAction());
- }
+ public TerminateCommandActionDelegate() {
+ super();
+ setAction(new TerminateCommandAction());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java
index 9fc2cda56..a0a67efa9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class TerminateCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<ITerminateHandler> getCommandType() {
- return ITerminateHandler.class;
- }
+ return ITerminateHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
index bd69e7102..60b5eb8ad 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersAction.java
@@ -111,28 +111,28 @@ public class ToggleStepFiltersAction extends DebugCommandAction implements IPref
return IStepFiltersHandler.class;
}
- /**
- * @see org.eclipse.debug.internal.ui.commands.actions.DebugCommandAction#run()
- */
- @Override
+ /**
+ * @see org.eclipse.debug.internal.ui.commands.actions.DebugCommandAction#run()
+ */
+ @Override
public void run() {
- // ignore initial call to run from abstract debug view
- // that runs the action to initialize it's state when
- // the workbench persisted the action as "on"
- if (fInitialized) {
- DebugUITools.setUseStepFilters(!DebugUITools.isUseStepFilters());
- } else {
- fInitialized = true;
- }
- }
-
- /**
- * @see org.eclipse.jface.action.Action#getStyle()
- */
- @Override
+ // ignore initial call to run from abstract debug view
+ // that runs the action to initialize it's state when
+ // the workbench persisted the action as "on"
+ if (fInitialized) {
+ DebugUITools.setUseStepFilters(!DebugUITools.isUseStepFilters());
+ } else {
+ fInitialized = true;
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#getStyle()
+ */
+ @Override
public int getStyle() {
- return AS_CHECK_BOX;
- }
+ return AS_CHECK_BOX;
+ }
/**
* @see org.eclipse.debug.internal.ui.commands.actions.DebugCommandAction#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
@@ -165,15 +165,15 @@ public class ToggleStepFiltersAction extends DebugCommandAction implements IPref
initState();
}
- /**
- * Initializes the state, by adding this action as a property listener
- */
- protected void initState() {
+ /**
+ * Initializes the state, by adding this action as a property listener
+ */
+ protected void initState() {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugPlugin.getUniqueIdentifier());
if (node != null) {
node.addPreferenceChangeListener(this);
}
- }
+ }
/**
* @see org.eclipse.debug.internal.ui.commands.actions.DebugCommandAction#dispose()
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java
index 10b369b84..983fdf372 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandActionDelegate.java
@@ -24,17 +24,17 @@ import org.eclipse.jface.action.IAction;
*/
public class ToggleStepFiltersCommandActionDelegate extends DebugCommandActionDelegate {
- /**
- * Constructor
- */
- public ToggleStepFiltersCommandActionDelegate() {
- super();
- setAction(new ToggleStepFiltersAction());
- }
+ /**
+ * Constructor
+ */
+ public ToggleStepFiltersCommandActionDelegate() {
+ super();
+ setAction(new ToggleStepFiltersAction());
+ }
- @Override
+ @Override
public void init(IAction action) {
- super.init(action);
- action.setChecked(DebugUITools.isUseStepFilters());
- }
+ super.init(action);
+ action.setChecked(DebugUITools.isUseStepFilters());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java
index 8aa7376e7..626f89979 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ToggleStepFiltersCommandHandler.java
@@ -25,9 +25,9 @@ import org.eclipse.debug.ui.actions.DebugCommandHandler;
*/
public class ToggleStepFiltersCommandHandler extends DebugCommandHandler {
- @Override
+ @Override
protected Class<IStepFiltersHandler> getCommandType() {
- return IStepFiltersHandler.class;
- }
+ return IStepFiltersHandler.class;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
index 26189abdc..2accbd644 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
@@ -115,11 +115,11 @@ public class DebugContextManager implements IDebugContextManager {
@Override
public void windowClosed(final IWorkbenchWindow window) {
- DebugWindowContextService service = fServices.get(window);
- if (service != null) {
- fServices.remove(window);
- service.dispose();
- }
+ DebugWindowContextService service = fServices.get(window);
+ if (service != null) {
+ fServices.remove(window);
+ service.dispose();
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
index 69add3b9c..961af8776 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
@@ -35,12 +35,12 @@ import org.eclipse.ui.services.IEvaluationService;
*/
public class DebugContextSourceProvider extends AbstractSourceProvider implements IDebugContextListener {
- /**
- * The names of the sources supported by this source provider.
- */
- private static final String[] PROVIDED_SOURCE_NAMES = new String[] { IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME };
+ /**
+ * The names of the sources supported by this source provider.
+ */
+ private static final String[] PROVIDED_SOURCE_NAMES = new String[] { IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME };
- private final IDebugContextService fDebugContextService;
+ private final IDebugContextService fDebugContextService;
private final IEvaluationService fEvaluationService;
@@ -59,7 +59,7 @@ public class DebugContextSourceProvider extends AbstractSourceProvider implement
@Override
public void debugContextChanged(DebugContextEvent event) {
final Map<String, ISelection> values = new HashMap<>(1);
- values.put(IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME, event.getContext());
+ values.put(IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME, event.getContext());
// make sure fireSourceChanged is called on the UI thread
if (Display.getCurrent() == null) {
DebugUIPlugin.getStandardDisplay().asyncExec(() -> fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, values));
@@ -82,8 +82,8 @@ public class DebugContextSourceProvider extends AbstractSourceProvider implement
@Override
public Map getCurrentState() {
Map<String, ISelection> currentState = new HashMap<>(1);
- currentState.put(IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME, fDebugContextService.getActiveContext());
- return currentState;
+ currentState.put(IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME, fDebugContextService.getActiveContext());
+ return currentState;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
index e4a08ec34..73e9c12d1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugModelContextBindingManager.java
@@ -145,14 +145,14 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
String modelIdentifier = element.getAttribute(ATTR_DEBUG_MODEL_ID);
String contextId = element.getAttribute(ATTR_CONTEXT_ID);
synchronized (this) {
- if (modelIdentifier != null && contextId != null) {
+ if (modelIdentifier != null && contextId != null) {
List<String> contextIds = fModelToContextIds.get(modelIdentifier);
- if (contextIds == null) {
+ if (contextIds == null) {
contextIds = new ArrayList<>();
- fModelToContextIds.put(modelIdentifier, contextIds);
- }
- contextIds.add(contextId);
- }
+ fModelToContextIds.put(modelIdentifier, contextIds);
+ }
+ contextIds.add(contextId);
+ }
}
}
}
@@ -211,20 +211,20 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
List<String> toEnable = new ArrayList<>(modelIds.length);
synchronized (this) {
Set<String> alreadyEnabled = fLaunchToModelIds.get(launch);
- if (alreadyEnabled == null) {
+ if (alreadyEnabled == null) {
alreadyEnabled = new HashSet<>();
- fLaunchToModelIds.put(launch, alreadyEnabled);
- }
- for (int i = 0; i < modelIds.length; i++) {
- String id = modelIds[i];
- if (!alreadyEnabled.contains(id)) {
- alreadyEnabled.add(id);
- toEnable.add(id);
- }
- }
+ fLaunchToModelIds.put(launch, alreadyEnabled);
+ }
+ for (int i = 0; i < modelIds.length; i++) {
+ String id = modelIds[i];
+ if (!alreadyEnabled.contains(id)) {
+ alreadyEnabled.add(id);
+ toEnable.add(id);
+ }
+ }
}
for (int i = 0; i < toEnable.size(); i++) {
- activateModel(toEnable.get(i), launch);
+ activateModel(toEnable.get(i), launch);
}
enableActivitiesFor(modelIds);
@@ -239,17 +239,17 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
*/
private void activateModel(String modelId, ILaunch launch) {
List<String> contextIds = null;
- synchronized (this) {
- contextIds = fModelToContextIds.get(modelId);
- if (contextIds == null) {
- // if there are no contexts for a model, the base debug context should
- // be activated (i.e. a debug model with no org.eclipse.ui.contexts and
- // associated org.eclipse.debug.ui.modelContextBindings)
+ synchronized (this) {
+ contextIds = fModelToContextIds.get(modelId);
+ if (contextIds == null) {
+ // if there are no contexts for a model, the base debug context should
+ // be activated (i.e. a debug model with no org.eclipse.ui.contexts and
+ // associated org.eclipse.debug.ui.modelContextBindings)
contextIds = new ArrayList<>();
- contextIds.add(DEBUG_CONTEXT);
- fModelToContextIds.put(modelId, contextIds);
- }
- }
+ contextIds.add(DEBUG_CONTEXT);
+ fModelToContextIds.put(modelId, contextIds);
+ }
+ }
for (String id : contextIds) {
activateContext(id, launch);
}
@@ -303,7 +303,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
*/
private String[] getDebugModelIds(Object object) {
if (object instanceof IAdaptable) {
- IDebugModelProvider modelProvider= ((IAdaptable)object).getAdapter(IDebugModelProvider.class);
+ IDebugModelProvider modelProvider= ((IAdaptable)object).getAdapter(IDebugModelProvider.class);
if (modelProvider != null) {
String[] modelIds= modelProvider.getModelIdentifiers();
if (modelIds != null) {
@@ -342,8 +342,8 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
ILaunch launch = launches[i];
List<IContextActivation> activations;
synchronized(this) {
- activations = fLanuchToContextActivations.remove(launch);
- fLaunchToModelIds.remove(launch);
+ activations = fLanuchToContextActivations.remove(launch);
+ fLaunchToModelIds.remove(launch);
}
if (activations != null) {
final List<IContextActivation> _activations = activations;
@@ -389,13 +389,13 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
String modelId = modelIds[i];
synchronized (this) {
List<String> contextIds = fModelToContextIds.get(modelId);
- if (contextIds != null) {
+ if (contextIds != null) {
for (String contextId : contextIds) {
- if (!workbenchContexts.contains(contextId)) {
- workbenchContexts.add(contextId);
- }
- }
- }
+ if (!workbenchContexts.contains(contextId)) {
+ workbenchContexts.add(contextId);
+ }
+ }
+ }
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
index 15d529686..2252c2baa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
@@ -79,7 +79,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
@Override
public synchronized void addDebugContextProvider(IDebugContextProvider provider) {
- if (fWindow == null)
+ if (fWindow == null)
{
return; // disposed
}
@@ -89,26 +89,26 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
// Check if provider is a window context provider
boolean canSetActive = true;
- if (provider instanceof IDebugContextProvider2) {
- canSetActive = ((IDebugContextProvider2) provider).isWindowContextProvider();
- }
- // Make the provider active if matches the active part. Otherwise, it
- // may still become the active provider if fProviders.isEmpty().
+ if (provider instanceof IDebugContextProvider2) {
+ canSetActive = ((IDebugContextProvider2) provider).isWindowContextProvider();
+ }
+ // Make the provider active if matches the active part. Otherwise, it
+ // may still become the active provider if fProviders.isEmpty().
if (canSetActive) {
- IWorkbenchPart activePart = null;
- IWorkbenchPage activePage = fWindow.getActivePage();
- if (activePage != null) {
- activePart = activePage.getActivePart();
- }
- canSetActive = (activePart == null && part == null) || (activePart != null && activePart.equals(part));
+ IWorkbenchPart activePart = null;
+ IWorkbenchPage activePage = fWindow.getActivePage();
+ if (activePage != null) {
+ activePart = activePage.getActivePart();
+ }
+ canSetActive = (activePart == null && part == null) || (activePart != null && activePart.equals(part));
}
if (canSetActive) {
- fProviders.add(0, provider);
+ fProviders.add(0, provider);
} else {
- fProviders.add(provider);
+ fProviders.add(provider);
}
- notify(provider);
+ notify(provider);
provider.addDebugContextListener(this);
}
@@ -124,16 +124,16 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
IDebugContextProvider activeProvider = getActiveProvider();
if (index == 0) {
- if (activeProvider != null) {
- notify(activeProvider);
- } else {
- // Removed last provider. Send empty selection to all listeners.
- notify(new DebugContextEvent(provider, StructuredSelection.EMPTY, DebugContextEvent.ACTIVATED));
- }
+ if (activeProvider != null) {
+ notify(activeProvider);
+ } else {
+ // Removed last provider. Send empty selection to all listeners.
+ notify(new DebugContextEvent(provider, StructuredSelection.EMPTY, DebugContextEvent.ACTIVATED));
+ }
} else {
- // Notify listeners of the removed provider with the active window context.
- notifyPart(provider.getPart(),
- new DebugContextEvent(activeProvider, getActiveContext(), DebugContextEvent.ACTIVATED));
+ // Notify listeners of the removed provider with the active window context.
+ notifyPart(provider.getPart(),
+ new DebugContextEvent(activeProvider, getActiveContext(), DebugContextEvent.ACTIVATED));
}
}
provider.removeDebugContextListener(this);
@@ -191,9 +191,9 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
protected void notify(DebugContextEvent event) {
- // Allow handling for case where getActiveProvider() == null.
- // This can happen upon removeContextProvider() called on last available
- // provider (bug 360637).
+ // Allow handling for case where getActiveProvider() == null.
+ // This can happen upon removeContextProvider() called on last available
+ // provider (bug 360637).
IDebugContextProvider provider = getActiveProvider();
IWorkbenchPart part = event.getDebugContextProvider().getPart();
@@ -215,11 +215,11 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
protected void notifyPart(IWorkbenchPart part, DebugContextEvent event) {
- if (part != null) {
- notify(event, getListeners(part));
- notify(event, getPostListeners(part));
- }
- }
+ if (part != null) {
+ notify(event, getListeners(part));
+ notify(event, getPostListeners(part));
+ }
+ }
protected void notify(final DebugContextEvent event, ListenerList<IDebugContextListener> listeners) {
for (final IDebugContextListener listener : listeners) {
@@ -237,12 +237,12 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
protected ListenerList<IDebugContextListener> getListeners(IWorkbenchPart part) {
- String id = null;
- if (part != null) {
- id = getCombinedPartId(part);
+ String id = null;
+ if (part != null) {
+ id = getCombinedPartId(part);
ListenerList<IDebugContextListener> listenerList = fListenersByPartId.get(id);
return listenerList != null ? listenerList : new ListenerList<>();
- } else {
+ } else {
ListenerList<IDebugContextListener> listenerList = fListenersByPartId.get(null);
ListenerList<IDebugContextListener> retVal = new ListenerList<>();
if (listenerList != null) {
@@ -252,15 +252,15 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
outer: for (Iterator<String> itr = fListenersByPartId.keySet().iterator(); itr.hasNext();) {
- String listenerPartId = itr.next();
- for (int i = 0; i < fProviders.size(); i++) {
- String providerPartId = getCombinedPartId(fProviders.get(i).getPart());
- if ((listenerPartId == null && providerPartId == null) ||
- (listenerPartId != null && listenerPartId.equals(providerPartId)))
- {
- continue outer;
- }
- }
+ String listenerPartId = itr.next();
+ for (int i = 0; i < fProviders.size(); i++) {
+ String providerPartId = getCombinedPartId(fProviders.get(i).getPart());
+ if ((listenerPartId == null && providerPartId == null) ||
+ (listenerPartId != null && listenerPartId.equals(providerPartId)))
+ {
+ continue outer;
+ }
+ }
ListenerList<IDebugContextListener> listenersForPart = fListenersByPartId.get(listenerPartId);
if (listenersForPart != null) {
for (IDebugContextListener iDebugContextListener : listenersForPart) {
@@ -270,7 +270,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
}
return retVal;
- }
+ }
}
protected ListenerList<IDebugContextListener> getPostListeners(IWorkbenchPart part) {
@@ -412,16 +412,16 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
}
private String getCombinedPartId(IWorkbenchPart part) {
- if (part == null) {
- return null;
- } else if (part.getSite() instanceof IViewSite) {
- IViewSite site = (IViewSite)part.getSite();
- return getCombinedPartId(site.getId(), site.getSecondaryId());
-
- } else {
- return part.getSite().getId();
- }
- }
+ if (part == null) {
+ return null;
+ } else if (part.getSite() instanceof IViewSite) {
+ IViewSite site = (IViewSite)part.getSite();
+ return getCombinedPartId(site.getId(), site.getSecondaryId());
+
+ } else {
+ return part.getSite().getId();
+ }
+ }
private String getCombinedPartId(String id, String secondaryId) {
return id + (secondaryId != null ? ":" + secondaryId : ""); //$NON-NLS-1$//$NON-NLS-2$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java
index 61f788708..33531919e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java
@@ -56,19 +56,19 @@ public class LaunchSuspendTrigger implements ISuspendTrigger, IDebugEventSetList
@Override
public void addSuspendTriggerListener(ISuspendTriggerListener listener) {
- if (fListeners != null) {
- fListeners.add(listener);
- }
+ if (fListeners != null) {
+ fListeners.add(listener);
+ }
}
@Override
public void removeSuspendTriggerListener(ISuspendTriggerListener listener) {
- if (fListeners != null) {
- fListeners.remove(listener);
- }
- if (fListeners.size() == 0) {
- dispose();
- }
+ if (fListeners != null) {
+ fListeners.remove(listener);
+ }
+ if (fListeners.size() == 0) {
+ dispose();
+ }
}
@Override
@@ -111,23 +111,23 @@ public class LaunchSuspendTrigger implements ISuspendTrigger, IDebugEventSetList
}
final Object temp = context;
ListenerList<ISuspendTriggerListener> list = fListeners;
- if (list != null) {
+ if (list != null) {
for (ISuspendTriggerListener iSuspendTriggerListener : list) {
final ISuspendTriggerListener listener = iSuspendTriggerListener;
- SafeRunner.run(new ISafeRunnable() {
- @Override
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
public void run() throws Exception {
- listener.suspended(launch, temp);
- }
+ listener.suspended(launch, temp);
+ }
- @Override
+ @Override
public void handleException(Throwable exception) {
- DebugUIPlugin.log(exception);
- }
+ DebugUIPlugin.log(exception);
+ }
- });
- }
- }
+ });
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AsynchronousDebugLabelAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AsynchronousDebugLabelAdapter.java
index 756e5dffc..9515644d4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AsynchronousDebugLabelAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AsynchronousDebugLabelAdapter.java
@@ -41,31 +41,31 @@ public class AsynchronousDebugLabelAdapter extends AsynchronousLabelAdapter {
@Override
protected void computeLabels(Object element, IPresentationContext context, ILabelRequestMonitor monitor) {
- DelegatingModelPresentation presentation = DebugElementHelper.getPresentation();
- // Honor view specific settings in a debug view by copying model presentation settings
- // into the debug element helper's presentation before we get the label. This allows
- // for qualified name and type name settings to remain in tact.
- if (element instanceof IDebugElement && context.getPart() instanceof IDebugView) {
- IDebugView debugView = (IDebugView)context.getPart();
+ DelegatingModelPresentation presentation = DebugElementHelper.getPresentation();
+ // Honor view specific settings in a debug view by copying model presentation settings
+ // into the debug element helper's presentation before we get the label. This allows
+ // for qualified name and type name settings to remain in tact.
+ if (element instanceof IDebugElement && context.getPart() instanceof IDebugView) {
+ IDebugView debugView = (IDebugView)context.getPart();
IDebugModelPresentation pres = debugView.getPresentation(((IDebugElement)element).getModelIdentifier());
Map<String, Object> settings = null;
- synchronized (presentation) {
- if (pres instanceof DelegatingModelPresentation) {
- settings = ((DelegatingModelPresentation)pres).getAttributes();
- } else if (pres instanceof LazyModelPresentation) {
- settings = ((LazyModelPresentation)pres).getAttributes();
- }
- if (settings != null) {
+ synchronized (presentation) {
+ if (pres instanceof DelegatingModelPresentation) {
+ settings = ((DelegatingModelPresentation)pres).getAttributes();
+ } else if (pres instanceof LazyModelPresentation) {
+ settings = ((LazyModelPresentation)pres).getAttributes();
+ }
+ if (settings != null) {
for (Entry<String, Object> entry : settings.entrySet()) {
- presentation.setAttribute(entry.getKey(), entry.getValue());
- }
- super.computeLabels(element, context, monitor);
- return;
- }
- }
+ presentation.setAttribute(entry.getKey(), entry.getValue());
+ }
+ super.computeLabels(element, context, monitor);
+ return;
+ }
+ }
}
- super.computeLabels(element, context, monitor);
- }
+ super.computeLabels(element, context, monitor);
+ }
@Override
protected String[] getLabels(Object element, IPresentationContext context) throws CoreException {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointsViewInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointsViewInput.java
index 063a79dff..48b9df963 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointsViewInput.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointsViewInput.java
@@ -47,26 +47,26 @@ public class DefaultBreakpointsViewInput {
return fContext;
}
- @Override
+ @Override
public int hashCode() {
- if (getContext() != null) {
- return getContext().hashCode();
- } else {
- return 1;
- }
- }
+ if (getContext() != null) {
+ return getContext().hashCode();
+ } else {
+ return 1;
+ }
+ }
- @Override
+ @Override
public boolean equals(Object arg0) {
- if ( (arg0 != null) && arg0.getClass().equals(this.getClass()) ) {
+ if ( (arg0 != null) && arg0.getClass().equals(this.getClass()) ) {
- IPresentationContext context = ((DefaultBreakpointsViewInput) arg0).getContext();
- if (getContext() != null && context != null) {
+ IPresentationContext context = ((DefaultBreakpointsViewInput) arg0).getContext();
+ if (getContext() != null && context != null) {
return getContext().equals(context);
}
- }
+ }
- return super.equals(arg0);
- }
+ return super.equals(arg0);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java
index ca4642f13..5dd952441 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultVariableCellModifier.java
@@ -55,8 +55,8 @@ public class DefaultVariableCellModifier implements ICellModifier {
@Override
public void modify(Object element, String property, Object value) {
Object oldValue = getValue(element, property);
- if (!value.equals(oldValue)) {
- if (VariableColumnPresentation.COLUMN_VARIABLE_VALUE.equals(property)) {
+ if (!value.equals(oldValue)) {
+ if (VariableColumnPresentation.COLUMN_VARIABLE_VALUE.equals(property)) {
if (element instanceof IVariable) {
if (value instanceof String) {
// The value column displays special characters escaped, so encode the string with any special characters escaped properly
@@ -65,7 +65,7 @@ public class DefaultVariableCellModifier implements ICellModifier {
DetailPaneAssignValueAction.assignValue(DebugUIPlugin.getShell(), variable, valueExpression);
}
}
- }
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java
index a43f926c2..041702722 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryRetrievalContentAdapter.java
@@ -27,12 +27,12 @@ public class MemoryRetrievalContentAdapter extends AsynchronousContentAdapter{
protected Object[] getChildren(Object parent, IPresentationContext context) throws CoreException {
String id = context.getId();
if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW))
- {
+ {
if (parent instanceof IMemoryBlockRetrieval)
{
- return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent);
+ return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent);
}
- }
+ }
return EMPTY;
}
@@ -40,14 +40,14 @@ public class MemoryRetrievalContentAdapter extends AsynchronousContentAdapter{
protected boolean hasChildren(Object element, IPresentationContext context) throws CoreException {
String id = context.getId();
if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW))
- {
+ {
if (element instanceof IMemoryBlockRetrieval)
{
if (((IMemoryBlockRetrieval)element).supportsStorageRetrieval())
- return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)element).length > 0;
+ return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)element).length > 0;
}
- }
- return false;
+ }
+ return false;
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java
index ed3b76001..e802b3469 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java
@@ -30,21 +30,21 @@ public class StackFrameViewerInputProvider extends ViewerInputProvider {
@Override
protected Object getViewerInput(Object source, IPresentationContext context, IViewerUpdate update) throws CoreException {
- if ( IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId()) ) {
- return new RegisterGroupProxy((IStackFrame) source);
- } else if ( IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(context.getId()) ) {
- return new DefaultBreakpointsViewInput(context);
- } else {
- return DebugPlugin.getDefault().getExpressionManager();
- }
+ if ( IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId()) ) {
+ return new RegisterGroupProxy((IStackFrame) source);
+ } else if ( IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(context.getId()) ) {
+ return new DefaultBreakpointsViewInput(context);
+ } else {
+ return DebugPlugin.getDefault().getExpressionManager();
+ }
}
@Override
protected boolean supportsContextId(String id) {
return IDebugUIConstants.ID_REGISTER_VIEW.equals(id) ||
- IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id) ||
- IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
+ IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id) ||
+ IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java
index e32ff8f05..6e6dca082 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/VariableColumnFactoryAdapter.java
@@ -31,10 +31,10 @@ public class VariableColumnFactoryAdapter implements IColumnPresentationFactory
@Override
public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) {
String id = context.getId();
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) ||
- IDebugUIConstants.ID_REGISTER_VIEW.equals(id) ||
- IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id))
- {
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) ||
+ IDebugUIConstants.ID_REGISTER_VIEW.equals(id) ||
+ IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id))
+ {
if (element instanceof IStackFrame || element instanceof IExpressionManager) {
return new VariableColumnPresentation();
}
@@ -46,8 +46,8 @@ public class VariableColumnFactoryAdapter implements IColumnPresentationFactory
public String getColumnPresentationId(IPresentationContext context, Object element) {
String id = context.getId();
if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) ||
- IDebugUIConstants.ID_REGISTER_VIEW.equals(id) ||
- IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id))
+ IDebugUIConstants.ID_REGISTER_VIEW.equals(id) ||
+ IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id))
{
if (element instanceof IStackFrame || element instanceof IExpressionManager) {
return IDebugUIConstants.COLUMN_PRESENTATION_ID_VARIABLE;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/WatchExpressionCellModifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/WatchExpressionCellModifier.java
index 61246b462..0bc7ffddf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/WatchExpressionCellModifier.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/WatchExpressionCellModifier.java
@@ -29,30 +29,30 @@ public class WatchExpressionCellModifier implements ICellModifier {
@Override
public boolean canModify(Object element, String property) {
- if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(property)) {
- return element instanceof IWatchExpression;
- }
+ if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(property)) {
+ return element instanceof IWatchExpression;
+ }
return false;
}
@Override
public Object getValue(Object element, String property) {
- if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(property)) {
- return DefaultLabelProvider.escapeSpecialChars( ((IWatchExpression)element).getExpressionText() );
- }
- return null;
+ if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(property)) {
+ return DefaultLabelProvider.escapeSpecialChars( ((IWatchExpression)element).getExpressionText() );
+ }
+ return null;
}
@Override
public void modify(Object element, String property, Object value) {
Object oldValue = getValue(element, property);
- if (!value.equals(oldValue)) {
- if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(property)) {
+ if (!value.equals(oldValue)) {
+ if (VariableColumnPresentation.COLUMN_VARIABLE_NAME.equals(property)) {
if (element instanceof IWatchExpression) {
if (value instanceof String) {
// The value column displays special characters
- // escaped, so encode the string with any special
- // characters escaped properly
+ // escaped, so encode the string with any special
+ // characters escaped properly
String expressionText = DefaultLabelProvider.encodeEsacpedChars((String)value);
IWatchExpression expression = (IWatchExpression) element;
// Bug 345974 see ExpressionManagerContentProvider.AddNewExpressionElement.modify does not allow an empty string
@@ -63,7 +63,7 @@ public class WatchExpressionCellModifier implements ICellModifier {
}
}
}
- }
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/CommonTabLite.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/CommonTabLite.java
index ac5966fd2..6edb7a674 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/CommonTabLite.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/CommonTabLite.java
@@ -241,9 +241,9 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
String currentContainerString = fSharedLocationText.getText();
IContainer currentContainer = getContainer(currentContainerString);
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
- currentContainer,
- false,
- LaunchConfigurationsMessages.CommonTab_Select_a_location_for_the_launch_configuration_13);
+ currentContainer,
+ false,
+ LaunchConfigurationsMessages.CommonTab_Select_a_location_for_the_launch_configuration_13);
dialog.showClosedProjects(false);
dialog.setDialogBoundsSettings(getDialogBoundsSettings(), Dialog.DIALOG_PERSISTSIZE);
dialog.open();
@@ -427,11 +427,11 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
return validateLocalShared();
}
- /**
- * validates the local shared config file location
- * @return true if the local shared file exists, false otherwise
- */
- private boolean validateLocalShared() {
+ /**
+ * validates the local shared config file location
+ * @return true if the local shared file exists, false otherwise
+ */
+ private boolean validateLocalShared() {
if (isShared()) {
String path = fSharedLocationText.getText().trim();
IContainer container = getContainer(path);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java
index 783599a96..f1073c598 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java
@@ -134,12 +134,12 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
}
try {
- String key = el.data.getType().getIdentifier();
- return DebugPluginImages.getImage(key);
- } catch (CoreException e) {
- Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ String key = el.data.getType().getIdentifier();
+ return DebugPluginImages.getImage(key);
+ } catch (CoreException e) {
+ Image errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
return errorImage;
- }
+ }
}
return null;
}
@@ -398,7 +398,7 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
return -1;
}
GroupLaunchElement el = ((GroupLaunchElement) sel
- .getFirstElement());
+ .getFirstElement());
return input.indexOf(el);
}
@@ -444,8 +444,8 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
protected boolean isDownEnabled() {
final int index = getSingleSelectionIndex();
- return (index >= 0) && (index != input.size() - 1);
- }
+ return (index >= 0) && (index != input.size() - 1);
+ }
protected boolean isUpEnabled(){
return getSingleSelectionIndex() > 0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java
index 6cbddd8cd..9ca00b61c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java
@@ -82,50 +82,50 @@ public class DebugTextHover implements ITextHover, ITextHoverExtension, ITextHov
* Replaces reserved HTML characters in the given string with
* their escaped equivalents. This is to ensure that variable
* values containing reserved characters are correctly displayed.
- */
- private static String replaceHTMLChars(String variableText) {
- StringBuilder buffer= new StringBuilder(variableText.length());
- char[] characters = variableText.toCharArray();
- for (int i = 0; i < characters.length; i++) {
- char character= characters[i];
- switch (character) {
- case '<':
- buffer.append("&lt;"); //$NON-NLS-1$
- break;
- case '>':
- buffer.append("&gt;"); //$NON-NLS-1$
- break;
- case '&':
- buffer.append("&amp;"); //$NON-NLS-1$
- break;
- case '"':
- buffer.append("&quot;"); //$NON-NLS-1$
- break;
- default:
- buffer.append(character);
- }
- }
- return buffer.toString();
- }
+ */
+ private static String replaceHTMLChars(String variableText) {
+ StringBuilder buffer= new StringBuilder(variableText.length());
+ char[] characters = variableText.toCharArray();
+ for (int i = 0; i < characters.length; i++) {
+ char character= characters[i];
+ switch (character) {
+ case '<':
+ buffer.append("&lt;"); //$NON-NLS-1$
+ break;
+ case '>':
+ buffer.append("&gt;"); //$NON-NLS-1$
+ break;
+ case '&':
+ buffer.append("&amp;"); //$NON-NLS-1$
+ break;
+ case '"':
+ buffer.append("&quot;"); //$NON-NLS-1$
+ break;
+ default:
+ buffer.append(character);
+ }
+ }
+ return buffer.toString();
+ }
- /**
- * Returns the value of this filters preference (on/off) for the given
- * view.
- *
- * @param part
- * @return boolean
- */
- public static boolean getBooleanPreferenceValue(String id, String preference) {
- String compositeKey = id + "." + preference; //$NON-NLS-1$
+ /**
+ * Returns the value of this filters preference (on/off) for the given
+ * view.
+ *
+ * @param part
+ * @return boolean
+ */
+ public static boolean getBooleanPreferenceValue(String id, String preference) {
+ String compositeKey = id + "." + preference; //$NON-NLS-1$
IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- boolean value = false;
- if (store.contains(compositeKey)) {
- value = store.getBoolean(compositeKey);
- } else {
- value = store.getBoolean(preference);
- }
- return value;
- }
+ boolean value = false;
+ if (store.contains(compositeKey)) {
+ value = store.getBoolean(compositeKey);
+ } else {
+ value = store.getBoolean(preference);
+ }
+ return value;
+ }
@Override
public IInformationControlCreator getHoverControlCreator() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java
index f9ab8ae56..dc4f6f322 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java
@@ -94,16 +94,16 @@ public class ExpressionInformationControlCreator implements IInformationControlC
private IVariable fVariable;
private IPresentationContext fContext;
- private TreeModelViewer fViewer;
- private SashForm fSashForm;
- private Composite fDetailPaneComposite;
- private DetailPaneProxy fDetailPane;
- private Tree fTree;
+ private TreeModelViewer fViewer;
+ private SashForm fSashForm;
+ private Composite fDetailPaneComposite;
+ private DetailPaneProxy fDetailPane;
+ private Tree fTree;
/**
- * Creates the content for the root element of the tree viewer in the hover
- */
- private class TreeRoot extends ElementContentProvider {
+ * Creates the content for the root element of the tree viewer in the hover
+ */
+ private class TreeRoot extends ElementContentProvider {
@Override
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
return 1;
@@ -118,7 +118,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
protected boolean supportsContextId(String id) {
return true;
}
- }
+ }
/**
* Inner class implementing IDetailPaneContainer methods. Handles changes to detail
@@ -219,7 +219,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
@Override
public void dispose() {
persistSettings(getShell());
- fContext.dispose();
+ fContext.dispose();
super.dispose();
}
@@ -253,61 +253,61 @@ public class ExpressionInformationControlCreator implements IInformationControlC
@Override
protected void createContent(Composite parent) {
- fSashForm = new SashForm(parent, parent.getStyle());
- fSashForm.setOrientation(SWT.VERTICAL);
-
- // update presentation context
- AbstractDebugView view = getViewToEmulate();
- fContext = new PresentationContext(IDebugUIConstants.ID_VARIABLE_VIEW);
- if (view != null) {
- // copy over properties
- IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext();
- String[] properties = copy.getProperties();
- for (int i = 0; i < properties.length; i++) {
+ fSashForm = new SashForm(parent, parent.getStyle());
+ fSashForm.setOrientation(SWT.VERTICAL);
+
+ // update presentation context
+ AbstractDebugView view = getViewToEmulate();
+ fContext = new PresentationContext(IDebugUIConstants.ID_VARIABLE_VIEW);
+ if (view != null) {
+ // copy over properties
+ IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext();
+ String[] properties = copy.getProperties();
+ for (int i = 0; i < properties.length; i++) {
String key = properties[i];
fContext.setProperty(key, copy.getProperty(key));
}
- }
-
- fViewer = new TreeModelViewer(fSashForm, SWT.NO_TRIM | SWT.MULTI | SWT.VIRTUAL, fContext);
- fViewer.setAutoExpandLevel(1);
-
- if (view != null) {
- // copy over filters
- StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
- if (structuredViewer != null) {
- ViewerFilter[] filters = structuredViewer.getFilters();
- for (int i = 0; i < filters.length; i++) {
- fViewer.addFilter(filters[i]);
- }
- }
- }
-
- fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
- Layout layout = fDetailPaneComposite.getLayout();
- if (layout instanceof GridLayout) {
+ }
+
+ fViewer = new TreeModelViewer(fSashForm, SWT.NO_TRIM | SWT.MULTI | SWT.VIRTUAL, fContext);
+ fViewer.setAutoExpandLevel(1);
+
+ if (view != null) {
+ // copy over filters
+ StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
+ if (structuredViewer != null) {
+ ViewerFilter[] filters = structuredViewer.getFilters();
+ for (int i = 0; i < filters.length; i++) {
+ fViewer.addFilter(filters[i]);
+ }
+ }
+ }
+
+ fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
+ Layout layout = fDetailPaneComposite.getLayout();
+ if (layout instanceof GridLayout) {
GridLayout gl = (GridLayout) layout;
gl.marginHeight = 0;
gl.marginWidth = 0;
}
- fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
- fDetailPane.display(null); // Bring up the default pane so the user doesn't see an empty composite
+ fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
+ fDetailPane.display(null); // Bring up the default pane so the user doesn't see an empty composite
- fTree = fViewer.getTree();
- fTree.addSelectionListener(new SelectionListener() {
- @Override
+ fTree = fViewer.getTree();
+ fTree.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent e) {
fDetailPane.display(fViewer.getStructuredSelection());
- }
- @Override
+ }
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {}
- });
+ });
- initSashWeights();
+ initSashWeights();
- // add update listener to auto-select and display details of root expression
- fViewer.addViewerUpdateListener(new IViewerUpdateListener() {
+ // add update listener to auto-select and display details of root expression
+ fViewer.addViewerUpdateListener(new IViewerUpdateListener() {
@Override
public void viewerUpdatesComplete() {
}
@@ -328,55 +328,55 @@ public class ExpressionInformationControlCreator implements IInformationControlC
}
});
- setForegroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ setForegroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
/**
- * Attempts to find an appropriate view to emulate, this will either be the
- * variables view or the expressions view.
- * @return a view to emulate or <code>null</code>
- */
- private AbstractDebugView getViewToEmulate() {
+ * Attempts to find an appropriate view to emulate, this will either be the
+ * variables view or the expressions view.
+ * @return a view to emulate or <code>null</code>
+ */
+ private AbstractDebugView getViewToEmulate() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- AbstractDebugView expressionsView = (AbstractDebugView) page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- if (expressionsView != null && expressionsView.isVisible()) {
- return expressionsView;
- }
- AbstractDebugView variablesView = (AbstractDebugView) page.findView(IDebugUIConstants.ID_VARIABLE_VIEW);
- if (variablesView != null && variablesView.isVisible()) {
- return variablesView;
- }
- if (expressionsView != null) {
- return expressionsView;
- }
- return variablesView;
- }
+ AbstractDebugView expressionsView = (AbstractDebugView) page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ if (expressionsView != null && expressionsView.isVisible()) {
+ return expressionsView;
+ }
+ AbstractDebugView variablesView = (AbstractDebugView) page.findView(IDebugUIConstants.ID_VARIABLE_VIEW);
+ if (variablesView != null && variablesView.isVisible()) {
+ return variablesView;
+ }
+ if (expressionsView != null) {
+ return expressionsView;
+ }
+ return variablesView;
+ }
/**
- * Initializes the sash form weights from the preference store (using default values if
- * no sash weights were stored previously).
- */
- protected void initSashWeights(){
- IDialogSettings settings = getDialogSettings(false);
- if (settings != null) {
- int tree = getIntSetting(settings, SASH_WEIGHT_TREE);
- if (tree > 0) {
- int details = getIntSetting(settings, SASH_WEIGHT_DETAILS);
- if (details > 0) {
- fSashForm.setWeights(new int[]{tree, details});
- }
- }
- }
- }
-
- @Override
- public void setForegroundColor(Color foreground) {
- super.setForegroundColor(foreground);
- fDetailPaneComposite.setForeground(foreground);
- fTree.setForeground(foreground);
- }
+ * Initializes the sash form weights from the preference store (using default values if
+ * no sash weights were stored previously).
+ */
+ protected void initSashWeights(){
+ IDialogSettings settings = getDialogSettings(false);
+ if (settings != null) {
+ int tree = getIntSetting(settings, SASH_WEIGHT_TREE);
+ if (tree > 0) {
+ int details = getIntSetting(settings, SASH_WEIGHT_DETAILS);
+ if (details > 0) {
+ fSashForm.setWeights(new int[]{tree, details});
+ }
+ }
+ }
+ }
+
+ @Override
+ public void setForegroundColor(Color foreground) {
+ super.setForegroundColor(foreground);
+ fDetailPaneComposite.setForeground(foreground);
+ fTree.setForeground(foreground);
+ }
@Override
public void setBackgroundColor(Color background) {
@@ -400,7 +400,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
public void setInput(Object input) {
if (input instanceof IVariable) {
fVariable = (IVariable) input;
- fViewer.setInput(new TreeRoot());
+ fViewer.setInput(new TreeRoot());
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
index b259cad20..533a342ee 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
@@ -117,7 +117,7 @@ public class EmbeddedBreakpointsViewer {
//presentation of the embedded viewer matches the current view
Map<String, Object> map = null;
IDebugModelPresentation current = view.getAdapter(IDebugModelPresentation.class);
- if (current instanceof DelegatingModelPresentation) {
+ if (current instanceof DelegatingModelPresentation) {
map = ((DelegatingModelPresentation) current).getAttributes();
}
if(map != null) {
@@ -157,7 +157,7 @@ public class EmbeddedBreakpointsViewer {
list.add(breakpoint);
}
else if (item instanceof IBreakpointContainer) {
- getBreakpointsFromContainers((IBreakpointContainer)item, list);
+ getBreakpointsFromContainers((IBreakpointContainer)item, list);
}
}
for(int i = 0; i < list.size(); i++) {
@@ -171,11 +171,11 @@ public class EmbeddedBreakpointsViewer {
* @param list the list of breakpoints to update state for
*/
private void getBreakpointsFromContainers(IBreakpointContainer container, ArrayList<IBreakpoint> list) {
- IBreakpoint[] bps = container.getBreakpoints();
- list.ensureCapacity(list.size() + bps.length);
- for (int j = 0; j < bps.length; j++) {
- list.add(bps[j]);
- }
+ IBreakpoint[] bps = container.getBreakpoints();
+ list.ensureCapacity(list.size() + bps.length);
+ for (int j = 0; j < bps.length; j++) {
+ list.add(bps[j]);
+ }
}
/**
@@ -206,115 +206,115 @@ public class EmbeddedBreakpointsViewer {
* @param element the element to search for when finding occurrences
* @return a list of widget occurrences to update or an empty list
*/
- private Widget[] searchItems(Object element) {
+ private Widget[] searchItems(Object element) {
ArrayList<TreeItem> list = new ArrayList<>();
- TreeItem[] items = fTree.getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
- }
- return list.toArray(new Widget[0]);
- }
+ TreeItem[] items = fTree.getItems();
+ for (int i = 0; i < items.length; i++) {
+ findAllOccurrences(items[i], element, list);
+ }
+ return list.toArray(new Widget[0]);
+ }
- /**
- * performs the actual search for items in the tree
- * @param list the list to add matches to
- * @param item the item in the tree
- * @param element the element to compare
- */
+ /**
+ * performs the actual search for items in the tree
+ * @param list the list to add matches to
+ * @param item the item in the tree
+ * @param element the element to compare
+ */
private void findAllOccurrences(TreeItem item, Object element, ArrayList<TreeItem> list) {
- if (element.equals(item.getData())) {
- list.add(item);
- }
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
- }
- }
+ if (element.equals(item.getData())) {
+ list.add(item);
+ }
+ TreeItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ findAllOccurrences(items[i], element, list);
+ }
+ }
/**
- * Update the checked state of the given element and all of its children.
- *
- * @param obj the object that has been changed
- * @param enable the checked status of the obj
- */
- private void updateCheckedState(Object obj, boolean enable) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(obj, IBreakpoint.class);
- if (breakpoint != null) {
- Widget[] list = searchItems(obj);
- TreeItem item = null;
- for(int i = 0; i < list.length; i++) {
- item = (TreeItem)list[i];
- item.setChecked(enable);
- refreshParents(item);
- }
- }
- else if (obj instanceof BreakpointContainer) {
+ * Update the checked state of the given element and all of its children.
+ *
+ * @param obj the object that has been changed
+ * @param enable the checked status of the obj
+ */
+ private void updateCheckedState(Object obj, boolean enable) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(obj, IBreakpoint.class);
+ if (breakpoint != null) {
+ Widget[] list = searchItems(obj);
+ TreeItem item = null;
+ for(int i = 0; i < list.length; i++) {
+ item = (TreeItem)list[i];
+ item.setChecked(enable);
+ refreshParents(item);
+ }
+ }
+ else if (obj instanceof BreakpointContainer) {
ArrayList<IBreakpoint> bps = new ArrayList<>();
- getBreakpointsFromContainers((BreakpointContainer)obj, bps);
- for(int j = 0; j < bps.size(); j++) {
- updateCheckedState(bps.get(j), enable);
- }
- }
- }
+ getBreakpointsFromContainers((BreakpointContainer)obj, bps);
+ for(int j = 0; j < bps.size(); j++) {
+ updateCheckedState(bps.get(j), enable);
+ }
+ }
+ }
- /**
- * refreshes the grayed/checked state of the parents of item
- * @param item the item to refresh parents of
- */
- private void refreshParents(TreeItem item) {
- TreeItem parent = item.getParentItem();
- while (parent != null) {
- int checked = getNumberChildrenChecked(parent);
- if(checked == 0) {
- parent.setGrayed(false);
- parent.setChecked(false);
- }
- else if(checked == parent.getItemCount()) {
- if(getNumberChildrenGrayed(parent) > 0) {
- parent.setGrayed(true);
- }
- else {
- parent.setGrayed(false);
- }
- parent.setChecked(true);
- }
- else {
- parent.setGrayed(true);
- parent.setChecked(true);
- }
- parent = parent.getParentItem();
- }
- }
+ /**
+ * refreshes the grayed/checked state of the parents of item
+ * @param item the item to refresh parents of
+ */
+ private void refreshParents(TreeItem item) {
+ TreeItem parent = item.getParentItem();
+ while (parent != null) {
+ int checked = getNumberChildrenChecked(parent);
+ if(checked == 0) {
+ parent.setGrayed(false);
+ parent.setChecked(false);
+ }
+ else if(checked == parent.getItemCount()) {
+ if(getNumberChildrenGrayed(parent) > 0) {
+ parent.setGrayed(true);
+ }
+ else {
+ parent.setGrayed(false);
+ }
+ parent.setChecked(true);
+ }
+ else {
+ parent.setGrayed(true);
+ parent.setChecked(true);
+ }
+ parent = parent.getParentItem();
+ }
+ }
- /**
- * Gets the number of grayed children for this parent
- * @param parent the parent to inspect
- * @return treu is any one or more children is grayed, false otherwise
- */
- private int getNumberChildrenGrayed(TreeItem parent) {
- TreeItem[] children = parent.getItems();
- int count = 0;
- for(int i = 0; i < children.length; i++) {
- if(children[i].getGrayed()) {
- count++;
- }
- }
- return count;
- }
+ /**
+ * Gets the number of grayed children for this parent
+ * @param parent the parent to inspect
+ * @return treu is any one or more children is grayed, false otherwise
+ */
+ private int getNumberChildrenGrayed(TreeItem parent) {
+ TreeItem[] children = parent.getItems();
+ int count = 0;
+ for(int i = 0; i < children.length; i++) {
+ if(children[i].getGrayed()) {
+ count++;
+ }
+ }
+ return count;
+ }
- /**
- * Checks to see if all of the children under an given parent are checked or not
- * @param children the children to check
- * @return true if all children are checked, false otherwise
- */
- private int getNumberChildrenChecked(TreeItem parent) {
- TreeItem[] children = parent.getItems();
- int count = 0;
- for(int i = 0; i < children.length; i++) {
- if(children[i].getChecked()) {
- count++;
- }
- }
- return count;
- }
+ /**
+ * Checks to see if all of the children under an given parent are checked or not
+ * @param children the children to check
+ * @return true if all children are checked, false otherwise
+ */
+ private int getNumberChildrenChecked(TreeItem parent) {
+ TreeItem[] children = parent.getItems();
+ int count = 0;
+ for(int i = 0; i < children.length; i++) {
+ if(children[i].getChecked()) {
+ count++;
+ }
+ }
+ return count;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpoints.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpoints.java
index 98cb4768c..1c31ff369 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpoints.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpoints.java
@@ -96,6 +96,6 @@ public class WizardExportBreakpoints extends Wizard implements IExportWizard {
public void init(IWorkbench workbench, IStructuredSelection selection) {
fSelection = selection;
setWindowTitle(ImportExportMessages.WizardExportBreakpoints_0);
- setNeedsProgressMonitor(true);
+ setNeedsProgressMonitor(true);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpointsPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpointsPage.java
index 2e3123bb8..958de66e4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpointsPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpointsPage.java
@@ -203,17 +203,17 @@ public class WizardExportBreakpointsPage extends WizardPage implements Listener
}
/**
- * Creates the buttons for selecting all or none of the elements.
- *
- * @param parent the parent control
- */
- private void createButtonsGroup(Composite parent) {
- Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 3, 1, GridData.FILL_HORIZONTAL, 0, 0);
- fSelectAll = SWTFactory.createPushButton(composite, ImportExportMessages.WizardBreakpointsPage_1, null);
- fSelectAll.addListener(SWT.Selection, this);
+ * Creates the buttons for selecting all or none of the elements.
+ *
+ * @param parent the parent control
+ */
+ private void createButtonsGroup(Composite parent) {
+ Composite composite = SWTFactory.createComposite(parent, parent.getFont(), 3, 1, GridData.FILL_HORIZONTAL, 0, 0);
+ fSelectAll = SWTFactory.createPushButton(composite, ImportExportMessages.WizardBreakpointsPage_1, null);
+ fSelectAll.addListener(SWT.Selection, this);
fDeselectAll = SWTFactory.createPushButton(composite, ImportExportMessages.WizardBreakpointsPage_2, null);
fDeselectAll.addListener(SWT.Selection, this);
- }
+ }
/**
* This method is used to determine if the page can be "finished".
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpoints.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpoints.java
index b357a6d1a..a13af565b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpoints.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpoints.java
@@ -99,7 +99,7 @@ public class WizardImportBreakpoints extends Wizard implements IImportWizard {
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
setWindowTitle(ImportExportMessages.WizardImportBreakpoints_0);
- setNeedsProgressMonitor(true);
+ setNeedsProgressMonitor(true);
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java
index 291ffe62c..e5cd4bfcf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java
@@ -144,11 +144,11 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
@Override
public void createControl(Composite parent) {
Composite comp = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_BOTH);
- //add the check table
+ //add the check table
createViewer(comp);
- //add the file path and browse button
+ //add the file path and browse button
createFilePath(comp);
- //add the overwrite option
+ //add the overwrite option
fOverwrite = SWTFactory.createCheckButton(comp, WizardMessages.ExportLaunchConfigurationsWizardPage_1, null, getDialogSettings().getBoolean(OVERWRITE), 2);
setControl(comp);
PlatformUI .getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.EXPORT_LAUNCH_CONFIGURATIONS_PAGE);
@@ -475,6 +475,6 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
while ((i = is.read(buf)) != -1) {
os.write(buf, 0, i);
}
- }
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
index 403c34c27..67bad5c5f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java
@@ -263,16 +263,16 @@ public class ImportLaunchConfigurationsWizardPage extends WizardResourceImportPa
protected void createSourceGroup(Composite parent) {}
/**
- * Create the group for creating the root directory
- */
- protected void createRootDirectoryGroup(Composite parent) {
- Composite comp = SWTFactory.createComposite(parent, parent.getFont(), 3, 1, GridData.FILL_HORIZONTAL, 0, 0);
- SWTFactory.createLabel(comp, WizardMessages.ImportLaunchConfigurationsWizardPage_6, 1);
- // source name entry field
- fFromDirectory = SWTFactory.createText(comp, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY, 1, GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- // source browse button
- Button browse = SWTFactory.createPushButton(comp, WizardMessages.ImportLaunchConfigurationsWizardPage_7, null);
- browse.addSelectionListener(new SelectionAdapter () {
+ * Create the group for creating the root directory
+ */
+ protected void createRootDirectoryGroup(Composite parent) {
+ Composite comp = SWTFactory.createComposite(parent, parent.getFont(), 3, 1, GridData.FILL_HORIZONTAL, 0, 0);
+ SWTFactory.createLabel(comp, WizardMessages.ImportLaunchConfigurationsWizardPage_6, 1);
+ // source name entry field
+ fFromDirectory = SWTFactory.createText(comp, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY, 1, GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ // source browse button
+ Button browse = SWTFactory.createPushButton(comp, WizardMessages.ImportLaunchConfigurationsWizardPage_7, null);
+ browse.addSelectionListener(new SelectionAdapter () {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dd = new DirectoryDialog(getContainer().getShell(), SWT.SHEET);
@@ -287,14 +287,14 @@ public class ImportLaunchConfigurationsWizardPage extends WizardResourceImportPa
}
}
}
- });
- }
+ });
+ }
- /**
- * Resets the selection of the tree root element for the viewer
- * @param path the path from the text widget
- */
- protected void resetSelection(final IPath path) {
+ /**
+ * Resets the selection of the tree root element for the viewer
+ * @param path the path from the text widget
+ */
+ protected void resetSelection(final IPath path) {
BusyIndicator.showWhile(getShell().getDisplay(), () -> {
File file = new File(path.toOSString());
DebugFileSystemElement dummyparent = new DebugFileSystemElement(IInternalDebugCoreConstants.EMPTY_STRING,
@@ -306,47 +306,47 @@ public class ImportLaunchConfigurationsWizardPage extends WizardResourceImportPa
element.getFiles();
selectionGroup.setRoot(dummyparent);
});
- }
+ }
@Override
protected ITreeContentProvider getFileProvider() {
return new WorkbenchContentProvider() {
- @Override
+ @Override
public Object[] getChildren(Object o) {
- if (o instanceof DebugFileSystemElement) {
- DebugFileSystemElement element = (DebugFileSystemElement) o;
- return element.getFiles().getChildren(element);
- }
- return new Object[0];
- }
- };
+ if (o instanceof DebugFileSystemElement) {
+ DebugFileSystemElement element = (DebugFileSystemElement) o;
+ return element.getFiles().getChildren(element);
+ }
+ return new Object[0];
+ }
+ };
}
@Override
protected ITreeContentProvider getFolderProvider() {
return new WorkbenchContentProvider() {
- @Override
+ @Override
public Object[] getChildren(Object o) {
- if (o instanceof DebugFileSystemElement) {
- DebugFileSystemElement element = (DebugFileSystemElement) o;
- return element.getFolders().getChildren();
- }
- return new Object[0];
- }
+ if (o instanceof DebugFileSystemElement) {
+ DebugFileSystemElement element = (DebugFileSystemElement) o;
+ return element.getFolders().getChildren();
+ }
+ return new Object[0];
+ }
- @Override
+ @Override
public boolean hasChildren(Object o) {
- if (o instanceof DebugFileSystemElement) {
- DebugFileSystemElement element = (DebugFileSystemElement) o;
- if (element.isPopulated()) {
+ if (o instanceof DebugFileSystemElement) {
+ DebugFileSystemElement element = (DebugFileSystemElement) o;
+ if (element.isPopulated()) {
return getChildren(element).length > 0;
}
- //If we have not populated then wait until asked
- return true;
- }
- return false;
- }
- };
+ //If we have not populated then wait until asked
+ return true;
+ }
+ return false;
+ }
+ };
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CompileErrorProjectPromptStatusHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CompileErrorProjectPromptStatusHandler.java
index 818e965ca..5f2d1a69b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CompileErrorProjectPromptStatusHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CompileErrorProjectPromptStatusHandler.java
@@ -90,15 +90,15 @@ public class CompileErrorProjectPromptStatusHandler implements IStatusHandler {
0,
LaunchConfigurationsMessages.CompileErrorProjectPromptStatusHandler_1,
false);
- int open = dialog.open();
+ int open = dialog.open();
if (open == IDialogConstants.PROCEED_ID) {
- if(dialog.getToggleState()) {
- store.setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, MessageDialogWithToggle.ALWAYS);
- }
- return Boolean.TRUE;
- }
- else {
- return Boolean.FALSE;
- }
+ if(dialog.getToggleState()) {
+ store.setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, MessageDialogWithToggle.ALWAYS);
+ }
+ return Boolean.TRUE;
+ }
+ else {
+ return Boolean.FALSE;
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DebugModePromptStatusHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DebugModePromptStatusHandler.java
index 0658aabf2..5794c6751 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DebugModePromptStatusHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DebugModePromptStatusHandler.java
@@ -39,16 +39,16 @@ public class DebugModePromptStatusHandler implements IStatusHandler {
}
IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- ILaunchConfiguration configuration = (ILaunchConfiguration)source;
- String pref = store.getString(IInternalDebugUIConstants.PREF_RELAUNCH_IN_DEBUG_MODE);
- if (pref != null) {
- if (pref.equals(MessageDialogWithToggle.NEVER)) {
- return Boolean.FALSE;
- } else if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
- relaunchInDebugMode(configuration);
- return Boolean.TRUE;
- }
- }
+ ILaunchConfiguration configuration = (ILaunchConfiguration)source;
+ String pref = store.getString(IInternalDebugUIConstants.PREF_RELAUNCH_IN_DEBUG_MODE);
+ if (pref != null) {
+ if (pref.equals(MessageDialogWithToggle.NEVER)) {
+ return Boolean.FALSE;
+ } else if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
+ relaunchInDebugMode(configuration);
+ return Boolean.TRUE;
+ }
+ }
Shell activeShell = DebugUIPlugin.getShell();
String title = LaunchConfigurationsMessages.DebugModePromptStatusHandler_0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java
index 3a2b105e7..5779bf0b8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java
@@ -248,17 +248,17 @@ public class FavoritesDialog extends TrayDialog {
/**
* Returns a label to use for launch mode with accelerators removed.
*
- * @return label to use for launch mode with accelerators removed
- */
- private String getModeLabel() {
- return DebugUIPlugin.removeAccelerators(fHistory.getLaunchGroup().getLabel());
- }
-
- /**
- * Creates the main area of the dialog
- * @param parent the parent to add this content to
- */
- protected void createFavoritesArea(Composite parent) {
+ * @return label to use for launch mode with accelerators removed
+ */
+ private String getModeLabel() {
+ return DebugUIPlugin.removeAccelerators(fHistory.getLaunchGroup().getLabel());
+ }
+
+ /**
+ * Creates the main area of the dialog
+ * @param parent the parent to add this content to
+ */
+ protected void createFavoritesArea(Composite parent) {
Composite topComp = SWTFactory.createComposite(parent, parent.getFont(), 2, 1, GridData.FILL_BOTH, 0, 0);
SWTFactory.createLabel(topComp, LaunchConfigurationsMessages.FavoritesDialog_2, 2);
fFavoritesTable = createTable(topComp, new FavoritesContentProvider());
@@ -451,15 +451,15 @@ public class FavoritesDialog extends TrayDialog {
super.okPressed();
}
- @Override
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
- if (section == null) {
- section = settings.addNewSection(getDialogSettingsSectionName());
- }
- return section;
- }
+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
+ if (section == null) {
+ section = settings.addNewSection(getDialogSettingsSectionName());
+ }
+ return section;
+ }
/**
* Returns the name of the section that this dialog stores its settings in
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index fe801b623..ddb52e0f9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -325,16 +325,16 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
* @param newLaunch the newly added launch to leave in the view
*/
protected void removeTerminatedLaunches(ILaunch newLaunch) {
- if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES)) {
- ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
- Object[] launches= lManager.getLaunches();
- for (int i= 0; i < launches.length; i++) {
- ILaunch launch= (ILaunch)launches[i];
- if (launch != newLaunch && launch.isTerminated()) {
- lManager.removeLaunch(launch);
- }
- }
- }
+ if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES)) {
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ Object[] launches= lManager.getLaunches();
+ for (int i= 0; i < launches.length; i++) {
+ ILaunch launch= (ILaunch)launches[i];
+ if (launch != newLaunch && launch.isTerminated()) {
+ lManager.removeLaunch(launch);
+ }
+ }
+ }
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java
index baae46074..71352717f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java
@@ -107,9 +107,9 @@ public class LaunchConfigurationPropertiesDialog extends LaunchConfigurationsDia
@Override
public boolean close() {
- if (!isSafeToClose()) {
- return false;
- }
+ if (!isSafeToClose()) {
+ return false;
+ }
DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this);
return super.close();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
index f947492a9..75201c55d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
@@ -172,13 +172,13 @@ public class LaunchConfigurationTabGroupViewer {
* A link to allow users to select a valid set of launch options for the specified mode
* @since 3.3
*/
- private Link fOptionsLink = null;
+ private Link fOptionsLink = null;
- /**
- * A label to indicate that the user needs to select an a launcher.
- * @since 3.5
- */
- private Label fOptionsErrorLabel = null;
+ /**
+ * A label to indicate that the user needs to select an a launcher.
+ * @since 3.5
+ */
+ private Label fOptionsErrorLabel = null;
/**
* A new composite replacing the perspectives tab
@@ -232,17 +232,17 @@ public class LaunchConfigurationTabGroupViewer {
*/
private void createControl(Composite parent) {
fViewerControl = parent;
- fViewform = new ViewForm(parent, SWT.FLAT | SWT.BORDER);
- GridLayout layout = new GridLayout(1, false);
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- fViewform.setLayout(layout);
+ fViewform = new ViewForm(parent, SWT.FLAT | SWT.BORDER);
+ GridLayout layout = new GridLayout(1, false);
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ fViewform.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
fViewform.setLayoutData(gd);
- fViewform.setTopLeft(null);
+ fViewform.setTopLeft(null);
- Composite mainComp = SWTFactory.createComposite(fViewform, fViewform.getFont(), 1, 1, 1, 0, 0);
- fViewform.setContent(mainComp);
+ Composite mainComp = SWTFactory.createComposite(fViewform, fViewform.getFont(), 1, 1, 1, 0, 0);
+ fViewform.setContent(mainComp);
fTabPlaceHolder = SWTFactory.createComposite(mainComp, 1, 1, GridData.FILL_BOTH);
fTabPlaceHolder.setLayout(new StackLayout());
@@ -254,13 +254,13 @@ public class LaunchConfigurationTabGroupViewer {
SWTFactory.createLabel(fGroupComposite, LaunchConfigurationsMessages.LaunchConfigurationDialog__Name__16, 1);
fNameWidget = new Text(fGroupComposite, SWT.SINGLE | SWT.BORDER);
- fNameWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fNameWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fNameWidget.addModifyListener(e -> {
if (!fInitializingTabs) {
handleNameModified();
}
}
- );
+ );
createTabFolder(fGroupComposite);
@@ -269,8 +269,8 @@ public class LaunchConfigurationTabGroupViewer {
//a link for launch options
fOptionsErrorLabel = new Label(linkComp, SWT.NONE);
- gd = new GridData();
- fOptionsErrorLabel.setLayoutData(gd);
+ gd = new GridData();
+ fOptionsErrorLabel.setLayoutData(gd);
fOptionsLink = new Link(linkComp, SWT.WRAP);
fOptionsLink.setFont(linkComp.getFont());
@@ -347,7 +347,7 @@ public class LaunchConfigurationTabGroupViewer {
}
}
});
- Dialog.applyDialogFont(parent);
+ Dialog.applyDialogFont(parent);
}
/**
@@ -521,7 +521,7 @@ public class LaunchConfigurationTabGroupViewer {
boolean newwc = !getWorkingCopy().isDirty();
ILaunchConfigurationTab tab = getActiveTab();
if (tab != null) {
- tab.performApply(getWorkingCopy());
+ tab.performApply(getWorkingCopy());
}
if((fOriginal instanceof ILaunchConfigurationWorkingCopy) && newwc) {
try {
@@ -583,9 +583,9 @@ public class LaunchConfigurationTabGroupViewer {
}
fOptionsLink.setVisible(!canLaunchWithModes() || hasMultipleDelegates());
if (hasDuplicateDelegates()) {
- fOptionsErrorLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
+ fOptionsErrorLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
} else {
- fOptionsErrorLabel.setImage(null);
+ fOptionsErrorLabel.setImage(null);
}
fViewform.layout(true, true);
}
@@ -820,12 +820,12 @@ public class LaunchConfigurationTabGroupViewer {
fShowCommandLineButton.setVisible(visible);
}
}
- /**
- * sets the current widget focus to the 'Name' widget
- */
- protected void setFocusOnName() {
- fNameWidget.setFocus();
- }
+ /**
+ * sets the current widget focus to the 'Name' widget
+ */
+ protected void setFocusOnName() {
+ fNameWidget.setFocus();
+ }
/**
* Displays tabs for the current working copy
@@ -929,7 +929,7 @@ public class LaunchConfigurationTabGroupViewer {
}
//set the default tab as the first one
if (tabs.length > 0) {
- setActiveTab(tabs[0]);
+ setActiveTab(tabs[0]);
}
// select same tab as before, if possible
for (int i = 0; i < tabs.length; i++) {
@@ -1142,7 +1142,7 @@ public class LaunchConfigurationTabGroupViewer {
* Returns the working copy used to edit the original, possibly
* <code>null</code>.
* @return the backing {@link ILaunchConfigurationWorkingCopy}
- */
+ */
protected ILaunchConfigurationWorkingCopy getWorkingCopy() {
return fWorkingCopy;
}
@@ -1292,7 +1292,7 @@ public class LaunchConfigurationTabGroupViewer {
}
if(hasDuplicateDelegates()) {
- return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_18;
+ return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_18;
}
String message = null;
@@ -1429,8 +1429,8 @@ public class LaunchConfigurationTabGroupViewer {
*/
private void disposeExistingTabs() {
fDisposingTabs = true;
- fTabFolder.dispose();
- fTabFolder = null;
+ fTabFolder.dispose();
+ fTabFolder = null;
createTabFolder(fGroupComposite);
disposeTabGroup();
fDisposingTabs = false;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java
index f4d8d8098..24bef0588 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java
@@ -161,9 +161,9 @@ public class LaunchConfigurationTabGroupWrapper implements ILaunchConfigurationT
TabCollector collector = new TabCollector(Arrays.asList(fGroup.getTabs()), Arrays.asList(ext));
while(collector.hasNext()) {
ILaunchConfigurationTab next = collector.next();
- if (next != null) {
- fTabs.add(next);
- }
+ if (next != null) {
+ fTabs.add(next);
+ }
}
}
else {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
index 70f3161cc..39537b252 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
@@ -310,13 +310,13 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
}
}
- /**
- * The given launch configuration has been added. Add it to the tree.
- * @param configuration the added configuration
- */
- private void handleConfigurationAdded(ILaunchConfiguration configuration, ILaunchConfiguration from) {
- TreeViewer viewer = getTreeViewer();
- if (viewer != null) {
+ /**
+ * The given launch configuration has been added. Add it to the tree.
+ * @param configuration the added configuration
+ */
+ private void handleConfigurationAdded(ILaunchConfiguration configuration, ILaunchConfiguration from) {
+ TreeViewer viewer = getTreeViewer();
+ if (viewer != null) {
try {
viewer.getControl().setRedraw(false);
if (configuration.getPrototype() != null) {
@@ -324,49 +324,49 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
} else {
viewer.add(configuration.getType(), configuration);
}
- // if moved, remove original now
- if (from != null) {
- viewer.remove(from);
- }
- if (isAutoSelect()) {
- viewer.setSelection(new StructuredSelection(configuration), true);
- }
- updateFilterLabel();
+ // if moved, remove original now
+ if (from != null) {
+ viewer.remove(from);
+ }
+ if (isAutoSelect()) {
+ viewer.setSelection(new StructuredSelection(configuration), true);
+ }
+ updateFilterLabel();
}
catch (CoreException e) {}
finally {
viewer.getControl().setRedraw(true);
}
- }
- }
-
- /**
- * Returns if the specified configuration is supported by this instance of the view.
- * Supported means that:
- * <ul>
- * <li>The configuration is not private</li>
- * <li>AND that the configurations' type supports the mode of the current launch group</li>
- * <li>AND that the category of the configurations' type matches that of the current launch group</li>
- * </ul>
- * @param configuration the configuration
- * @return true if the configuration is supported by this instance of the view, false otherwise
- *
- * @since 3.4
- */
- protected boolean isSupportedConfiguration(ILaunchConfiguration configuration) {
- try {
- ILaunchConfigurationType type = configuration.getType();
- return !configuration.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false) &&
- type.supportsMode(getLaunchGroup().getMode()) &&
- equalCategories(type.getCategory(), getLaunchGroup().getCategory());
- }
- catch(CoreException ce) {
- DebugUIPlugin.log(ce);
- }
- return false;
- }
-
- /**
+ }
+ }
+
+ /**
+ * Returns if the specified configuration is supported by this instance of the view.
+ * Supported means that:
+ * <ul>
+ * <li>The configuration is not private</li>
+ * <li>AND that the configurations' type supports the mode of the current launch group</li>
+ * <li>AND that the category of the configurations' type matches that of the current launch group</li>
+ * </ul>
+ * @param configuration the configuration
+ * @return true if the configuration is supported by this instance of the view, false otherwise
+ *
+ * @since 3.4
+ */
+ protected boolean isSupportedConfiguration(ILaunchConfiguration configuration) {
+ try {
+ ILaunchConfigurationType type = configuration.getType();
+ return !configuration.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false) &&
+ type.supportsMode(getLaunchGroup().getMode()) &&
+ equalCategories(type.getCategory(), getLaunchGroup().getCategory());
+ }
+ catch(CoreException ce) {
+ DebugUIPlugin.log(ce);
+ }
+ return false;
+ }
+
+ /**
* Returns whether the given categories are equal.
*
* @param c1 category identifier or <code>null</code>
@@ -409,14 +409,14 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
/**
* The given launch configuration has been removed. Remove it from the tree.
- * @param configuration the deleted configuration
- */
- private void handleConfigurationRemoved(ILaunchConfiguration configuration) {
- getTreeViewer().remove(configuration);
+ * @param configuration the deleted configuration
+ */
+ private void handleConfigurationRemoved(ILaunchConfiguration configuration) {
+ getTreeViewer().remove(configuration);
updateFilterLabel();
- }
+ }
- /**
+ /**
* This is similar to IWorkbenchPart#createPartControl(Composite), but it is
* called by the launch dialog when creating the launch config tree view.
* Since this view is not contained in the workbench, we cannot do all the
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
index a4a49817d..308b17848 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
@@ -346,11 +346,11 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
@Override
public boolean close() {
- if (!isSafeToClose()) {
- return false;
- }
- persistSashWeights();
- persistExpansion();
+ if (!isSafeToClose()) {
+ return false;
+ }
+ persistSashWeights();
+ persistExpansion();
setCurrentlyVisibleLaunchConfigurationDialog(null);
fTabViewer.dispose();
if (fLaunchConfigurationView != null) {
@@ -394,9 +394,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite.setFont(font);
// create help control if needed
- if (isHelpAvailable()) {
- createHelpControl(composite);
- }
+ if (isHelpAvailable()) {
+ createHelpControl(composite);
+ }
Composite monitorComposite = new Composite(composite, SWT.NULL);
layout = new GridLayout();
layout.marginHeight = 0;
@@ -447,7 +447,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
@Override
protected void createButtonsForButtonBar(Composite parent) {
Button button = createButton(parent, ID_LAUNCH_BUTTON, getLaunchButtonText(), true);
- button.setEnabled(false);
+ button.setEnabled(false);
Listener[] listeners = button.getListeners(SWT.Selection);
for (Listener listener : listeners) {
button.removeListener(SWT.Selection, listener);
@@ -528,26 +528,26 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @return the composite used for launch configuration selection area
*/
protected Control createLaunchConfigurationSelectionArea(Composite parent) {
- Composite comp = new Composite(parent, SWT.FLAT);
- GridLayout gridLayout = new GridLayout(1, false);
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- comp.setLayout(gridLayout);
- comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- ViewForm viewForm = new ViewForm(comp, SWT.FLAT | SWT.BORDER);
- ToolBarManager toolBarManager= new ToolBarManager(SWT.FLAT);
- ToolBar toolBar = toolBarManager.createControl(viewForm);
- toolBar.setBackground(parent.getBackground());
- viewForm.setTopLeft(toolBar);
- viewForm.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite viewFormContents = new Composite(viewForm, SWT.FLAT);
- gridLayout = new GridLayout();
- gridLayout.marginHeight = 5;
- gridLayout.marginWidth = 5;
- viewFormContents.setLayout(gridLayout);
- viewFormContents.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ Composite comp = new Composite(parent, SWT.FLAT);
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ comp.setLayout(gridLayout);
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ ViewForm viewForm = new ViewForm(comp, SWT.FLAT | SWT.BORDER);
+ ToolBarManager toolBarManager= new ToolBarManager(SWT.FLAT);
+ ToolBar toolBar = toolBarManager.createControl(viewForm);
+ toolBar.setBackground(parent.getBackground());
+ viewForm.setTopLeft(toolBar);
+ viewForm.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Composite viewFormContents = new Composite(viewForm, SWT.FLAT);
+ gridLayout = new GridLayout();
+ gridLayout.marginHeight = 5;
+ gridLayout.marginWidth = 5;
+ viewFormContents.setLayout(gridLayout);
+ viewFormContents.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
fLaunchConfigurationView = new LaunchConfigurationView(getLaunchGroup(), createViewerFilters());
fLaunchConfigurationView.createLaunchDialogControl(viewFormContents);
Text filterText = fLaunchConfigurationView.getFilteringTextControl();
@@ -588,7 +588,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
Control control = viewer.getControl();
GridData gd = new GridData(GridData.FILL_BOTH);
control.setLayoutData(gd);
- viewForm.setContent(viewFormContents);
+ viewForm.setContent(viewFormContents);
AbstractLaunchConfigurationAction.IConfirmationRequestor requestor = new AbstractLaunchConfigurationAction.IConfirmationRequestor() {
@Override
public boolean getConfirmation() {
@@ -737,15 +737,15 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*
* @since 3.2
*/
- @Override
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
- return getDialogSettings();
- }
+ return getDialogSettings();
+ }
- @Override
+ @Override
protected int getDialogBoundsStrategy() {
- return DIALOG_PERSISTSIZE;
- }
+ return DIALOG_PERSISTSIZE;
+ }
/**
* Returns the dialog settings for this dialog. Subclasses should override
@@ -784,12 +784,12 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return DebugUIPlugin.getStandardDisplay();
}
- /**
- * Gets the duplicate menu action
- *
- * @return the duplicate menu action
- */
- protected AbstractLaunchConfigurationAction getDuplicateAction() {
+ /**
+ * Gets the duplicate menu action
+ *
+ * @return the duplicate menu action
+ */
+ protected AbstractLaunchConfigurationAction getDuplicateAction() {
return (AbstractLaunchConfigurationAction)fLaunchConfigurationView.getAction(DuplicateLaunchConfigurationAction.ID_DUPLICATE_ACTION);
}
@@ -811,7 +811,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG;
}
- /**
+ /**
* Returns the status the dialog was opened on or <code>null</code> if none.
*
* @return IStatus
@@ -820,7 +820,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return fInitialStatus;
}
- /**
+ /**
* Return the last launched configuration in the workspace.
*
* @return the last launched configuration
@@ -829,7 +829,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLastLaunch(getLaunchGroup().getIdentifier());
}
- /**
+ /**
* Returns the appropriate text for the launch button - run or debug.
*
* @return the launch button text
@@ -838,7 +838,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return DebugPlugin.getDefault().getLaunchManager().getLaunchMode(getMode()).getLabel();
}
- /**
+ /**
* Returns the launch group being displayed.
*
* @return launch group
@@ -847,10 +847,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return fGroup;
}
- @Override
+ @Override
public String getMode() {
- return getLaunchGroup().getMode();
- }
+ return getLaunchGroup().getMode();
+ }
/**
* Gets the new menu action
@@ -944,24 +944,24 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
/**
- * Returns the current tab group
- *
- * @return the current tab group, or <code>null</code> if none
- */
- public ILaunchConfigurationTabGroup getTabGroup() {
- if (fTabViewer != null) {
- return fTabViewer.getTabGroup();
- }
- return null;
- }
+ * Returns the current tab group
+ *
+ * @return the current tab group, or <code>null</code> if none
+ */
+ public ILaunchConfigurationTabGroup getTabGroup() {
+ if (fTabViewer != null) {
+ return fTabViewer.getTabGroup();
+ }
+ return null;
+ }
- @Override
+ @Override
public ILaunchConfigurationTab[] getTabs() {
- if (getTabGroup() == null) {
- return null;
- }
- return getTabGroup().getTabs();
- }
+ if (getTabGroup() == null) {
+ return null;
+ }
+ return getTabGroup().getTabs();
+ }
/**
* Returns the viewer used to display the tabs for a launch configuration.
@@ -1001,43 +1001,43 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*
* @param event selection changed event
*/
- protected void handleLaunchConfigurationSelectionChanged(SelectionChangedEvent event) {
- Object input = fTabViewer.getInput();
- Object newInput = null;
+ protected void handleLaunchConfigurationSelectionChanged(SelectionChangedEvent event) {
+ Object input = fTabViewer.getInput();
+ Object newInput = null;
IStructuredSelection selection = event.getStructuredSelection();
- if (selection.size() == 1) {
+ if (selection.size() == 1) {
newInput = selection.getFirstElement();
- }
- if (!isEqual(input, newInput)) {
- ILaunchConfiguration original = fTabViewer.getOriginal();
- if (original != null && newInput == null && getLaunchManager().getMovedTo(original) != null) {
- return;
- }
- boolean deleted = false;
- if (original != null) {
- deleted = !original.exists();
- }
+ }
+ if (!isEqual(input, newInput)) {
+ ILaunchConfiguration original = fTabViewer.getOriginal();
+ if (original != null && newInput == null && getLaunchManager().getMovedTo(original) != null) {
+ return;
+ }
+ boolean deleted = false;
+ if (original != null) {
+ deleted = !original.exists();
+ }
boolean renamed = false;
if (newInput instanceof ILaunchConfiguration) {
renamed = getLaunchManager().getMovedFrom((ILaunchConfiguration)newInput) != null;
}
try {
fSettingInput = true;
- if (fTabViewer.canSave() && fTabViewer.isDirty() && !deleted && !renamed) {
- if(fLaunchConfigurationView != null) {
- fLaunchConfigurationView.setAutoSelect(false);
- }
- int ret = showUnsavedChangesDialog();
- if(ret == IDialogConstants.YES_ID) {
- fTabViewer.handleApplyPressed();
+ if (fTabViewer.canSave() && fTabViewer.isDirty() && !deleted && !renamed) {
+ if(fLaunchConfigurationView != null) {
+ fLaunchConfigurationView.setAutoSelect(false);
+ }
+ int ret = showUnsavedChangesDialog();
+ if(ret == IDialogConstants.YES_ID) {
+ fTabViewer.handleApplyPressed();
ILaunchConfigurationTab[] tabs = getTabs();
if (tabs != null) {
for (ILaunchConfigurationTab tab : tabs) {
tab.postApply();
}
}
- fTabViewer.setInput(newInput);
- }
+ fTabViewer.setInput(newInput);
+ }
else if(ret == IDialogConstants.NO_ID) {
fTabViewer.handleRevertPressed();
fTabViewer.setInput(newInput);
@@ -1045,24 +1045,24 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
else {
fLaunchConfigurationView.getViewer().setSelection(new StructuredSelection(input));
}
- fLaunchConfigurationView.setAutoSelect(true);
- }
- else {
- fTabViewer.setInput(newInput);
- if(fTabViewer.isDirty()) {
- fTabViewer.handleApplyPressed();
- }
- }
+ fLaunchConfigurationView.setAutoSelect(true);
+ }
+ else {
+ fTabViewer.setInput(newInput);
+ if(fTabViewer.isDirty()) {
+ fTabViewer.handleApplyPressed();
+ }
+ }
} finally {
fSettingInput = false;
updateButtons();
updateMessage();
}
- if(getShell() != null && getShell().isVisible()) {
- resize();
- }
- }
- }
+ if(getShell() != null && getShell().isVisible()) {
+ resize();
+ }
+ }
+ }
/**
* Notification the 'launch' button has been pressed. Save and launch.
@@ -1201,14 +1201,14 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @return true if they are equal, false if object 1 is null, the result of o1.equals(o2) otherwise
*/
protected boolean isEqual(Object o1, Object o2) {
- if (o1 == o2) {
- return true;
- } else if (o1 == null) {
- return false;
- } else {
- return o1.equals(o2);
- }
- }
+ if (o1 == o2) {
+ return true;
+ } else if (o1 == null) {
+ return false;
+ } else {
+ return o1.equals(o2);
+ }
+ }
/**
* Returns whether the dialog can be closed
@@ -1216,7 +1216,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @return whether the dialog can be closed
*/
protected boolean isSafeToClose() {
- return fActiveRunningOperations == 0;
+ return fActiveRunningOperations == 0;
}
/**
@@ -1349,17 +1349,17 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* resize the dialog to show all relevant content
*/
protected void resize() {
- if(getTabGroup() != null) {
+ if(getTabGroup() != null) {
Point shell = getShell().getSize();
- int maxx = (int)(getDisplay().getBounds().width * MAX_DIALOG_WIDTH_PERCENT),
+ int maxx = (int)(getDisplay().getBounds().width * MAX_DIALOG_WIDTH_PERCENT),
maxy = (int) (getDisplay().getBounds().height * MAX_DIALOG_HEIGHT_PERCENT);
- maxx = (maxx < DEFAULT_INITIAL_DIALOG_SIZE.x ? DEFAULT_INITIAL_DIALOG_SIZE.x : maxx);
- maxy = (maxy < DEFAULT_INITIAL_DIALOG_SIZE.y ? DEFAULT_INITIAL_DIALOG_SIZE.y : maxy);
- Point psize = getShell().computeSize(SWT.DEFAULT, maxy);
- if((psize.x > maxx ? maxx : psize.x) > shell.x || (psize.y > maxy ? maxy : psize.y) > shell.y) {
+ maxx = (maxx < DEFAULT_INITIAL_DIALOG_SIZE.x ? DEFAULT_INITIAL_DIALOG_SIZE.x : maxx);
+ maxy = (maxy < DEFAULT_INITIAL_DIALOG_SIZE.y ? DEFAULT_INITIAL_DIALOG_SIZE.y : maxy);
+ Point psize = getShell().computeSize(SWT.DEFAULT, maxy);
+ if((psize.x > maxx ? maxx : psize.x) > shell.x || (psize.y > maxy ? maxy : psize.y) > shell.y) {
setShellSize(Math.min(psize.x, maxx), Math.min(psize.y, maxy));
constrainShellSize();
- }
+ }
}
}
@@ -1512,9 +1512,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
/**
- * Increase the size of this dialog's <code>Shell</code> by the specified amounts.
- * Do not increase the size of the Shell beyond the bounds of the Display.
- */
+ * Increase the size of this dialog's <code>Shell</code> by the specified amounts.
+ * Do not increase the size of the Shell beyond the bounds of the Display.
+ */
protected void setShellSize(int width, int height) {
Rectangle bounds = getShell().getMonitor().getBounds();
getShell().setSize(Math.min(width, bounds.width), Math.min(height, bounds.height));
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
index adbb16e75..e8b188773 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java
@@ -68,29 +68,29 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
* Command handler for launch shortcut key binding.
*/
private class LaunchCommandHandler extends AbstractHandler {
- // the shortcut to invoke
- private LaunchShortcutExtension fShortcut;
- private String fMode;
-
- /**
- * Constructs a new command handler for the given shortcut
- *
- * @param shortcut
- */
- public LaunchCommandHandler(LaunchShortcutExtension shortcut, String mode) {
- fShortcut = shortcut;
- fMode = mode;
- }
+ // the shortcut to invoke
+ private LaunchShortcutExtension fShortcut;
+ private String fMode;
+
+ /**
+ * Constructs a new command handler for the given shortcut
+ *
+ * @param shortcut
+ */
+ public LaunchCommandHandler(LaunchShortcutExtension shortcut, String mode) {
+ fShortcut = shortcut;
+ fMode = mode;
+ }
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- LaunchShortcutAction action = new LaunchShortcutAction(fMode, fShortcut);
- if (action.isEnabled()) {
- action.run();
- } else {
- fShortcut.launch(new StructuredSelection(), fMode);
- }
- return null;
+ LaunchShortcutAction action = new LaunchShortcutAction(fMode, fShortcut);
+ if (action.isEnabled()) {
+ action.run();
+ } else {
+ fShortcut.launch(new StructuredSelection(), fMode);
+ }
+ return null;
}
}
@@ -116,16 +116,16 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
/**
* Registers command handlers for launch shortcut key bindings
*/
- private void registerLaunchCommandHandlers() {
- IHandlerService handlerService = PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
- if(handlerService != null) {
+ private void registerLaunchCommandHandlers() {
+ IHandlerService handlerService = PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
+ if(handlerService != null) {
for (String mode : getModes()) {
- String id = getId() + "." + mode; //$NON-NLS-1$
- IHandler handler = new LaunchCommandHandler(this, mode);
- handlerService.activateHandler(id, handler);
- }
- }
- }
+ String id = getId() + "." + mode; //$NON-NLS-1$
+ IHandler handler = new LaunchCommandHandler(this, mode);
+ handlerService.activateHandler(id, handler);
+ }
+ }
+ }
/**
* Sets the configuration element that defines the attributes
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
index 2e3bd4845..606540170 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java
@@ -215,13 +215,13 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
@Override
protected IStatus run(final IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ Display asyncDisplay = DebugUIPlugin.getStandardDisplay();
+ if (asyncDisplay == null || asyncDisplay.isDisposed()) {
return Status.CANCEL_STATUS;
}
- Display asyncDisplay = DebugUIPlugin.getStandardDisplay();
- if (asyncDisplay == null || asyncDisplay.isDisposed()) {
- return Status.CANCEL_STATUS;
- }
asyncDisplay.asyncExec(() -> {
IStatus result = null;
Throwable throwable = null;
@@ -242,10 +242,10 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
done(result);
}
});
- return Job.ASYNC_FINISH;
+ return Job.ASYNC_FINISH;
}
- public abstract IStatus runInUIThread(IProgressMonitor monitor);
+ public abstract IStatus runInUIThread(IProgressMonitor monitor);
}
@@ -270,10 +270,10 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*/
private boolean fPrompting;
- /**
- * Maps each launch to its perspective context activation. These
- * are disabled when a launch terminates.
- */
+ /**
+ * Maps each launch to its perspective context activation. These
+ * are disabled when a launch terminates.
+ */
private Map<ILaunch, IContextActivation[]> fLaunchToContextActivations = new HashMap<>();
/**
@@ -304,10 +304,10 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*/
@Override
public synchronized void launchRemoved(final ILaunch launch) {
- ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
- if (trigger != null) {
- trigger.removeSuspendTriggerListener(this);
- }
+ ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
+ if (trigger != null) {
+ trigger.removeSuspendTriggerListener(this);
+ }
Runnable r = () -> {
IContextActivation[] activations = fLaunchToContextActivations.remove(launch);
if (activations != null) {
@@ -336,10 +336,10 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*/
@Override
public synchronized void launchAdded(ILaunch launch) {
- ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
- if (trigger != null) {
- trigger.addSuspendTriggerListener(this);
- }
+ ISuspendTrigger trigger = launch.getAdapter(ISuspendTrigger.class);
+ if (trigger != null) {
+ trigger.addSuspendTriggerListener(this);
+ }
String perspectiveId = null;
// check event filters
try {
@@ -890,8 +890,8 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*
* @return XML
* @exception IOException if unable to generate the XML
- * @exception TransformerException if unable to generate the XML
- * @exception ParserConfigurationException if unable to generate the XML
+ * @exception TransformerException if unable to generate the XML
+ * @exception ParserConfigurationException if unable to generate the XML
*/
private String generatePerspectiveXML() throws ParserConfigurationException, CoreException {
Document doc = DebugUIPlugin.getDocument();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java
index 500ef030b..f8a61893c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java
@@ -169,27 +169,27 @@ public class SaveScopeResourcesHandler implements IStatusHandler {
projects = (IProject[]) objects[1];
}
}
- if (config != null) {
- if (DebugUITools.isPrivate(config)) {
- return Boolean.TRUE;
- }
- }
- if (projects != null && projects.length > 0) {
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- String save = store.getString(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH);
- int ret = showSaveDialog(projects, !save.equals(MessageDialogWithToggle.NEVER), save.equals(MessageDialogWithToggle.PROMPT));
- if(ret == IDialogConstants.OK_ID) {
- doSave();
- return Boolean.TRUE;
- }
- return Boolean.FALSE;
- }
- else {
+ if (config != null) {
+ if (DebugUITools.isPrivate(config)) {
+ return Boolean.TRUE;
+ }
+ }
+ if (projects != null && projects.length > 0) {
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ String save = store.getString(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH);
+ int ret = showSaveDialog(projects, !save.equals(MessageDialogWithToggle.NEVER), save.equals(MessageDialogWithToggle.PROMPT));
+ if(ret == IDialogConstants.OK_ID) {
+ doSave();
+ return Boolean.TRUE;
+ }
+ return Boolean.FALSE;
+ }
+ else {
@SuppressWarnings("deprecation")
boolean cancel = DebugUIPlugin.preLaunchSave();
- return Boolean.valueOf(cancel);
- }
- }
+ return Boolean.valueOf(cancel);
+ }
+ }
/**
*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectFavoritesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectFavoritesDialog.java
index b10f6b6fe..eba5ab2f7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectFavoritesDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectFavoritesDialog.java
@@ -91,11 +91,11 @@ public class SelectFavoritesDialog extends AbstractDebugCheckboxSelectionDialog
/**
* Returns a label to use for launch mode with accelerators removed.
*
- * @return label to use for launch mode with accelerators removed
- */
- private String getModeLabel() {
- return DebugUIPlugin.removeAccelerators(fHistory.getLaunchGroup().getLabel());
- }
+ * @return label to use for launch mode with accelerators removed
+ */
+ private String getModeLabel() {
+ return DebugUIPlugin.removeAccelerators(fHistory.getLaunchGroup().getLabel());
+ }
@Override
protected String getDialogSettingsId() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingType.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingType.java
index 2b027a688..d1380037a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingType.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingType.java
@@ -30,55 +30,55 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate;
*/
class MemoryRenderingType implements IMemoryRenderingType {
- private IConfigurationElement fConfigurationElement;
- private IMemoryRenderingTypeDelegate fDelegate;
+ private IConfigurationElement fConfigurationElement;
+ private IMemoryRenderingTypeDelegate fDelegate;
- // attributes for a memoryRenderingType
- static final String ATTR_MEM_RENDERING_TYPE_NAME = "name"; //$NON-NLS-1$
- static final String ATTR_MEM_RENDERING_TYPE_ID = "id"; //$NON-NLS-1$
- static final String ATTR_MEM_RENDERING_TYPE_DELEGATE = "class"; //$NON-NLS-1$
+ // attributes for a memoryRenderingType
+ static final String ATTR_MEM_RENDERING_TYPE_NAME = "name"; //$NON-NLS-1$
+ static final String ATTR_MEM_RENDERING_TYPE_ID = "id"; //$NON-NLS-1$
+ static final String ATTR_MEM_RENDERING_TYPE_DELEGATE = "class"; //$NON-NLS-1$
- /**
- * Constructs a rendering type from a contribution.
- */
- MemoryRenderingType(IConfigurationElement element) {
- fConfigurationElement = element;
- }
+ /**
+ * Constructs a rendering type from a contribution.
+ */
+ MemoryRenderingType(IConfigurationElement element) {
+ fConfigurationElement = element;
+ }
- @Override
+ @Override
public String getLabel() {
- return fConfigurationElement.getAttribute(ATTR_MEM_RENDERING_TYPE_NAME);
- }
+ return fConfigurationElement.getAttribute(ATTR_MEM_RENDERING_TYPE_NAME);
+ }
- @Override
+ @Override
public String getId() {
- return fConfigurationElement.getAttribute(ATTR_MEM_RENDERING_TYPE_ID);
- }
+ return fConfigurationElement.getAttribute(ATTR_MEM_RENDERING_TYPE_ID);
+ }
- @Override
+ @Override
public IMemoryRendering createRendering() throws CoreException {
- if (fDelegate == null) {
- fDelegate = (IMemoryRenderingTypeDelegate) fConfigurationElement.createExecutableExtension(ATTR_MEM_RENDERING_TYPE_DELEGATE);
- }
- return fDelegate.createRendering(getId());
- }
+ if (fDelegate == null) {
+ fDelegate = (IMemoryRenderingTypeDelegate) fConfigurationElement.createExecutableExtension(ATTR_MEM_RENDERING_TYPE_DELEGATE);
+ }
+ return fDelegate.createRendering(getId());
+ }
- /**
- * Validates this contribution.
- *
- * @exception CoreException if invalid
- */
- void validate() throws CoreException {
- verifyPresent(ATTR_MEM_RENDERING_TYPE_ID);
- verifyPresent(ATTR_MEM_RENDERING_TYPE_NAME);
- verifyPresent(ATTR_MEM_RENDERING_TYPE_DELEGATE);
- }
+ /**
+ * Validates this contribution.
+ *
+ * @exception CoreException if invalid
+ */
+ void validate() throws CoreException {
+ verifyPresent(ATTR_MEM_RENDERING_TYPE_ID);
+ verifyPresent(ATTR_MEM_RENDERING_TYPE_NAME);
+ verifyPresent(ATTR_MEM_RENDERING_TYPE_DELEGATE);
+ }
- private void verifyPresent(String attrName) throws CoreException {
- if (fConfigurationElement.getAttribute(attrName) == null) {
- Status status = new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR,
- "<memoryRenderingType> element missing required attribute: " + attrName, null); //$NON-NLS-1$
- throw new CoreException(status);
- }
- }
+ private void verifyPresent(String attrName) throws CoreException {
+ if (fConfigurationElement.getAttribute(attrName) == null) {
+ Status status = new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR,
+ "<memoryRenderingType> element missing required attribute: " + attrName, null); //$NON-NLS-1$
+ throw new CoreException(status);
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
index 57f5608e7..13f305fe1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
@@ -39,28 +39,28 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
ImageDescriptor desc = super.getImageDescriptor(elementPath, presentationContext, columnId);
int flags = computeAdornmentFlags();
- if (flags > 0) {
- Image image = DebugUIPlugin.getImageDescriptorRegistry().get(desc);
- CompositeDebugImageDescriptor compDesc = new CompositeDebugImageDescriptor(image, flags);
- return compDesc;
- }
- return desc;
+ if (flags > 0) {
+ Image image = DebugUIPlugin.getImageDescriptorRegistry().get(desc);
+ CompositeDebugImageDescriptor compDesc = new CompositeDebugImageDescriptor(image, flags);
+ return compDesc;
+ }
+ return desc;
}
@Override
public boolean getChecked(TreePath path, IPresentationContext presentationContext) throws CoreException {
Object lastSegment = path.getLastSegment();
- if (lastSegment instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) lastSegment;
- IBreakpoint[] breakpoints = container.getBreakpoints();
- for (int i = 0; i < breakpoints.length; ++i) {
- if (breakpoints[i].isEnabled()) {
+ if (lastSegment instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) lastSegment;
+ IBreakpoint[] breakpoints = container.getBreakpoints();
+ for (int i = 0; i < breakpoints.length; ++i) {
+ if (breakpoints[i].isEnabled()) {
return true;
}
- }
+ }
- return false;
- }
+ return false;
+ }
return super.getChecked(path, presentationContext);
}
@@ -102,10 +102,10 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
FontData fontData = super.getFontData(elementPath, presentationContext, columnId);
if (fontData == null && element instanceof IAdaptable) {
- IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- fontData = adapter.getFont(element);
- }
+ IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ fontData = adapter.getFont(element);
+ }
}
return fontData;
}
@@ -117,10 +117,10 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
RGB rgb = super.getForeground(elementPath, presentationContext, columnId);
if (rgb == null && element instanceof IAdaptable) {
- IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- rgb = adapter.getForeground(element);
- }
+ IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ rgb = adapter.getForeground(element);
+ }
}
return rgb;
}
@@ -132,23 +132,23 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
RGB rgb = super.getBackground(elementPath, presentationContext, columnId);
if (rgb == null && element instanceof IAdaptable) {
- IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- rgb = adapter.getBackground(element);
- }
+ IWorkbenchAdapter2 adapter = ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ rgb = adapter.getBackground(element);
+ }
}
return rgb;
}
/**
- * Computes and return common adornment flags for the given category.
- *
- * @return adornment flags defined in CompositeDebugImageDescriptor
- */
- private int computeAdornmentFlags() {
- if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
- return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
- }
- return 0;
- }
+ * Computes and return common adornment flags for the given category.
+ *
+ * @return adornment flags defined in CompositeDebugImageDescriptor
+ */
+ private int computeAdornmentFlags() {
+ if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
+ return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
+ }
+ return 0;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
index 175603b8c..d0a952f4e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
@@ -74,209 +74,209 @@ import org.eclipse.ui.IWorkbenchWindow;
* @since 3.6
*/
public class BreakpointManagerContentProvider extends ElementContentProvider
- implements IBreakpointsListener {
-
- /**
- * Breakpoint input data. Contains all input specific data.
- *
- * @since 3.6
- */
- private class InputData {
- /**
- * Breakpoint manager input
- */
- final private DefaultBreakpointsViewInput fInput;
-
- /**
- * Model proxy of the input
- */
+ implements IBreakpointsListener {
+
+ /**
+ * Breakpoint input data. Contains all input specific data.
+ *
+ * @since 3.6
+ */
+ private class InputData {
+ /**
+ * Breakpoint manager input
+ */
+ final private DefaultBreakpointsViewInput fInput;
+
+ /**
+ * Model proxy of the input
+ */
final private List<BreakpointManagerProxy> fProxies = new ArrayList<>(1);
- /**
- * Element comparator, use to compare the ordering of elements for the model
- * <br/> Note: We assume that the comparator does not change.
- */
- private ElementComparator fComparator;
+ /**
+ * Element comparator, use to compare the ordering of elements for the model
+ * <br/> Note: We assume that the comparator does not change.
+ */
+ private ElementComparator fComparator;
- /**
- * The breakpoint root container.<br/>
- * Note: The final qualifier guarantees that fContainer will be
- * initialized before the class is accessed on other threads.
- */
- final private BreakpointContainer fContainer;
+ /**
+ * The breakpoint root container.<br/>
+ * Note: The final qualifier guarantees that fContainer will be
+ * initialized before the class is accessed on other threads.
+ */
+ final private BreakpointContainer fContainer;
- /**
- * Known current breakpoint organizers.
- */
- private IBreakpointOrganizer[] fOrganizers;
+ /**
+ * Known current breakpoint organizers.
+ */
+ private IBreakpointOrganizer[] fOrganizers;
- private IStructuredSelection fDebugContext = StructuredSelection.EMPTY;
+ private IStructuredSelection fDebugContext = StructuredSelection.EMPTY;
- private IPropertyChangeListener fOrganizersListener = new IPropertyChangeListener() {
- @Override
+ private IPropertyChangeListener fOrganizersListener = new IPropertyChangeListener() {
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- // For any property changes in breakpoint organizers, refresh the containers.
- updateContainers();
- }
- };
+ // For any property changes in breakpoint organizers, refresh the containers.
+ updateContainers();
+ }
+ };
- private IPropertyChangeListener fPresentationContextListener = new IPropertyChangeListener() {
- @Override
+ private IPropertyChangeListener fPresentationContextListener = new IPropertyChangeListener() {
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- presentationPropertyChanged(event);
- }
- };
+ presentationPropertyChanged(event);
+ }
+ };
- private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
- @Override
+ private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- InputData.this.debugContextChanged(event);
- }
- };
-
- /**
- * Constructor
- *
- * @param input the breakpoint manager input
- */
- InputData(DefaultBreakpointsViewInput input) {
- fInput = input;
- fComparator = (ElementComparator)
- input.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR);
-
- fOrganizers = (IBreakpointOrganizer[])
- input.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS);
-
- // Create the initial container.
- ModelDelta initialDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
- IBreakpoint[] breakpoints = filterBreakpoints(
- fInput, getSelectionFilter(fInput, getDebugContext()), fBpManager.getBreakpoints());
- fContainer = createRootContainer(initialDelta, fInput, fOrganizers, breakpoints);
-
- registerOrganizersListener(null, fOrganizers);
- input.getContext().addPropertyChangeListener(fPresentationContextListener);
-
- IWorkbenchWindow window = fInput.getContext().getWindow();
- if (window != null) {
- IDebugContextService debugContextService = DebugUITools.getDebugContextManager().getContextService(window);
- ISelection debugContext = debugContextService.getActiveContext();
- if (debugContext instanceof IStructuredSelection) {
- synchronized(this) {
- fDebugContext = (IStructuredSelection)debugContext;
- }
- }
- debugContextService.addDebugContextListener(fDebugContextListener);
- }
- }
-
- void dispose() {
- // Unregister listener to breakpoint organizers.
- IBreakpointOrganizer[] organizers;
- synchronized(this) {
- organizers = fOrganizers;
- fOrganizers = null;
- }
- registerOrganizersListener(organizers, null);
-
- // Unregister listener to presentation context.
- fInput.getContext().removePropertyChangeListener(fPresentationContextListener);
-
- // Unregister listener to debug context in window.
- IWorkbenchWindow window = fInput.getContext().getWindow();
- if (window != null) {
- IDebugContextService debugContextService = DebugUITools.getDebugContextManager().getContextService(window);
- debugContextService.removeDebugContextListener(fDebugContextListener);
- }
-
- }
-
- void proxyInstalled(BreakpointManagerProxy proxy) {
- ModelDelta rootDelta = null;
- synchronized(this) {
- fProxies.add(proxy);
-
- // Generate an install delta
-
- rootDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
- buildInstallDelta(rootDelta, fContainer);
-
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("PROXY INSTALLED (" + proxy + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- proxy.postModelChanged(rootDelta, false);
- }
- }
-
- synchronized void proxyDisposed(BreakpointManagerProxy proxy) {
- fProxies.remove(proxy);
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("PROXY DISPOSED (" + proxy + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- synchronized BreakpointManagerProxy[] getProxies() {
- return fProxies.toArray(new BreakpointManagerProxy[fProxies.size()]);
- }
-
- /**
- * Change the breakpoint organizers for the root container.
- *
- * @param organizers the new organizers.
- */
- void setOrganizers(IBreakpointOrganizer[] organizers) {
- IBreakpointOrganizer[] oldOrganizers = null;
- synchronized(this) {
- oldOrganizers = fOrganizers;
- fOrganizers = organizers;
- }
- registerOrganizersListener(oldOrganizers, organizers);
- updateContainers();
- }
-
- private void registerOrganizersListener(IBreakpointOrganizer[] oldOrganizers, IBreakpointOrganizer[] newOrganizers) {
- if (oldOrganizers != null) {
- for (int i = 0; i < oldOrganizers.length; i++) {
- oldOrganizers[i].removePropertyChangeListener(fOrganizersListener);
- }
- }
- if (newOrganizers != null) {
- for (int i = 0; i < newOrganizers.length; i++) {
- newOrganizers[i].addPropertyChangeListener(fOrganizersListener);
- }
- }
- }
-
- void updateContainers() {
- IBreakpoint[] breakpoints = filterBreakpoints(
- fInput, getSelectionFilter(fInput, getDebugContext()), fBpManager.getBreakpoints());
-
- synchronized(this) {
- ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- // create a reference container, use for deleting elements and adding elements
- ModelDelta dummyDelta = new ModelDelta(null, IModelDelta.NO_CHANGE);
- BreakpointContainer refContainer = createRootContainer(dummyDelta, fInput, fOrganizers, breakpoints);
-
- // delete the removed elements
- deleteRemovedElements(fContainer, refContainer, delta);
-
- // adjust the old organizer with the reference organizer
- BreakpointContainer.copyOrganizers(fContainer, refContainer);
-
- // insert the added elements
- IBreakpoint newBreakpoint = insertAddedElements(fContainer, refContainer, delta);
- delta.setChildCount(fContainer.getChildren().length);
-
- // select the new breakpoint
- if (newBreakpoint != null) {
- appendModelDeltaToElement(delta, newBreakpoint, IModelDelta.SELECT);
- }
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("POST BREAKPOINT DELTA (setOrganizers)\n"); //$NON-NLS-1$
- }
- postModelChanged(delta, false);
- }
- }
+ InputData.this.debugContextChanged(event);
+ }
+ };
+
+ /**
+ * Constructor
+ *
+ * @param input the breakpoint manager input
+ */
+ InputData(DefaultBreakpointsViewInput input) {
+ fInput = input;
+ fComparator = (ElementComparator)
+ input.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR);
+
+ fOrganizers = (IBreakpointOrganizer[])
+ input.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS);
+
+ // Create the initial container.
+ ModelDelta initialDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
+ IBreakpoint[] breakpoints = filterBreakpoints(
+ fInput, getSelectionFilter(fInput, getDebugContext()), fBpManager.getBreakpoints());
+ fContainer = createRootContainer(initialDelta, fInput, fOrganizers, breakpoints);
+
+ registerOrganizersListener(null, fOrganizers);
+ input.getContext().addPropertyChangeListener(fPresentationContextListener);
+
+ IWorkbenchWindow window = fInput.getContext().getWindow();
+ if (window != null) {
+ IDebugContextService debugContextService = DebugUITools.getDebugContextManager().getContextService(window);
+ ISelection debugContext = debugContextService.getActiveContext();
+ if (debugContext instanceof IStructuredSelection) {
+ synchronized(this) {
+ fDebugContext = (IStructuredSelection)debugContext;
+ }
+ }
+ debugContextService.addDebugContextListener(fDebugContextListener);
+ }
+ }
+
+ void dispose() {
+ // Unregister listener to breakpoint organizers.
+ IBreakpointOrganizer[] organizers;
+ synchronized(this) {
+ organizers = fOrganizers;
+ fOrganizers = null;
+ }
+ registerOrganizersListener(organizers, null);
+
+ // Unregister listener to presentation context.
+ fInput.getContext().removePropertyChangeListener(fPresentationContextListener);
+
+ // Unregister listener to debug context in window.
+ IWorkbenchWindow window = fInput.getContext().getWindow();
+ if (window != null) {
+ IDebugContextService debugContextService = DebugUITools.getDebugContextManager().getContextService(window);
+ debugContextService.removeDebugContextListener(fDebugContextListener);
+ }
+
+ }
+
+ void proxyInstalled(BreakpointManagerProxy proxy) {
+ ModelDelta rootDelta = null;
+ synchronized(this) {
+ fProxies.add(proxy);
+
+ // Generate an install delta
+
+ rootDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
+ buildInstallDelta(rootDelta, fContainer);
+
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("PROXY INSTALLED (" + proxy + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ proxy.postModelChanged(rootDelta, false);
+ }
+ }
+
+ synchronized void proxyDisposed(BreakpointManagerProxy proxy) {
+ fProxies.remove(proxy);
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("PROXY DISPOSED (" + proxy + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ synchronized BreakpointManagerProxy[] getProxies() {
+ return fProxies.toArray(new BreakpointManagerProxy[fProxies.size()]);
+ }
+
+ /**
+ * Change the breakpoint organizers for the root container.
+ *
+ * @param organizers the new organizers.
+ */
+ void setOrganizers(IBreakpointOrganizer[] organizers) {
+ IBreakpointOrganizer[] oldOrganizers = null;
+ synchronized(this) {
+ oldOrganizers = fOrganizers;
+ fOrganizers = organizers;
+ }
+ registerOrganizersListener(oldOrganizers, organizers);
+ updateContainers();
+ }
+
+ private void registerOrganizersListener(IBreakpointOrganizer[] oldOrganizers, IBreakpointOrganizer[] newOrganizers) {
+ if (oldOrganizers != null) {
+ for (int i = 0; i < oldOrganizers.length; i++) {
+ oldOrganizers[i].removePropertyChangeListener(fOrganizersListener);
+ }
+ }
+ if (newOrganizers != null) {
+ for (int i = 0; i < newOrganizers.length; i++) {
+ newOrganizers[i].addPropertyChangeListener(fOrganizersListener);
+ }
+ }
+ }
+
+ void updateContainers() {
+ IBreakpoint[] breakpoints = filterBreakpoints(
+ fInput, getSelectionFilter(fInput, getDebugContext()), fBpManager.getBreakpoints());
+
+ synchronized(this) {
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ // create a reference container, use for deleting elements and adding elements
+ ModelDelta dummyDelta = new ModelDelta(null, IModelDelta.NO_CHANGE);
+ BreakpointContainer refContainer = createRootContainer(dummyDelta, fInput, fOrganizers, breakpoints);
+
+ // delete the removed elements
+ deleteRemovedElements(fContainer, refContainer, delta);
+
+ // adjust the old organizer with the reference organizer
+ BreakpointContainer.copyOrganizers(fContainer, refContainer);
+
+ // insert the added elements
+ IBreakpoint newBreakpoint = insertAddedElements(fContainer, refContainer, delta);
+ delta.setChildCount(fContainer.getChildren().length);
+
+ // select the new breakpoint
+ if (newBreakpoint != null) {
+ appendModelDeltaToElement(delta, newBreakpoint, IModelDelta.SELECT);
+ }
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("POST BREAKPOINT DELTA (setOrganizers)\n"); //$NON-NLS-1$
+ }
+ postModelChanged(delta, false);
+ }
+ }
void sortContainers() {
IBreakpoint[] breakpoints = filterBreakpoints(fInput, getSelectionFilter(fInput, getDebugContext()), fBpManager.getBreakpoints());
@@ -309,381 +309,381 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
}
}
- private synchronized IStructuredSelection getDebugContext() {
- return fDebugContext;
- }
+ private synchronized IStructuredSelection getDebugContext() {
+ return fDebugContext;
+ }
- /**
- * Handles the property changed events in presentation contexts.
- * Sub-classes may override to perform additional handling.
- * @param event the event
- */
- private void presentationPropertyChanged(PropertyChangeEvent event) {
+ /**
+ * Handles the property changed events in presentation contexts.
+ * Sub-classes may override to perform additional handling.
+ * @param event the event
+ */
+ private void presentationPropertyChanged(PropertyChangeEvent event) {
if (IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR_SORT.equals(event.getProperty())) {
sortContainers();
} else if (IPresentationContext.PROPERTY_DISPOSED.equals(event.getProperty())) {
- contextDisposed(fInput.getContext());
- }
- if (IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS.equals(event.getProperty())) {
- IBreakpointOrganizer[] organizers = (IBreakpointOrganizer[])event.getNewValue();
- setOrganizers(organizers);
- }
- else if ( IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION.equals(event.getProperty()) )
- {
- IStructuredSelection selection = null;
-
- if (Boolean.TRUE.equals(event.getNewValue()) ) {
- selection = getDebugContext();
- }
- setFilterSelection(selection);
- }
- else if ( IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION.equals(event.getProperty()) )
- {
- IStructuredSelection selection = null;
-
- if (Boolean.TRUE.equals(event.getNewValue()) ) {
- selection = getDebugContext();
- }
- trackSelection(selection);
- }
- }
-
- private void debugContextChanged(DebugContextEvent event) {
- IStructuredSelection newContext;
- if (event.getContext() instanceof IStructuredSelection) {
- newContext = (IStructuredSelection)event.getContext();
- } else {
- newContext = StructuredSelection.EMPTY;
- }
-
- synchronized(this) {
- fDebugContext = newContext;
- }
-
- if (Boolean.TRUE.equals(fInput.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
- setFilterSelection(newContext);
- }
-
- if (Boolean.TRUE.equals(fInput.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION)) ) {
- trackSelection(newContext);
- }
- }
-
-
- private void setFilterSelection(IStructuredSelection ss) {
- ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- boolean changed = false;
-
- // calculate supported breakpoints outside of the synchronized section.
- IBreakpoint[] allBreakpoints = fBpManager.getBreakpoints();
- boolean[] supportedBreakpoints = new boolean[allBreakpoints.length];
- for (int i = 0; i < allBreakpoints.length; ++i) {
- supportedBreakpoints[i] = supportsBreakpoint(ss, allBreakpoints[i]);
- }
-
- synchronized(this) {
+ contextDisposed(fInput.getContext());
+ }
+ if (IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS.equals(event.getProperty())) {
+ IBreakpointOrganizer[] organizers = (IBreakpointOrganizer[])event.getNewValue();
+ setOrganizers(organizers);
+ }
+ else if ( IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION.equals(event.getProperty()) )
+ {
+ IStructuredSelection selection = null;
+
+ if (Boolean.TRUE.equals(event.getNewValue()) ) {
+ selection = getDebugContext();
+ }
+ setFilterSelection(selection);
+ }
+ else if ( IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION.equals(event.getProperty()) )
+ {
+ IStructuredSelection selection = null;
+
+ if (Boolean.TRUE.equals(event.getNewValue()) ) {
+ selection = getDebugContext();
+ }
+ trackSelection(selection);
+ }
+ }
+
+ private void debugContextChanged(DebugContextEvent event) {
+ IStructuredSelection newContext;
+ if (event.getContext() instanceof IStructuredSelection) {
+ newContext = (IStructuredSelection)event.getContext();
+ } else {
+ newContext = StructuredSelection.EMPTY;
+ }
+
+ synchronized(this) {
+ fDebugContext = newContext;
+ }
+
+ if (Boolean.TRUE.equals(fInput.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
+ setFilterSelection(newContext);
+ }
+
+ if (Boolean.TRUE.equals(fInput.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION)) ) {
+ trackSelection(newContext);
+ }
+ }
+
+
+ private void setFilterSelection(IStructuredSelection ss) {
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ boolean changed = false;
+
+ // calculate supported breakpoints outside of the synchronized section.
+ IBreakpoint[] allBreakpoints = fBpManager.getBreakpoints();
+ boolean[] supportedBreakpoints = new boolean[allBreakpoints.length];
+ for (int i = 0; i < allBreakpoints.length; ++i) {
+ supportedBreakpoints[i] = supportsBreakpoint(ss, allBreakpoints[i]);
+ }
+
+ synchronized(this) {
Set<IBreakpoint> existingBreakpoints = new HashSet<>(Arrays.asList(fContainer.getBreakpoints()));
- // Bug 310879
- // Process breakpoints in two passes: first remove breakpoints, then add new ones.
- // This way the breakpoint counts and indexes will be consistent in the delta.
- for (int i = 0; i < allBreakpoints.length; ++i) {
- if (!supportedBreakpoints[i] && existingBreakpoints.contains(allBreakpoints[i])) {
- fContainer.removeBreakpoint(allBreakpoints[i], delta);
- changed = true;
- }
- }
- for (int i = 0; i < allBreakpoints.length; ++i) {
- if (supportedBreakpoints[i] && !existingBreakpoints.contains(allBreakpoints[i])) {
- fContainer.addBreakpoint(allBreakpoints[i], delta);
- changed = true;
- }
- }
-
- if (changed) {
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("POST BREAKPOINT DELTA (setFilterSelection)\n"); //$NON-NLS-1$
- }
- postModelChanged(delta, false);
- }
- }
- }
-
-
- private void trackSelection(IStructuredSelection selection) {
- if (selection == null || selection.size() != 1) {
- return;
- }
+ // Bug 310879
+ // Process breakpoints in two passes: first remove breakpoints, then add new ones.
+ // This way the breakpoint counts and indexes will be consistent in the delta.
+ for (int i = 0; i < allBreakpoints.length; ++i) {
+ if (!supportedBreakpoints[i] && existingBreakpoints.contains(allBreakpoints[i])) {
+ fContainer.removeBreakpoint(allBreakpoints[i], delta);
+ changed = true;
+ }
+ }
+ for (int i = 0; i < allBreakpoints.length; ++i) {
+ if (supportedBreakpoints[i] && !existingBreakpoints.contains(allBreakpoints[i])) {
+ fContainer.addBreakpoint(allBreakpoints[i], delta);
+ changed = true;
+ }
+ }
+
+ if (changed) {
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("POST BREAKPOINT DELTA (setFilterSelection)\n"); //$NON-NLS-1$
+ }
+ postModelChanged(delta, false);
+ }
+ }
+ }
+
+
+ private void trackSelection(IStructuredSelection selection) {
+ if (selection == null || selection.size() != 1) {
+ return;
+ }
Iterator<?> iter = selection.iterator();
- Object firstElement = iter.next();
- if (firstElement == null || iter.hasNext()) {
- return;
- }
- IThread thread = null;
- if (firstElement instanceof IStackFrame) {
- thread = ((IStackFrame) firstElement).getThread();
- } else if (firstElement instanceof IThread) {
- thread = (IThread) firstElement;
- } else {
- return;
- }
-
- IBreakpoint[] breakpoints = thread.getBreakpoints();
+ Object firstElement = iter.next();
+ if (firstElement == null || iter.hasNext()) {
+ return;
+ }
+ IThread thread = null;
+ if (firstElement instanceof IStackFrame) {
+ thread = ((IStackFrame) firstElement).getThread();
+ } else if (firstElement instanceof IThread) {
+ thread = (IThread) firstElement;
+ } else {
+ return;
+ }
+
+ IBreakpoint[] breakpoints = thread.getBreakpoints();
Set<IBreakpoint> bpsSet = new HashSet<>(breakpoints.length * 4 / 3);
- for (int i = 0; i< breakpoints.length; i++) {
- bpsSet.add(breakpoints[i]);
- }
-
- ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- synchronized (this) {
- if (buildTrackSelectionDelta(delta, fContainer, bpsSet)) {
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("POST BREAKPOINT DELTA (trackSelection)\n"); //$NON-NLS-1$
- }
- BreakpointManagerProxy[] proxies = getProxies();
- for (int i = 0; i < proxies.length; i++) {
- proxies[i].postModelChanged(delta, true);
- }
- }
- }
-
- }
-
- /**
- * Recursive function to build the model delta to select a breakpoint
- * corresponding to the active debug context selection.
- *
- * @param delta Delta node to build on
- * @param container Container element to build delta for.
- * @param breakpoints Breakpoint set to be selected.
- * @return whether we found a breakpoint to select
- */
+ for (int i = 0; i< breakpoints.length; i++) {
+ bpsSet.add(breakpoints[i]);
+ }
+
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ synchronized (this) {
+ if (buildTrackSelectionDelta(delta, fContainer, bpsSet)) {
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("POST BREAKPOINT DELTA (trackSelection)\n"); //$NON-NLS-1$
+ }
+ BreakpointManagerProxy[] proxies = getProxies();
+ for (int i = 0; i < proxies.length; i++) {
+ proxies[i].postModelChanged(delta, true);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Recursive function to build the model delta to select a breakpoint
+ * corresponding to the active debug context selection.
+ *
+ * @param delta Delta node to build on
+ * @param container Container element to build delta for.
+ * @param breakpoints Breakpoint set to be selected.
+ * @return whether we found a breakpoint to select
+ */
private boolean buildTrackSelectionDelta(ModelDelta delta, BreakpointContainer container, Set<IBreakpoint> breakpoints) {
- Object[] children = container.getChildren();
- delta.setChildCount(children.length);
- for (int i = 0; i < children.length; i++) {
- ModelDelta childDelta = delta.addNode(children[i], i, IModelDelta.NO_CHANGE);
- if (children[i] instanceof BreakpointContainer) {
- BreakpointContainer childContainer = (BreakpointContainer)children[i];
- boolean containsBP = false;
- IBreakpoint[] containerBPs = childContainer.getBreakpoints();
- for (int j = 0; j < containerBPs.length; j++) {
- if (breakpoints.contains(containerBPs[j])) {
- containsBP = true;
- break;
- }
- }
- if (containsBP && buildTrackSelectionDelta(childDelta, childContainer, breakpoints) ) {
- return true;
- }
- } else if (children[i] instanceof IBreakpoint &&
- breakpoints.contains(children[i]))
- {
- childDelta.setFlags(IModelDelta.SELECT | IModelDelta.EXPAND);
- return true;
- }
- }
- return false;
- }
-
- /**
- * Helper method to add breakpoints to the given input.
- *
- * @param breakpoints the breakpoints
- */
- void breakpointsAdded(IBreakpoint[] breakpoints) {
- IBreakpoint[] filteredBreakpoints = filterBreakpoints(
- fInput, getSelectionFilter(fInput, getDebugContext()), breakpoints);
-
- if (filteredBreakpoints.length > 0) {
- synchronized (this) {
- ModelDelta delta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
- for (int i = 0; i < filteredBreakpoints.length; ++i) {
- // Avoid adding breakpoints which were already removed. If breakpoints
- // are added and removed very fast, the Breakpoint manager can issue
- // breakpoint added events after breakpoint removed events! This means
- // that such breakpoints would never be removed from the view.
- // (Bug 289526)
- if (DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(filteredBreakpoints[i].getMarker()) != null) {
- fContainer.addBreakpoint(filteredBreakpoints[i], delta);
- }
- }
- delta.setChildCount(fContainer.getChildren().length);
-
- // select the breakpoint
- if (filteredBreakpoints.length > 0) {
- appendModelDeltaToElement(delta, filteredBreakpoints[0], IModelDelta.SELECT);
- }
-
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("POST BREAKPOINT DELTA (breakpointsAddedInput)\n"); //$NON-NLS-1$
- }
- postModelChanged(delta, false);
- }
- }
- }
-
- /**
- * Helper method to remove breakpoints from a given input.
- *
- * @param breakpoints the breakpoints
- */
- void breakpointsRemoved(IBreakpoint[] breakpoints) {
- synchronized (this) {
- boolean removed = false;
- ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- for (int i = 0; i < breakpoints.length; ++i) {
- removed = fContainer.removeBreakpoint(breakpoints[i], delta) || removed;
- }
-
- if (removed) {
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("POST BREAKPOINT DELTA (breakpointsRemovedInput)\n"); //$NON-NLS-1$
- }
- postModelChanged(delta, false);
- }
- }
- }
-
- void breakpointsChanged(IBreakpoint[] breakpoints) {
-
-
- IBreakpoint[] filteredBreakpoints = filterBreakpoints(
- fInput, getSelectionFilter(fInput, getDebugContext()), breakpoints);
-
- synchronized (this) {
- ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
-
- // If the change caused a breakpoint to be added (installed) or remove (un-installed) update accordingly.
+ Object[] children = container.getChildren();
+ delta.setChildCount(children.length);
+ for (int i = 0; i < children.length; i++) {
+ ModelDelta childDelta = delta.addNode(children[i], i, IModelDelta.NO_CHANGE);
+ if (children[i] instanceof BreakpointContainer) {
+ BreakpointContainer childContainer = (BreakpointContainer)children[i];
+ boolean containsBP = false;
+ IBreakpoint[] containerBPs = childContainer.getBreakpoints();
+ for (int j = 0; j < containerBPs.length; j++) {
+ if (breakpoints.contains(containerBPs[j])) {
+ containsBP = true;
+ break;
+ }
+ }
+ if (containsBP && buildTrackSelectionDelta(childDelta, childContainer, breakpoints) ) {
+ return true;
+ }
+ } else if (children[i] instanceof IBreakpoint &&
+ breakpoints.contains(children[i]))
+ {
+ childDelta.setFlags(IModelDelta.SELECT | IModelDelta.EXPAND);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Helper method to add breakpoints to the given input.
+ *
+ * @param breakpoints the breakpoints
+ */
+ void breakpointsAdded(IBreakpoint[] breakpoints) {
+ IBreakpoint[] filteredBreakpoints = filterBreakpoints(
+ fInput, getSelectionFilter(fInput, getDebugContext()), breakpoints);
+
+ if (filteredBreakpoints.length > 0) {
+ synchronized (this) {
+ ModelDelta delta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
+ for (int i = 0; i < filteredBreakpoints.length; ++i) {
+ // Avoid adding breakpoints which were already removed. If breakpoints
+ // are added and removed very fast, the Breakpoint manager can issue
+ // breakpoint added events after breakpoint removed events! This means
+ // that such breakpoints would never be removed from the view.
+ // (Bug 289526)
+ if (DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(filteredBreakpoints[i].getMarker()) != null) {
+ fContainer.addBreakpoint(filteredBreakpoints[i], delta);
+ }
+ }
+ delta.setChildCount(fContainer.getChildren().length);
+
+ // select the breakpoint
+ if (filteredBreakpoints.length > 0) {
+ appendModelDeltaToElement(delta, filteredBreakpoints[0], IModelDelta.SELECT);
+ }
+
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("POST BREAKPOINT DELTA (breakpointsAddedInput)\n"); //$NON-NLS-1$
+ }
+ postModelChanged(delta, false);
+ }
+ }
+ }
+
+ /**
+ * Helper method to remove breakpoints from a given input.
+ *
+ * @param breakpoints the breakpoints
+ */
+ void breakpointsRemoved(IBreakpoint[] breakpoints) {
+ synchronized (this) {
+ boolean removed = false;
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ for (int i = 0; i < breakpoints.length; ++i) {
+ removed = fContainer.removeBreakpoint(breakpoints[i], delta) || removed;
+ }
+
+ if (removed) {
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("POST BREAKPOINT DELTA (breakpointsRemovedInput)\n"); //$NON-NLS-1$
+ }
+ postModelChanged(delta, false);
+ }
+ }
+ }
+
+ void breakpointsChanged(IBreakpoint[] breakpoints) {
+
+
+ IBreakpoint[] filteredBreakpoints = filterBreakpoints(
+ fInput, getSelectionFilter(fInput, getDebugContext()), breakpoints);
+
+ synchronized (this) {
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+
+ // If the change caused a breakpoint to be added (installed) or remove (un-installed) update accordingly.
List<IBreakpoint> removed = new ArrayList<>();
List<IBreakpoint> added = new ArrayList<>();
List<IBreakpoint> filteredAsList = Arrays.asList(filteredBreakpoints);
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint bp = breakpoints[i];
- boolean oldContainedBp = fContainer.contains(bp);
- boolean newContained = filteredAsList.contains(bp);
- if (oldContainedBp && !newContained) {
- removed.add(bp);
- } else if (!oldContainedBp && newContained) {
- added.add(bp);
- }
- }
- if (!added.isEmpty()) {
- breakpointsAdded(added.toArray(new IBreakpoint[added.size()]));
- }
- if (!removed.isEmpty()) {
- breakpointsRemoved(removed.toArray(new IBreakpoint[removed.size()]));
- }
- for (int i = 0; i < filteredBreakpoints.length; ++i)
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint bp = breakpoints[i];
+ boolean oldContainedBp = fContainer.contains(bp);
+ boolean newContained = filteredAsList.contains(bp);
+ if (oldContainedBp && !newContained) {
+ removed.add(bp);
+ } else if (!oldContainedBp && newContained) {
+ added.add(bp);
+ }
+ }
+ if (!added.isEmpty()) {
+ breakpointsAdded(added.toArray(new IBreakpoint[added.size()]));
+ }
+ if (!removed.isEmpty()) {
+ breakpointsRemoved(removed.toArray(new IBreakpoint[removed.size()]));
+ }
+ for (int i = 0; i < filteredBreakpoints.length; ++i)
{
appendModelDelta(fContainer, delta, IModelDelta.STATE | IModelDelta.CONTENT, filteredBreakpoints[i]); // content flag triggers detail refresh
}
- if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
- DebugUIPlugin.trace("POST BREAKPOINT DELTA (breakpointsChanged)\n"); //$NON-NLS-1$
- }
- postModelChanged(delta, false);
- }
- }
-
-
- /**
- * Recursive function to build the model delta to install breakpoint
- * model proxies for all breakpoints and breakpoint containers.
- *
- * @param delta Delta node to build on
- * @param container Container element to build delta for.
- */
- private void buildInstallDelta(ModelDelta delta, BreakpointContainer container) {
- Object[] children = container.getChildren();
- delta.setChildCount(children.length);
- for (int i = 0; i < children.length; i++) {
- ModelDelta childDelta = delta.addNode(children[i], i, IModelDelta.NO_CHANGE);
- if (children[i] instanceof BreakpointContainer) {
- childDelta.setFlags(IModelDelta.INSTALL);
- buildInstallDelta(childDelta, (BreakpointContainer)children[i]);
- } else if (children[i] instanceof IBreakpoint) {
- childDelta.setFlags(IModelDelta.INSTALL);
- }
- }
- }
-
-
- /**
- * Insert elements from the reference container to an existing container.
- *
- * @param container the existing container to insert the new elements.
- * @param refContainer the reference container to compare elements that are added.
- * @param containerDelta the delta of the existing container.
- * @return the breakpoint that was inserted
- */
- private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) {
- IBreakpoint newBreakpoint = null;
-
- Object[] children = container.getChildren();
- Object[] refChildren = refContainer.getChildren();
-
-
- for (int i = 0; i < refChildren.length; ++i) {
- Object element = getElement(children, refChildren[i]);
-
- // if a child of refContainer doesn't exist in container, than insert it to container
- // - if the reference child is a container, than copy the reference child container to container
- // - otherwise (Breakpoint), add the breakpoint to container
- if (element == null) {
- if (refChildren[i] instanceof BreakpointContainer) {
- BreakpointContainer.addChildContainer(container, (BreakpointContainer) refChildren[i], containerDelta);
- } else if(refChildren[i] instanceof IBreakpoint) {
- BreakpointContainer.addBreakpoint(container, (IBreakpoint) refChildren[i], containerDelta);
- if (newBreakpoint == null) {
+ if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
+ DebugUIPlugin.trace("POST BREAKPOINT DELTA (breakpointsChanged)\n"); //$NON-NLS-1$
+ }
+ postModelChanged(delta, false);
+ }
+ }
+
+
+ /**
+ * Recursive function to build the model delta to install breakpoint
+ * model proxies for all breakpoints and breakpoint containers.
+ *
+ * @param delta Delta node to build on
+ * @param container Container element to build delta for.
+ */
+ private void buildInstallDelta(ModelDelta delta, BreakpointContainer container) {
+ Object[] children = container.getChildren();
+ delta.setChildCount(children.length);
+ for (int i = 0; i < children.length; i++) {
+ ModelDelta childDelta = delta.addNode(children[i], i, IModelDelta.NO_CHANGE);
+ if (children[i] instanceof BreakpointContainer) {
+ childDelta.setFlags(IModelDelta.INSTALL);
+ buildInstallDelta(childDelta, (BreakpointContainer)children[i]);
+ } else if (children[i] instanceof IBreakpoint) {
+ childDelta.setFlags(IModelDelta.INSTALL);
+ }
+ }
+ }
+
+
+ /**
+ * Insert elements from the reference container to an existing container.
+ *
+ * @param container the existing container to insert the new elements.
+ * @param refContainer the reference container to compare elements that are added.
+ * @param containerDelta the delta of the existing container.
+ * @return the breakpoint that was inserted
+ */
+ private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) {
+ IBreakpoint newBreakpoint = null;
+
+ Object[] children = container.getChildren();
+ Object[] refChildren = refContainer.getChildren();
+
+
+ for (int i = 0; i < refChildren.length; ++i) {
+ Object element = getElement(children, refChildren[i]);
+
+ // if a child of refContainer doesn't exist in container, than insert it to container
+ // - if the reference child is a container, than copy the reference child container to container
+ // - otherwise (Breakpoint), add the breakpoint to container
+ if (element == null) {
+ if (refChildren[i] instanceof BreakpointContainer) {
+ BreakpointContainer.addChildContainer(container, (BreakpointContainer) refChildren[i], containerDelta);
+ } else if(refChildren[i] instanceof IBreakpoint) {
+ BreakpointContainer.addBreakpoint(container, (IBreakpoint) refChildren[i], containerDelta);
+ if (newBreakpoint == null) {
newBreakpoint = (IBreakpoint) refChildren[i];
}
- }
+ }
- // if a child exist in container, than recursively search into container. And also update the organizer of
- // of container to the one in the refContainer's child.
- } else if (element instanceof BreakpointContainer) {
+ // if a child exist in container, than recursively search into container. And also update the organizer of
+ // of container to the one in the refContainer's child.
+ } else if (element instanceof BreakpointContainer) {
ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1);
- BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildren[i]);
- newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildren[i], childDelta);
- childDelta.setChildCount(((BreakpointContainer) element).getChildren().length);
- }
- }
-
- return newBreakpoint;
- }
-
-
-
- /**
- * Delete elements from existing container that doesn't exist in the reference container.
- *
- * @param container the existing container to delete the removed elements.
- * @param refContainer the reference container to compare elements that are removed.
- * @param containerDelta the delta of the existing container.
- */
- private void deleteRemovedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) {
- Object[] children = container.getChildren();
- Object[] refChildren = refContainer.getChildren();
-
- // if a child of container doesn't exist in refContainer, than remove it from container
- for (int i = 0; i < children.length; ++i) {
- Object element = getElement(refChildren, children[i]);
-
- if (element == null) {
- if (children[i] instanceof BreakpointContainer) {
- BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta);
- } else {
- BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta);
- }
- } else if (element instanceof BreakpointContainer){
-
- ModelDelta childDelta = containerDelta.addNode(children[i], IModelDelta.STATE);
- deleteRemovedElements((BreakpointContainer) children[i], (BreakpointContainer) element, childDelta);
- }
- }
- }
+ BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildren[i]);
+ newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildren[i], childDelta);
+ childDelta.setChildCount(((BreakpointContainer) element).getChildren().length);
+ }
+ }
+
+ return newBreakpoint;
+ }
+
+
+
+ /**
+ * Delete elements from existing container that doesn't exist in the reference container.
+ *
+ * @param container the existing container to delete the removed elements.
+ * @param refContainer the reference container to compare elements that are removed.
+ * @param containerDelta the delta of the existing container.
+ */
+ private void deleteRemovedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) {
+ Object[] children = container.getChildren();
+ Object[] refChildren = refContainer.getChildren();
+
+ // if a child of container doesn't exist in refContainer, than remove it from container
+ for (int i = 0; i < children.length; ++i) {
+ Object element = getElement(refChildren, children[i]);
+
+ if (element == null) {
+ if (children[i] instanceof BreakpointContainer) {
+ BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta);
+ } else {
+ BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta);
+ }
+ } else if (element instanceof BreakpointContainer){
+
+ ModelDelta childDelta = containerDelta.addNode(children[i], IModelDelta.STATE);
+ deleteRemovedElements((BreakpointContainer) children[i], (BreakpointContainer) element, childDelta);
+ }
+ }
+ }
private void deleteAllElements(BreakpointContainer container, ModelDelta containerDelta) {
Object[] children = container.getChildren();
@@ -700,453 +700,453 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
}
}
- /**
- * Get the element that is in the collection.
- *
- * @param collection the collection of elements.
- * @param element the element to search.
- * @return if element exist in collection, than it is returned, otherwise <code>null</code> is returned.
- * @see #insertAddedElements
- * @see #deleteRemovedElements
- */
- private Object getElement(Object[] collection, Object element) {
- for (int i = 0; i < collection.length; ++i) {
+ /**
+ * Get the element that is in the collection.
+ *
+ * @param collection the collection of elements.
+ * @param element the element to search.
+ * @return if element exist in collection, than it is returned, otherwise <code>null</code> is returned.
+ * @see #insertAddedElements
+ * @see #deleteRemovedElements
+ */
+ private Object getElement(Object[] collection, Object element) {
+ for (int i = 0; i < collection.length; ++i) {
if (collection[i] instanceof BreakpointContainer && element instanceof BreakpointContainer) {
- if (collection[i].equals(element)) {
+ if (collection[i].equals(element)) {
return collection[i];
}
- } else {
- if (collection[i].equals(element)) {
+ } else {
+ if (collection[i].equals(element)) {
return collection[i];
}
- }
+ }
}
- return null;
- }
-
- /**
- * Create a root container.
- *
- * @param rootDelta the root delta.
- * @param input the view input.
- * @param organizers the breakpoint organizers.
- * @param breakpoints the breakpoints to add to the container
- * @return the new root container
- */
- private BreakpointContainer createRootContainer(
- ModelDelta rootDelta, DefaultBreakpointsViewInput input,
- IBreakpointOrganizer[] organizers, IBreakpoint[] breakpoints)
- {
-
- BreakpointContainer container = new BreakpointContainer(organizers, fComparator);
- container.initDefaultContainers(rootDelta);
-
- for (int i = 0; i < breakpoints.length; ++i) {
- container.addBreakpoint(breakpoints[i], rootDelta);
- }
-
- return container;
- }
-
- /**
- * Fire model change event for the input.
- *
- * @param delta the model delta.
- * @param select if the viewer selection should change
- */
- synchronized private void postModelChanged(final IModelDelta delta, boolean select) {
- for (int i = 0; fProxies != null && i < fProxies.size(); i++) {
- fProxies.get(i).postModelChanged(delta, select);
- }
- }
-
-
- }
+ return null;
+ }
+
+ /**
+ * Create a root container.
+ *
+ * @param rootDelta the root delta.
+ * @param input the view input.
+ * @param organizers the breakpoint organizers.
+ * @param breakpoints the breakpoints to add to the container
+ * @return the new root container
+ */
+ private BreakpointContainer createRootContainer(
+ ModelDelta rootDelta, DefaultBreakpointsViewInput input,
+ IBreakpointOrganizer[] organizers, IBreakpoint[] breakpoints)
+ {
+
+ BreakpointContainer container = new BreakpointContainer(organizers, fComparator);
+ container.initDefaultContainers(rootDelta);
+
+ for (int i = 0; i < breakpoints.length; ++i) {
+ container.addBreakpoint(breakpoints[i], rootDelta);
+ }
+
+ return container;
+ }
+
+ /**
+ * Fire model change event for the input.
+ *
+ * @param delta the model delta.
+ * @param select if the viewer selection should change
+ */
+ synchronized private void postModelChanged(final IModelDelta delta, boolean select) {
+ for (int i = 0; fProxies != null && i < fProxies.size(); i++) {
+ fProxies.get(i).postModelChanged(delta, select);
+ }
+ }
+
+
+ }
private class InputDataMap<K, V> extends LinkedHashMap<K, V> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public InputDataMap() {
- super(1, (float)0.75, true);
- }
+ public InputDataMap() {
+ super(1, (float)0.75, true);
+ }
- @Override
+ @Override
protected boolean removeEldestEntry(java.util.Map.Entry<K, V> arg0) {
- InputData data = (InputData)arg0.getValue();
- if (size() > getMaxInputsCache() && data.fProxies.isEmpty()) {
- data.dispose();
- return true;
- }
- return false;
- }
- }
-
- /**
- * Scheduling rule to make sure that breakpoint manager listener updates
- * are process serially.
- */
- private ISchedulingRule fBreakpointsListenerSchedulingRule = new ISchedulingRule() {
-
- @Override
+ InputData data = (InputData)arg0.getValue();
+ if (size() > getMaxInputsCache() && data.fProxies.isEmpty()) {
+ data.dispose();
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Scheduling rule to make sure that breakpoint manager listener updates
+ * are process serially.
+ */
+ private ISchedulingRule fBreakpointsListenerSchedulingRule = new ISchedulingRule() {
+
+ @Override
public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
+ return rule == this;
+ }
- @Override
+ @Override
public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
- };
+ return rule == this;
+ }
+ };
- /**
- * A map of input to info data cache
- */
+ /**
+ * A map of input to info data cache
+ */
final private Map<DefaultBreakpointsViewInput, InputData> fInputToData = Collections.synchronizedMap(new InputDataMap<DefaultBreakpointsViewInput, InputData>());
- /**
- * Flag indicating whether the content provider is currently a breakpoints listener.
- */
- private boolean fIsBreakpointListener = false;
-
- /**
- * The breakpoint manager.
- */
- final private IBreakpointManager fBpManager = DebugPlugin.getDefault().getBreakpointManager();
-
- /**
- * Sub-classes may override this method to filter the breakpoints.
- *
- * @param input the breakpoint manager input.
- * @param selectionFilter the selection to use as filter
- * @param breakpoints the list of breakpoint to filter.
- * @return the filtered list of breakpoint based on the input.
- */
- protected IBreakpoint[] filterBreakpoints(DefaultBreakpointsViewInput input, IStructuredSelection selectionFilter, IBreakpoint[] breakpoints) {
- if (selectionFilter != null && !selectionFilter.isEmpty()) {
+ /**
+ * Flag indicating whether the content provider is currently a breakpoints listener.
+ */
+ private boolean fIsBreakpointListener = false;
+
+ /**
+ * The breakpoint manager.
+ */
+ final private IBreakpointManager fBpManager = DebugPlugin.getDefault().getBreakpointManager();
+
+ /**
+ * Sub-classes may override this method to filter the breakpoints.
+ *
+ * @param input the breakpoint manager input.
+ * @param selectionFilter the selection to use as filter
+ * @param breakpoints the list of breakpoint to filter.
+ * @return the filtered list of breakpoint based on the input.
+ */
+ protected IBreakpoint[] filterBreakpoints(DefaultBreakpointsViewInput input, IStructuredSelection selectionFilter, IBreakpoint[] breakpoints) {
+ if (selectionFilter != null && !selectionFilter.isEmpty()) {
List<IDebugTarget> targets = getDebugTargets(selectionFilter);
ArrayList<IBreakpoint> retVal = new ArrayList<>();
- if (targets != null) {
- for (int i = 0; i < breakpoints.length; ++i) {
- if (supportsBreakpoint(targets, breakpoints[i])) {
+ if (targets != null) {
+ for (int i = 0; i < breakpoints.length; ++i) {
+ if (supportsBreakpoint(targets, breakpoints[i])) {
retVal.add(breakpoints[i]);
}
- }
- }
- return retVal.toArray(new IBreakpoint[retVal.size()]);
- } else {
- return breakpoints;
- }
- }
-
- /**
- * Sub-classes may override this to determine whether the breakpoint is supported by the selection.
- *
- * @param ss the selection of the debug elements.
- * @param breakpoint the breakpoint.
- * @return true if supported.
- */
- protected boolean supportsBreakpoint(IStructuredSelection ss, IBreakpoint breakpoint) {
- return supportsBreakpoint(getDebugTargets(ss), breakpoint);
- }
-
- /**
- * Returns true if the breakpoint contains in one of the targets.
- *
- * @param targets a list of <code>IDebugTarget</code> objects.
- * @param breakpoint the breakpoint.
- * @return true if breakpoint contains in the list of targets.
- */
+ }
+ }
+ return retVal.toArray(new IBreakpoint[retVal.size()]);
+ } else {
+ return breakpoints;
+ }
+ }
+
+ /**
+ * Sub-classes may override this to determine whether the breakpoint is supported by the selection.
+ *
+ * @param ss the selection of the debug elements.
+ * @param breakpoint the breakpoint.
+ * @return true if supported.
+ */
+ protected boolean supportsBreakpoint(IStructuredSelection ss, IBreakpoint breakpoint) {
+ return supportsBreakpoint(getDebugTargets(ss), breakpoint);
+ }
+
+ /**
+ * Returns true if the breakpoint contains in one of the targets.
+ *
+ * @param targets a list of <code>IDebugTarget</code> objects.
+ * @param breakpoint the breakpoint.
+ * @return true if breakpoint contains in the list of targets.
+ */
protected boolean supportsBreakpoint(List<IDebugTarget> targets, IBreakpoint breakpoint) {
- boolean exist = targets.isEmpty() ? true : false;
- for (int i = 0; !exist && i < targets.size(); ++i) {
- IDebugTarget target = targets.get(i);
- exist |= target.supportsBreakpoint(breakpoint);
- }
- return exist;
- }
-
- /**
- * Returns the list of IDebugTarget for the selection.
- *
- * @param ss the selection.
- * @return list of IDebugTarget object.
- */
+ boolean exist = targets.isEmpty() ? true : false;
+ for (int i = 0; !exist && i < targets.size(); ++i) {
+ IDebugTarget target = targets.get(i);
+ exist |= target.supportsBreakpoint(breakpoint);
+ }
+ return exist;
+ }
+
+ /**
+ * Returns the list of IDebugTarget for the selection.
+ *
+ * @param ss the selection.
+ * @return list of IDebugTarget object.
+ */
protected List<IDebugTarget> getDebugTargets(IStructuredSelection ss) {
List<IDebugTarget> debugTargets = new ArrayList<>(2);
- if (ss != null) {
+ if (ss != null) {
Iterator<?> i = ss.iterator();
- while (i.hasNext()) {
- Object next = i.next();
- if (next instanceof IDebugElement) {
- debugTargets.add(((IDebugElement)next).getDebugTarget());
- } else if (next instanceof ILaunch) {
- IDebugTarget[] targets = ((ILaunch)next).getDebugTargets();
- for (int j = 0; j < targets.length; j++) {
- debugTargets.add(targets[j]);
- }
- } else if (next instanceof IProcess) {
- IDebugTarget target = ((IProcess)next).getAdapter(IDebugTarget.class);
- if (target != null) {
- debugTargets.add(target);
- }
- } else if (next instanceof IAdaptable) {
- // Allow non-standard debug model element return an IDebugTarget
- // element that could be used for implementing breakpoint filtering.
- // Bug 333517.
- IDebugTarget target = ((IAdaptable)next).getAdapter(IDebugTarget.class);
- if (target != null) {
- debugTargets.add(target);
- }
- }
- }
- }
- return debugTargets;
- }
-
- /**
- * Maximum number of breakpoint manager input objects that this provider
- * will cache data for. This method is called once upon class creation
- * when setting up the data cache. Sub-classes may override to provide
- * a custom setting.
- *
- * @return Maximum data cache size
- */
- protected int getMaxInputsCache() {
- return 2;
- }
-
- /**
- * Handles the event when a presentation context is disposed.
- * Sub-classes may override to perform additional cleanup.
- *
- * @param context Presentation context that was disposed.
- */
- protected void contextDisposed(IPresentationContext context) {
+ while (i.hasNext()) {
+ Object next = i.next();
+ if (next instanceof IDebugElement) {
+ debugTargets.add(((IDebugElement)next).getDebugTarget());
+ } else if (next instanceof ILaunch) {
+ IDebugTarget[] targets = ((ILaunch)next).getDebugTargets();
+ for (int j = 0; j < targets.length; j++) {
+ debugTargets.add(targets[j]);
+ }
+ } else if (next instanceof IProcess) {
+ IDebugTarget target = ((IProcess)next).getAdapter(IDebugTarget.class);
+ if (target != null) {
+ debugTargets.add(target);
+ }
+ } else if (next instanceof IAdaptable) {
+ // Allow non-standard debug model element return an IDebugTarget
+ // element that could be used for implementing breakpoint filtering.
+ // Bug 333517.
+ IDebugTarget target = ((IAdaptable)next).getAdapter(IDebugTarget.class);
+ if (target != null) {
+ debugTargets.add(target);
+ }
+ }
+ }
+ }
+ return debugTargets;
+ }
+
+ /**
+ * Maximum number of breakpoint manager input objects that this provider
+ * will cache data for. This method is called once upon class creation
+ * when setting up the data cache. Sub-classes may override to provide
+ * a custom setting.
+ *
+ * @return Maximum data cache size
+ */
+ protected int getMaxInputsCache() {
+ return 2;
+ }
+
+ /**
+ * Handles the event when a presentation context is disposed.
+ * Sub-classes may override to perform additional cleanup.
+ *
+ * @param context Presentation context that was disposed.
+ */
+ protected void contextDisposed(IPresentationContext context) {
List<InputData> removed = new ArrayList<>(1);
- synchronized (fInputToData) {
+ synchronized (fInputToData) {
for (Iterator<Entry<DefaultBreakpointsViewInput, InputData>> itr = fInputToData.entrySet().iterator(); itr.hasNext();) {
Map.Entry<DefaultBreakpointsViewInput, InputData> entry = itr.next();
- IPresentationContext entryContext = entry.getKey().getContext();
- if (context.equals(entryContext)) {
- removed.add(entry.getValue());
- itr.remove();
- }
- }
- }
-
- // Dispose the removed input data
- for (int i = 0; i < removed.size(); i++) {
- removed.get(i).dispose();
- }
- }
-
- /**
- * Register the breakpoint manager input with this content provider.
- *
- * @param input the breakpoint manager input to register.
- * @param proxy the model proxy of the input.
- */
- public void registerModelProxy(DefaultBreakpointsViewInput input, BreakpointManagerProxy proxy) {
- synchronized(this) {
- if (!fIsBreakpointListener) {
- fBpManager.addBreakpointListener(this);
- fIsBreakpointListener = true;
- }
- }
- InputData inputData = getInputData(input);
- if (inputData != null) {
- inputData.proxyInstalled(proxy);
- }
- }
-
- /**
- * Unregister the breakpoint manager input with this content provider.
- *
- * @param input the breakpoint manager input to unregister.
- * @param proxy the manager proxy
- */
- public void unregisterModelProxy(DefaultBreakpointsViewInput input, BreakpointManagerProxy proxy) {
- InputData inputData = fInputToData.get(input);
- if (inputData != null) {
- inputData.proxyDisposed(proxy);
-
- if (fInputToData.isEmpty()) {
- synchronized(this) {
- if (fIsBreakpointListener) {
- fBpManager.removeBreakpointListener(this);
- fIsBreakpointListener = false;
- }
- }
- }
- }
- }
-
- private InputData getInputData(DefaultBreakpointsViewInput input) {
- if (Boolean.TRUE.equals(input.getContext().getProperty(IPresentationContext.PROPERTY_DISPOSED)) ) {
- return null;
- }
-
- InputData data = null;
- synchronized (fInputToData) {
- data = fInputToData.get(input);
- if (data == null) {
- data = new InputData(input);
- fInputToData.put(input, data);
- }
- }
- return data;
- }
-
- /**
- * Returns the selection filter for the input.
- *
- * @param input the selection.
- * @param debugContext the current context
- * @return the filtered selection or <code>null</code>
- */
- protected IStructuredSelection getSelectionFilter(Object input, IStructuredSelection debugContext) {
- if (input instanceof DefaultBreakpointsViewInput) {
- IPresentationContext presentation = ((DefaultBreakpointsViewInput)input).getContext();
- if ( Boolean.TRUE.equals(presentation.getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
- return debugContext;
- }
- }
- return null;
- }
-
- @Override
+ IPresentationContext entryContext = entry.getKey().getContext();
+ if (context.equals(entryContext)) {
+ removed.add(entry.getValue());
+ itr.remove();
+ }
+ }
+ }
+
+ // Dispose the removed input data
+ for (int i = 0; i < removed.size(); i++) {
+ removed.get(i).dispose();
+ }
+ }
+
+ /**
+ * Register the breakpoint manager input with this content provider.
+ *
+ * @param input the breakpoint manager input to register.
+ * @param proxy the model proxy of the input.
+ */
+ public void registerModelProxy(DefaultBreakpointsViewInput input, BreakpointManagerProxy proxy) {
+ synchronized(this) {
+ if (!fIsBreakpointListener) {
+ fBpManager.addBreakpointListener(this);
+ fIsBreakpointListener = true;
+ }
+ }
+ InputData inputData = getInputData(input);
+ if (inputData != null) {
+ inputData.proxyInstalled(proxy);
+ }
+ }
+
+ /**
+ * Unregister the breakpoint manager input with this content provider.
+ *
+ * @param input the breakpoint manager input to unregister.
+ * @param proxy the manager proxy
+ */
+ public void unregisterModelProxy(DefaultBreakpointsViewInput input, BreakpointManagerProxy proxy) {
+ InputData inputData = fInputToData.get(input);
+ if (inputData != null) {
+ inputData.proxyDisposed(proxy);
+
+ if (fInputToData.isEmpty()) {
+ synchronized(this) {
+ if (fIsBreakpointListener) {
+ fBpManager.removeBreakpointListener(this);
+ fIsBreakpointListener = false;
+ }
+ }
+ }
+ }
+ }
+
+ private InputData getInputData(DefaultBreakpointsViewInput input) {
+ if (Boolean.TRUE.equals(input.getContext().getProperty(IPresentationContext.PROPERTY_DISPOSED)) ) {
+ return null;
+ }
+
+ InputData data = null;
+ synchronized (fInputToData) {
+ data = fInputToData.get(input);
+ if (data == null) {
+ data = new InputData(input);
+ fInputToData.put(input, data);
+ }
+ }
+ return data;
+ }
+
+ /**
+ * Returns the selection filter for the input.
+ *
+ * @param input the selection.
+ * @param debugContext the current context
+ * @return the filtered selection or <code>null</code>
+ */
+ protected IStructuredSelection getSelectionFilter(Object input, IStructuredSelection debugContext) {
+ if (input instanceof DefaultBreakpointsViewInput) {
+ IPresentationContext presentation = ((DefaultBreakpointsViewInput)input).getContext();
+ if ( Boolean.TRUE.equals(presentation.getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION)) ) {
+ return debugContext;
+ }
+ }
+ return null;
+ }
+
+ @Override
protected boolean supportsContextId(String id) {
- return id.equals(IDebugUIConstants.ID_BREAKPOINT_VIEW);
- }
+ return id.equals(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ }
- @Override
+ @Override
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
- Object input = monitor.getViewerInput();
- if (input instanceof DefaultBreakpointsViewInput) {
- DefaultBreakpointsViewInput bpManagerInput = (DefaultBreakpointsViewInput)input;
- InputData inputData = getInputData(bpManagerInput);
- if (inputData != null) {
- return inputData.fContainer.getChildren().length;
- }
- }
- return 0;
- }
-
- @Override
+ Object input = monitor.getViewerInput();
+ if (input instanceof DefaultBreakpointsViewInput) {
+ DefaultBreakpointsViewInput bpManagerInput = (DefaultBreakpointsViewInput)input;
+ InputData inputData = getInputData(bpManagerInput);
+ if (inputData != null) {
+ return inputData.fContainer.getChildren().length;
+ }
+ }
+ return 0;
+ }
+
+ @Override
protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
- Object input = monitor.getViewerInput();
- if (input instanceof DefaultBreakpointsViewInput) {
- DefaultBreakpointsViewInput bpManagerInput = (DefaultBreakpointsViewInput)input;
- InputData inputData = getInputData(bpManagerInput);
- if (inputData != null) {
- Object[] children = inputData.fContainer.getChildren();
- return getElements(children, index, length);
- }
- }
-
- return EMPTY;
- }
-
- @Override
+ Object input = monitor.getViewerInput();
+ if (input instanceof DefaultBreakpointsViewInput) {
+ DefaultBreakpointsViewInput bpManagerInput = (DefaultBreakpointsViewInput)input;
+ InputData inputData = getInputData(bpManagerInput);
+ if (inputData != null) {
+ Object[] children = inputData.fContainer.getChildren();
+ return getElements(children, index, length);
+ }
+ }
+
+ return EMPTY;
+ }
+
+ @Override
public void breakpointsAdded(final IBreakpoint[] breakpoints) {
- new Job("Breakpoints View Update Job") { //$NON-NLS-1$
- {
- setSystem(true);
- setRule(fBreakpointsListenerSchedulingRule);
- }
+ new Job("Breakpoints View Update Job") { //$NON-NLS-1$
+ {
+ setSystem(true);
+ setRule(fBreakpointsListenerSchedulingRule);
+ }
- @Override
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- InputData[] datas = fInputToData.values().toArray(new InputData[0]);
- for (int i = 0; i < datas.length; i++) {
- datas[i].breakpointsAdded(breakpoints);
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- @Override
+ InputData[] datas = fInputToData.values().toArray(new InputData[0]);
+ for (int i = 0; i < datas.length; i++) {
+ datas[i].breakpointsAdded(breakpoints);
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ @Override
public void breakpointsRemoved(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- new Job("Breakpoints View Update Job") { //$NON-NLS-1$
- {
- setSystem(true);
- setRule(fBreakpointsListenerSchedulingRule);
- }
+ new Job("Breakpoints View Update Job") { //$NON-NLS-1$
+ {
+ setSystem(true);
+ setRule(fBreakpointsListenerSchedulingRule);
+ }
- @Override
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- InputData[] datas = fInputToData.values().toArray(new InputData[0]);
- for (int i = 0; i < datas.length; i++) {
- datas[i].breakpointsRemoved(breakpoints);
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- @Override
+ InputData[] datas = fInputToData.values().toArray(new InputData[0]);
+ for (int i = 0; i < datas.length; i++) {
+ datas[i].breakpointsRemoved(breakpoints);
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ @Override
public void breakpointsChanged(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- new Job("Breakpoints View Update Job") { //$NON-NLS-1$
- {
- setSystem(true);
- setRule(fBreakpointsListenerSchedulingRule);
- }
+ new Job("Breakpoints View Update Job") { //$NON-NLS-1$
+ {
+ setSystem(true);
+ setRule(fBreakpointsListenerSchedulingRule);
+ }
- @Override
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- InputData[] datas = fInputToData.values().toArray(new InputData[0]);
- for (int i = 0; i < datas.length; i++) {
- datas[i].breakpointsChanged(breakpoints);
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- /**
- * Appends the model delta flags to child containers that contains the breakpoint.
- *
- * @param parent the parent container.
- * @param parentDelta the parent model delta.
- * @param flags the model delta flags.
- * @param breakpoint the breakpoint to search in the children containers.
- */
- private void appendModelDelta(BreakpointContainer parent, ModelDelta parentDelta, int flags, IBreakpoint breakpoint) {
- BreakpointContainer[] containers = parent.getContainers();
-
- if (parent.contains(breakpoint)) {
- if ((containers.length != 0)) {
- for (int i = 0; i < containers.length; ++i) {
- ModelDelta nodeDelta = parentDelta.addNode(containers[i], IModelDelta.STATE);
- appendModelDelta(containers[i], nodeDelta, flags, breakpoint);
- }
- } else {
- parentDelta.addNode(breakpoint, flags);
- }
- }
- }
-
- /**
- * Appends the model delta to the first found element in the model delta tree.
- *
- * @param parentDelta the parent delta
- * @param element the element to search
- * @param flags the delta flags
- */
- private void appendModelDeltaToElement(IModelDelta parentDelta, Object element, int flags) {
- if (element.equals(parentDelta.getElement())) {
- ((ModelDelta) parentDelta).setFlags(parentDelta.getFlags() | flags);
- return;
- }
-
- IModelDelta[] childDeltas = parentDelta.getChildDeltas();
- for (int i = 0; i < childDeltas.length; ++i) {
- if (element.equals(childDeltas[i].getElement())) {
- ((ModelDelta) childDeltas[i]).setFlags(childDeltas[i].getFlags() | flags);
- return;
- }
-
- appendModelDeltaToElement(childDeltas[i], element, flags);
- }
- }
+ InputData[] datas = fInputToData.values().toArray(new InputData[0]);
+ for (int i = 0; i < datas.length; i++) {
+ datas[i].breakpointsChanged(breakpoints);
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ /**
+ * Appends the model delta flags to child containers that contains the breakpoint.
+ *
+ * @param parent the parent container.
+ * @param parentDelta the parent model delta.
+ * @param flags the model delta flags.
+ * @param breakpoint the breakpoint to search in the children containers.
+ */
+ private void appendModelDelta(BreakpointContainer parent, ModelDelta parentDelta, int flags, IBreakpoint breakpoint) {
+ BreakpointContainer[] containers = parent.getContainers();
+
+ if (parent.contains(breakpoint)) {
+ if ((containers.length != 0)) {
+ for (int i = 0; i < containers.length; ++i) {
+ ModelDelta nodeDelta = parentDelta.addNode(containers[i], IModelDelta.STATE);
+ appendModelDelta(containers[i], nodeDelta, flags, breakpoint);
+ }
+ } else {
+ parentDelta.addNode(breakpoint, flags);
+ }
+ }
+ }
+
+ /**
+ * Appends the model delta to the first found element in the model delta tree.
+ *
+ * @param parentDelta the parent delta
+ * @param element the element to search
+ * @param flags the delta flags
+ */
+ private void appendModelDeltaToElement(IModelDelta parentDelta, Object element, int flags) {
+ if (element.equals(parentDelta.getElement())) {
+ ((ModelDelta) parentDelta).setFlags(parentDelta.getFlags() | flags);
+ return;
+ }
+
+ IModelDelta[] childDeltas = parentDelta.getChildDeltas();
+ for (int i = 0; i < childDeltas.length; ++i) {
+ if (element.equals(childDeltas[i].getElement())) {
+ ((ModelDelta) childDeltas[i]).setFlags(childDeltas[i].getFlags() | flags);
+ return;
+ }
+
+ appendModelDeltaToElement(childDeltas[i], element, flags);
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java
index 98b6ca432..1d2f3d418 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java
@@ -41,8 +41,8 @@ public class BreakpointMementoProvider extends ElementMementoProvider {
private static final String RESOURCE_PATH = "RESOURCE_PATH"; //$NON-NLS-1$
protected boolean supportsContextId(String id) {
- return IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
- }
+ return IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
+ }
@Override
protected boolean encodeElement(Object element, IMemento memento, IPresentationContext context) throws CoreException {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementLabelProvider.java
index e2b1d0f1d..22543b77f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementLabelProvider.java
@@ -100,13 +100,13 @@ public class DebugElementLabelProvider extends ElementLabelProvider {
return null;
}
- @Override
+ @Override
protected boolean requiresUIJob(ILabelUpdate[] updates) {
- if (updates.length > 0) {
- ILabelUpdate update = updates[0];
+ if (updates.length > 0) {
+ ILabelUpdate update = updates[0];
IPresentationContext context = update.getPresentationContext();
if (context instanceof DebugModelPresentationContext) {
- DebugModelPresentationContext debugContext = (DebugModelPresentationContext) context;
+ DebugModelPresentationContext debugContext = (DebugModelPresentationContext) context;
IDebugModelPresentation presentation = debugContext.getModelPresentation();
if (presentation instanceof IDebugModelPresentationExtension) {
IDebugModelPresentationExtension extension = (IDebugModelPresentationExtension) presentation;
@@ -117,8 +117,8 @@ public class DebugElementLabelProvider extends ElementLabelProvider {
}
}
}
- }
+ }
return false;
- }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementMementoProvider.java
index e570ea6dd..726b8b9e6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementMementoProvider.java
@@ -48,34 +48,34 @@ public abstract class DebugElementMementoProvider extends ElementMementoProvider
return false;
}
- /**
- * Returns whether this adapter supports the given context.
- *
- * @param context
- * @return whether this adapter supports the given context
- */
- protected boolean supportsContext(IPresentationContext context) {
+ /**
+ * Returns whether this adapter supports the given context.
+ *
+ * @param context
+ * @return whether this adapter supports the given context
+ */
+ protected boolean supportsContext(IPresentationContext context) {
return supportsContextId(context.getId());
- }
+ }
- /**
- * Returns whether this adapter provides content in the specified context id.
- *
- * @param id part id
- * @return whether this adapter provides content in the specified context id
- */
- protected boolean supportsContextId(String id) {
- return true;
- }
+ /**
+ * Returns whether this adapter provides content in the specified context id.
+ *
+ * @param id part id
+ * @return whether this adapter provides content in the specified context id
+ */
+ protected boolean supportsContextId(String id) {
+ return true;
+ }
- /**
- * Returns the name of the given element to use in a memento in the given context,
- * or <code>null</code> if unsupported.
- *
- * @param element model element
- * @param context presentation context
- * @return element name or <code>null</code> if none
- * @throws CoreException
- */
- protected abstract String getElementName(Object element, IPresentationContext context) throws CoreException;
+ /**
+ * Returns the name of the given element to use in a memento in the given context,
+ * or <code>null</code> if unsupported.
+ *
+ * @param element model element
+ * @param context presentation context
+ * @return element name or <code>null</code> if none
+ * @throws CoreException
+ */
+ protected abstract String getElementName(Object element, IPresentationContext context) throws CoreException;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugTargetContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugTargetContentProvider.java
index ff86c59dd..d00ef9e8b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugTargetContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugTargetContentProvider.java
@@ -80,15 +80,15 @@ public class DebugTargetContentProvider extends ElementContentProvider {
return ((IDebugTarget)parent).getThreads();
}
else if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW))
- {
+ {
if (parent instanceof IMemoryBlockRetrieval)
{
if (((IMemoryBlockRetrieval)parent).supportsStorageRetrieval()) {
return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent);
}
}
- }
- return EMPTY;
+ }
+ return EMPTY;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java
index fcb88ff2a..911adc741 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java
@@ -86,12 +86,12 @@ public abstract class ElementContentProvider implements IElementContentProvider
job.schedule();
}
- /**
- * Computes the children for the given parent in the specified context.
- *
- * @param update update request
- */
- protected void retrieveChildren(IChildrenUpdate update) {
+ /**
+ * Computes the children for the given parent in the specified context.
+ *
+ * @param update update request
+ */
+ protected void retrieveChildren(IChildrenUpdate update) {
if (!update.isCanceled()) {
IStatus status = Status.OK_STATUS;
try {
@@ -110,16 +110,16 @@ public abstract class ElementContentProvider implements IElementContentProvider
}
update.setStatus(status);
}
- }
+ }
- /**
- * Computes whether the given element is a container.
- *
- * @param parent potential parent
- * @param context presentation context
- * @param monitor result to report to
- */
- protected void retrieveChildCount(IChildrenCountUpdate update) {
+ /**
+ * Computes whether the given element is a container.
+ *
+ * @param parent potential parent
+ * @param context presentation context
+ * @param monitor result to report to
+ */
+ protected void retrieveChildCount(IChildrenCountUpdate update) {
if (!update.isCanceled()) {
IStatus status = Status.OK_STATUS;
try {
@@ -137,70 +137,70 @@ public abstract class ElementContentProvider implements IElementContentProvider
}
update.setStatus(status);
}
- }
+ }
- /**
- * Returns the children for the given parent at the specified index in the specified context
- * or <code>null</code> if none.
- *
- * @param parent element to retrieve children for
- * @param index child index
- * @param length number of children to retrieve
- * @param context context children will be presented in
- * @return child or <code>null</code>
- * @throws CoreException if an exception occurs retrieving child
- */
- protected abstract Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException;
+ /**
+ * Returns the children for the given parent at the specified index in the specified context
+ * or <code>null</code> if none.
+ *
+ * @param parent element to retrieve children for
+ * @param index child index
+ * @param length number of children to retrieve
+ * @param context context children will be presented in
+ * @return child or <code>null</code>
+ * @throws CoreException if an exception occurs retrieving child
+ */
+ protected abstract Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException;
- /**
- * Returns the number of children for the given element.
- *
- * @param elementPath element that may have children
- * @param context context element will be presented in
- * @return number of children
- * @throws CoreException if an exception occurs determining child count
- */
- protected abstract int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException;
+ /**
+ * Returns the number of children for the given element.
+ *
+ * @param elementPath element that may have children
+ * @param context context element will be presented in
+ * @return number of children
+ * @throws CoreException if an exception occurs determining child count
+ */
+ protected abstract int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException;
- /**
- * Returns whether this adapter supports the given context.
- *
- * @param context
- * @return whether this adapter supports the given context
- */
- protected boolean supportsContext(IPresentationContext context) {
+ /**
+ * Returns whether this adapter supports the given context.
+ *
+ * @param context
+ * @return whether this adapter supports the given context
+ */
+ protected boolean supportsContext(IPresentationContext context) {
return supportsContextId(context.getId());
- }
+ }
- /**
- * Returns whether this adapter provides content in the specified context id.
- *
- * @param id part id
- * @return whether this adapter provides content in the specified context id
- */
- protected abstract boolean supportsContextId(String id);
+ /**
+ * Returns whether this adapter provides content in the specified context id.
+ *
+ * @param id part id
+ * @return whether this adapter provides content in the specified context id
+ */
+ protected abstract boolean supportsContextId(String id);
- /**
- * Returns the range of elements from <code>index</code> to <code>index + length</code>
- * or <code>null</code> if the index and range is outside the bounds of the original element array.
- *
- * @param elements the original element array
- * @param index the initial index to start copying from
- * @param length the number of elements we want to copy into the returned array
- * @return element or <code>null</code>
- */
- protected Object[] getElements(Object[] elements, int index, int length) {
- int max = elements.length;
- if (index < max && ((index + length) > max)) {
- length = max - index;
- }
- if ((index + length) <= elements.length) {
- Object[] sub = new Object[length];
- System.arraycopy(elements, index, sub, 0, length);
- return sub;
- }
- return null;
- }
+ /**
+ * Returns the range of elements from <code>index</code> to <code>index + length</code>
+ * or <code>null</code> if the index and range is outside the bounds of the original element array.
+ *
+ * @param elements the original element array
+ * @param index the initial index to start copying from
+ * @param length the number of elements we want to copy into the returned array
+ * @return element or <code>null</code>
+ */
+ protected Object[] getElements(Object[] elements, int index, int length) {
+ int max = elements.length;
+ if (index < max && ((index + length) > max)) {
+ length = max - index;
+ }
+ if ((index + length) <= elements.length) {
+ Object[] sub = new Object[length];
+ System.arraycopy(elements, index, sub, 0, length);
+ return sub;
+ }
+ return null;
+ }
@Override
public void update(final IHasChildrenUpdate[] updates) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java
index f2a85ac35..ad2232401 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java
@@ -203,10 +203,10 @@ public abstract class ElementLabelProvider implements IElementLabelProvider {
update.setForeground(getForeground(elementPath, presentationContext, columnId), i);
update.setFontData(getFontData(elementPath, presentationContext, columnId), i);
if (update instanceof ICheckUpdate &&
- Boolean.TRUE.equals(presentationContext.getProperty(ICheckUpdate.PROP_CHECK)))
+ Boolean.TRUE.equals(presentationContext.getProperty(ICheckUpdate.PROP_CHECK)))
{
((ICheckUpdate) update).setChecked(
- getChecked(elementPath, presentationContext), getGrayed(elementPath, presentationContext));
+ getChecked(elementPath, presentationContext), getGrayed(elementPath, presentationContext));
}
}
}
@@ -300,11 +300,11 @@ public abstract class ElementLabelProvider implements IElementLabelProvider {
/**
* Returns the checked state for the given path.
*
- * @param path Path of the element to retrieve the grayed state for.
- * @param presentationContext Presentation context where the element is
- * displayed.
- * @return <code>true<code> if the element check box should be checked
- * @throws CoreException
+ * @param path Path of the element to retrieve the grayed state for.
+ * @param presentationContext Presentation context where the element is
+ * displayed.
+ * @return <code>true<code> if the element check box should be checked
+ * @throws CoreException
*
* @since 3.6
*/
@@ -316,18 +316,18 @@ public abstract class ElementLabelProvider implements IElementLabelProvider {
* Returns the grayed state for the given path.
*
* @param path Path of the element to retrieve the grayed state for.
- * @param presentationContext Presentation context where the element is
- * displayed.
+ * @param presentationContext Presentation context where the element is
+ * displayed.
* @return <code>true<code> if the element check box should be grayed
* @throws CoreException
- *
- * @since 3.6
+ *
+ * @since 3.6
*/
protected boolean getGrayed(TreePath path, IPresentationContext presentationContext) throws CoreException {
return false;
}
- @Override
+ @Override
public synchronized void update(ILabelUpdate[] updates) {
if (fLabelJob == null) {
fLabelJob = newLabelJob(updates);
@@ -340,39 +340,39 @@ public abstract class ElementLabelProvider implements IElementLabelProvider {
fLabelJob.schedule();
}
- /**
- * Returns a new <code>Job</code> to update the specified labels. This method
- * is used to determine if a UI job is needed or not, in the event the request for an update
- * job has come from a non-UI thread.
- * @param updates an array of pending label updates
- * @return a new <code>Job</code> to update labels with.
- */
- private Job newLabelJob(ILabelUpdate[] updates) {
- if (requiresUIJob(updates)) {
+ /**
+ * Returns a new <code>Job</code> to update the specified labels. This method
+ * is used to determine if a UI job is needed or not, in the event the request for an update
+ * job has come from a non-UI thread.
+ * @param updates an array of pending label updates
+ * @return a new <code>Job</code> to update labels with.
+ */
+ private Job newLabelJob(ILabelUpdate[] updates) {
+ if (requiresUIJob(updates)) {
return new UILabelJob();
} else {
return new LabelJob();
}
- }
-
- /**
- * Returns whether a UI job should be used for updates versus a non-UI job.
- * @param updates
- * @return true if the array of updates requires a UI job to update the labels, false otherwise
- */
- protected boolean requiresUIJob(ILabelUpdate[] updates) {
- return false;
- }
-
- /**
- * Returns the scheduling rule for the given update or <code>null</code>
- * it none.
- *
- * @param update label update
- * @return associated scheduling rule, or <code>null</code>
- */
- protected ISchedulingRule getRule(ILabelUpdate update) {
- return null;
- }
+ }
+
+ /**
+ * Returns whether a UI job should be used for updates versus a non-UI job.
+ * @param updates
+ * @return true if the array of updates requires a UI job to update the labels, false otherwise
+ */
+ protected boolean requiresUIJob(ILabelUpdate[] updates) {
+ return false;
+ }
+
+ /**
+ * Returns the scheduling rule for the given update or <code>null</code>
+ * it none.
+ *
+ * @param update label update
+ * @return associated scheduling rule, or <code>null</code>
+ */
+ protected ISchedulingRule getRule(ILabelUpdate update) {
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
index 503587a70..2d3ea7646 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java
@@ -45,46 +45,46 @@ import org.eclipse.swt.graphics.FontData;
*/
public class ExpressionContentProvider extends VariableContentProvider {
- /**
- * @since 3.6
- * Element object used to wrap the expression error message. It displays
- * the error message only in the first column if columns are visible.
- */
- private static class ErrorMessageElement implements IElementLabelProvider {
+ /**
+ * @since 3.6
+ * Element object used to wrap the expression error message. It displays
+ * the error message only in the first column if columns are visible.
+ */
+ private static class ErrorMessageElement implements IElementLabelProvider {
- public ErrorMessageElement(String message) {
- fMessage = message;
- }
+ public ErrorMessageElement(String message) {
+ fMessage = message;
+ }
- private final String fMessage;
+ private final String fMessage;
- @Override
+ @Override
public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String[] columnIds = updates[i].getColumnIds();
- if (columnIds == null) {
- updateLabel(updates[i], 0);
- } else {
- for (int j = 0; j < columnIds.length; j++) {
- if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
- updateLabel(updates[i], j);
- } else {
- updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
- }
- }
- }
-
- updates[i].done();
- }
- }
-
- private void updateLabel(ILabelUpdate update, int columnIndex) {
- update.setLabel(fMessage, columnIndex);
- FontData fontData = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0];
- fontData.setStyle(SWT.ITALIC);
-
- }
- }
+ for (int i = 0; i < updates.length; i++) {
+ String[] columnIds = updates[i].getColumnIds();
+ if (columnIds == null) {
+ updateLabel(updates[i], 0);
+ } else {
+ for (int j = 0; j < columnIds.length; j++) {
+ if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
+ updateLabel(updates[i], j);
+ } else {
+ updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
+ }
+ }
+ }
+
+ updates[i].done();
+ }
+ }
+
+ private void updateLabel(ILabelUpdate update, int columnIndex) {
+ update.setLabel(fMessage, columnIndex);
+ FontData fontData = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0];
+ fontData.setStyle(SWT.ITALIC);
+
+ }
+ }
@Override
public void update(IChildrenCountUpdate[] updates) {
@@ -169,25 +169,25 @@ public class ExpressionContentProvider extends VariableContentProvider {
@Override
protected Object[] getAllChildren(Object parent, IPresentationContext context) throws CoreException {
- if (parent instanceof IErrorReportingExpression) {
- IErrorReportingExpression expression = (IErrorReportingExpression) parent;
- if (expression.hasErrors()) {
- String[] messages = expression.getErrorMessages();
+ if (parent instanceof IErrorReportingExpression) {
+ IErrorReportingExpression expression = (IErrorReportingExpression) parent;
+ if (expression.hasErrors()) {
+ String[] messages = expression.getErrorMessages();
LinkedHashSet<ErrorMessageElement> set = new LinkedHashSet<>(messages.length);
- for (int i = 0; i < messages.length; i++) {
+ for (int i = 0; i < messages.length; i++) {
set.add(new ErrorMessageElement(messages[i]));
}
- return set.toArray();
- }
- }
- if (parent instanceof IExpression) {
- IExpression expression = (IExpression) parent;
- IValue value = expression.getValue();
- if (value != null) {
- return getValueChildren(expression, value, context);
- }
- }
- return EMPTY;
+ return set.toArray();
+ }
+ }
+ if (parent instanceof IExpression) {
+ IExpression expression = (IExpression) parent;
+ IValue value = expression.getValue();
+ if (value != null) {
+ return getValueChildren(expression, value, context);
+ }
+ }
+ return EMPTY;
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionLabelProvider.java
index f0457c5db..371689c8d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionLabelProvider.java
@@ -34,135 +34,135 @@ public class ExpressionLabelProvider extends VariableLabelProvider {
@Override
protected RGB getForeground(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException {
Object element = elementPath.getLastSegment();
- if (element instanceof IErrorReportingExpression) {
- IErrorReportingExpression expression = (IErrorReportingExpression) element;
- if (expression.hasErrors()) {
- if (columnId == null || columnId.equals(IDebugUIConstants.COLUMN_ID_VARIABLE_VALUE)) {
- return new RGB(255, 0, 0);
- }
- }
- }
+ if (element instanceof IErrorReportingExpression) {
+ IErrorReportingExpression expression = (IErrorReportingExpression) element;
+ if (expression.hasErrors()) {
+ if (columnId == null || columnId.equals(IDebugUIConstants.COLUMN_ID_VARIABLE_VALUE)) {
+ return new RGB(255, 0, 0);
+ }
+ }
+ }
return super.getForeground(elementPath, presentationContext, columnId);
}
- @Override
+ @Override
protected String getLabel(TreePath elementPath, IPresentationContext context, String columnId) throws CoreException {
- if (columnId == null) {
- return super.getLabel(elementPath, context, columnId);
- } else {
- IExpression expression = (IExpression) elementPath.getLastSegment();
- IValue value = expression.getValue();
- return getColumnText(expression, value, context, columnId);
- }
- }
+ if (columnId == null) {
+ return super.getLabel(elementPath, context, columnId);
+ } else {
+ IExpression expression = (IExpression) elementPath.getLastSegment();
+ IValue value = expression.getValue();
+ return getColumnText(expression, value, context, columnId);
+ }
+ }
- /**
- * Returns text for a specific columns for the expression/value.
- *
- * @param expression expression to retrieve text for
- * @param value the value associated with the variable
- * @param context presentation context specifying how to display the text
- * @param columnId the column to get the text for
- * @return the label text
- * @throws CoreException Error while retrieving data from model.
- *
- * @since 3.6
- */
- private String getColumnText(IExpression expression, IValue value, IPresentationContext context, String columnId) throws CoreException {
- if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnId)) {
- return getExpressionName(expression, context);
- } else if (IDebugUIConstants.COLUMN_ID_VARIABLE_VALUE.equals(columnId)) {
- return getExpressionValueText(expression, value, context);
- } else if (IDebugUIConstants.COLUMN_ID_VARIABLE_TYPE.equals(columnId) ||
- IDebugUIConstants.COLUMN_ID_VARIABLE_VALUE_TYPE.equals(columnId))
- {
- if (value != null) {
- return getValueTypeName(null, value, context);
- }
- }
- return null;
- }
+ /**
+ * Returns text for a specific columns for the expression/value.
+ *
+ * @param expression expression to retrieve text for
+ * @param value the value associated with the variable
+ * @param context presentation context specifying how to display the text
+ * @param columnId the column to get the text for
+ * @return the label text
+ * @throws CoreException Error while retrieving data from model.
+ *
+ * @since 3.6
+ */
+ private String getColumnText(IExpression expression, IValue value, IPresentationContext context, String columnId) throws CoreException {
+ if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnId)) {
+ return getExpressionName(expression, context);
+ } else if (IDebugUIConstants.COLUMN_ID_VARIABLE_VALUE.equals(columnId)) {
+ return getExpressionValueText(expression, value, context);
+ } else if (IDebugUIConstants.COLUMN_ID_VARIABLE_TYPE.equals(columnId) ||
+ IDebugUIConstants.COLUMN_ID_VARIABLE_VALUE_TYPE.equals(columnId))
+ {
+ if (value != null) {
+ return getValueTypeName(null, value, context);
+ }
+ }
+ return null;
+ }
- /**
- * Returns the expression's text to show in the view's name column.
- *
- * @param expression expression to retrieve text for
- * @param context presentation context specifying how to display the text
- * @return Returns the expression's text to show in the view's name column.
- * @exception CoreException in an error occurs
- * @since 3.6
- */
- protected String getExpressionName(IExpression expression, IPresentationContext context) throws CoreException {
- if (expression instanceof IWatchExpression) {
- return getWatchExpressionName((IWatchExpression) expression, context);
- }
- return expression.getExpressionText();
- }
+ /**
+ * Returns the expression's text to show in the view's name column.
+ *
+ * @param expression expression to retrieve text for
+ * @param context presentation context specifying how to display the text
+ * @return Returns the expression's text to show in the view's name column.
+ * @exception CoreException in an error occurs
+ * @since 3.6
+ */
+ protected String getExpressionName(IExpression expression, IPresentationContext context) throws CoreException {
+ if (expression instanceof IWatchExpression) {
+ return getWatchExpressionName((IWatchExpression) expression, context);
+ }
+ return expression.getExpressionText();
+ }
- /**
- * Returns the watch expression's text to show in the view's name column.
- *
- * @param expression the expression
- * @param context associated presentation context
- * @return Returns the watch expression's text to show in the view's name column.
- * @since 3.6
- */
- private String getWatchExpressionName(IWatchExpression expression, IPresentationContext context) {
- StringBuilder result= new StringBuilder();
+ /**
+ * Returns the watch expression's text to show in the view's name column.
+ *
+ * @param expression the expression
+ * @param context associated presentation context
+ * @return Returns the watch expression's text to show in the view's name column.
+ * @since 3.6
+ */
+ private String getWatchExpressionName(IWatchExpression expression, IPresentationContext context) {
+ StringBuilder result= new StringBuilder();
- String snippet = expression.getExpressionText().trim();
- StringBuilder snippetBuffer = new StringBuilder();
+ String snippet = expression.getExpressionText().trim();
+ StringBuilder snippetBuffer = new StringBuilder();
if (snippet.length() > 254) {
snippetBuffer.append(snippet.substring(0, 127));
- snippetBuffer.append(DebugUIMessages.DefaultLabelProvider_0);
+ snippetBuffer.append(DebugUIMessages.DefaultLabelProvider_0);
snippetBuffer.append(snippet.substring(snippet.length() - 127));
- } else {
- snippetBuffer.append(snippet);
- }
- snippet = snippetBuffer.toString().replaceAll("[\n\r\t]+", " "); //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ snippetBuffer.append(snippet);
+ }
+ snippet = snippetBuffer.toString().replaceAll("[\n\r\t]+", " "); //$NON-NLS-1$//$NON-NLS-2$
- result.append('"');
- result.append(snippet);
- result.append('"');
+ result.append('"');
+ result.append(snippet);
+ result.append('"');
- return result.toString();
- }
+ return result.toString();
+ }
- /**
- * Returns the expression's value, or a message to show in the value column,
- * if the value is not available.
- *
- * @param expression expression to retrieve text for
- * @param value the value associated with the variable
- * @param context presentation context specifying how to display the text
- * @return string representing the expression's value
- * @throws CoreException Error while retrieving data from model.
- *
- * @since 3.6
- */
- protected String getExpressionValueText(IExpression expression, IValue value, IPresentationContext context) throws CoreException {
- if (expression instanceof IWatchExpression) {
- IWatchExpression watchExpression = (IWatchExpression)expression;
- StringBuilder result = new StringBuilder();
+ /**
+ * Returns the expression's value, or a message to show in the value column,
+ * if the value is not available.
+ *
+ * @param expression expression to retrieve text for
+ * @param value the value associated with the variable
+ * @param context presentation context specifying how to display the text
+ * @return string representing the expression's value
+ * @throws CoreException Error while retrieving data from model.
+ *
+ * @since 3.6
+ */
+ protected String getExpressionValueText(IExpression expression, IValue value, IPresentationContext context) throws CoreException {
+ if (expression instanceof IWatchExpression) {
+ IWatchExpression watchExpression = (IWatchExpression)expression;
+ StringBuilder result = new StringBuilder();
if (watchExpression.isPending() && value == null) {
- result.append(DebugUIMessages.DefaultLabelProvider_12);
- } else if (watchExpression.hasErrors()) {
- result.append(DebugUIMessages.DefaultLabelProvider_13);
- } else if (value != null) {
- result.append( getValueText(null, value, context) );
- }
- if (!watchExpression.isEnabled()) {
- result.append(DebugUIMessages.DefaultLabelProvider_15);
- }
+ result.append(DebugUIMessages.DefaultLabelProvider_12);
+ } else if (watchExpression.hasErrors()) {
+ result.append(DebugUIMessages.DefaultLabelProvider_13);
+ } else if (value != null) {
+ result.append( getValueText(null, value, context) );
+ }
+ if (!watchExpression.isEnabled()) {
+ result.append(DebugUIMessages.DefaultLabelProvider_15);
+ }
- return result.toString();
- }
+ return result.toString();
+ }
- if (value != null) {
- return getValueText(null, value, context);
- }
- return null;
- }
+ if (value != null) {
+ return getValueText(null, value, context);
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
index 096df5360..a6b124150 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java
@@ -45,110 +45,110 @@ import org.eclipse.swt.widgets.Composite;
*/
public class ExpressionManagerContentProvider extends ElementContentProvider {
- /**
- * An element representing the "Add new expression" entry in the
- * expressions view.
- *
- * @since 3.6
- */
- private static class AddNewExpressionElement implements IElementLabelProvider, IElementEditor, ICellModifier {
-
- @Override
+ /**
+ * An element representing the "Add new expression" entry in the
+ * expressions view.
+ *
+ * @since 3.6
+ */
+ private static class AddNewExpressionElement implements IElementLabelProvider, IElementEditor, ICellModifier {
+
+ @Override
public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String[] columnIds = updates[i].getColumnIds();
- if (columnIds == null) {
- updateLabel(updates[i], 0);
- } else {
- for (int j = 0; j < columnIds.length; j++) {
- if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
- updateLabel(updates[i], j);
- } else {
- updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
- }
- }
- }
-
- updates[i].done();
- }
- }
+ for (int i = 0; i < updates.length; i++) {
+ String[] columnIds = updates[i].getColumnIds();
+ if (columnIds == null) {
+ updateLabel(updates[i], 0);
+ } else {
+ for (int j = 0; j < columnIds.length; j++) {
+ if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
+ updateLabel(updates[i], j);
+ } else {
+ updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
+ }
+ }
+ }
+
+ updates[i].done();
+ }
+ }
@SuppressWarnings("deprecation")
private void updateLabel(ILabelUpdate update, int columnIndex) {
- update.setLabel(DebugUIMessages.ExpressionManagerContentProvider_1, columnIndex);
- update.setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_MONITOR_EXPRESSION), columnIndex);
+ update.setLabel(DebugUIMessages.ExpressionManagerContentProvider_1, columnIndex);
+ update.setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_MONITOR_EXPRESSION), columnIndex);
- // Display the "Add new expression" element in italic to
- // distinguish it from user elements in view.
- FontData fontData = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0];
- fontData.setStyle(SWT.ITALIC);
- update.setFontData(fontData, columnIndex);
- }
+ // Display the "Add new expression" element in italic to
+ // distinguish it from user elements in view.
+ FontData fontData = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT).getFontData()[0];
+ fontData.setStyle(SWT.ITALIC);
+ update.setFontData(fontData, columnIndex);
+ }
- @Override
+ @Override
public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) {
- return new TextCellEditor(parent);
- }
+ return new TextCellEditor(parent);
+ }
- @Override
+ @Override
public ICellModifier getCellModifier(IPresentationContext context, Object element) {
- return this;
- }
+ return this;
+ }
- @Override
+ @Override
public boolean canModify(Object element, String property) {
- return (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(property));
- }
+ return (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(property));
+ }
- @Override
+ @Override
public Object getValue(Object element, String property) {
- return IInternalDebugCoreConstants.EMPTY_STRING;
- }
+ return IInternalDebugCoreConstants.EMPTY_STRING;
+ }
- @Override
+ @Override
public void modify(Object element, String property, Object value) {
- // If an expression is entered, add a new watch expression to the
- // manager.
- if (value instanceof String &&
- !IInternalDebugCoreConstants.EMPTY_STRING.equals( ((String)value).trim()) )
- {
- String expressionText = DefaultLabelProvider.encodeEsacpedChars((String)value);
- IWatchExpression newExpression=
- DebugPlugin.getDefault().getExpressionManager().newWatchExpression(expressionText);
- DebugPlugin.getDefault().getExpressionManager().addExpression(newExpression);
- newExpression.setExpressionContext(getContext());
- }
- }
-
- private IDebugElement getContext() {
- IAdaptable object = DebugUITools.getDebugContext();
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- return context;
- }
-
- }
-
- private static final AddNewExpressionElement ADD_NEW_EXPRESSION_ELEMENT = new AddNewExpressionElement();
+ // If an expression is entered, add a new watch expression to the
+ // manager.
+ if (value instanceof String &&
+ !IInternalDebugCoreConstants.EMPTY_STRING.equals( ((String)value).trim()) )
+ {
+ String expressionText = DefaultLabelProvider.encodeEsacpedChars((String)value);
+ IWatchExpression newExpression=
+ DebugPlugin.getDefault().getExpressionManager().newWatchExpression(expressionText);
+ DebugPlugin.getDefault().getExpressionManager().addExpression(newExpression);
+ newExpression.setExpressionContext(getContext());
+ }
+ }
+
+ private IDebugElement getContext() {
+ IAdaptable object = DebugUITools.getDebugContext();
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ return context;
+ }
+
+ }
+
+ private static final AddNewExpressionElement ADD_NEW_EXPRESSION_ELEMENT = new AddNewExpressionElement();
@Override
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
- // Add the "Add new expression" element only if columns are displayed.
+ // Add the "Add new expression" element only if columns are displayed.
return ((IExpressionManager) element).getExpressions().length +
- (context.getColumns() != null ? 1 : 0);
+ (context.getColumns() != null ? 1 : 0);
}
@Override
protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
- if (context.getColumns() != null) {
- return getElements(((IExpressionManager) parent).getExpressions(), ADD_NEW_EXPRESSION_ELEMENT, index, length);
- } else {
- return getElements(((IExpressionManager) parent).getExpressions(), index, length);
- }
+ if (context.getColumns() != null) {
+ return getElements(((IExpressionManager) parent).getExpressions(), ADD_NEW_EXPRESSION_ELEMENT, index, length);
+ } else {
+ return getElements(((IExpressionManager) parent).getExpressions(), index, length);
+ }
}
/**
@@ -158,22 +158,22 @@ public class ExpressionManagerContentProvider extends ElementContentProvider {
*
* @since 3.6
*/
- private Object[] getElements(Object[] elements, Object lastElement, int index, int length) {
-
- int max = elements.length + 1;
- if (index < max && ((index + length) > max)) {
- length = max - index;
- }
- if ((index + length) <= max) {
- Object[] sub = new Object[length];
- System.arraycopy(elements, index, sub, 0, Math.min(elements.length - index, length));
- if (index + length > elements.length) {
- sub[length - 1] = lastElement;
- }
- return sub;
- }
- return null;
- }
+ private Object[] getElements(Object[] elements, Object lastElement, int index, int length) {
+
+ int max = elements.length + 1;
+ if (index < max && ((index + length) > max)) {
+ length = max - index;
+ }
+ if ((index + length) <= max) {
+ Object[] sub = new Object[length];
+ System.arraycopy(elements, index, sub, 0, Math.min(elements.length - index, length));
+ if (index + length > elements.length) {
+ sub[length - 1] = lastElement;
+ }
+ return sub;
+ }
+ return null;
+ }
@Override
protected boolean supportsContextId(String id) {
@@ -182,7 +182,7 @@ public class ExpressionManagerContentProvider extends ElementContentProvider {
@Override
protected boolean hasChildren(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
- return true;
+ return true;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/MemoryRetrievalContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/MemoryRetrievalContentProvider.java
index c6c90eaa5..3147c1e13 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/MemoryRetrievalContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/MemoryRetrievalContentProvider.java
@@ -48,14 +48,14 @@ public class MemoryRetrievalContentProvider extends ElementContentProvider {
protected Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor) {
String id = context.getId();
if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW))
- {
+ {
if (parent instanceof IMemoryBlockRetrieval)
{
if (((IMemoryBlockRetrieval)parent).supportsStorageRetrieval())
- return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent);
+ return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent);
}
- }
- return EMPTY;
+ }
+ return EMPTY;
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/StackFrameContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/StackFrameContentProvider.java
index 74b251fc1..4ebbf85c3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/StackFrameContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/StackFrameContentProvider.java
@@ -44,17 +44,17 @@ public class StackFrameContentProvider extends ElementContentProvider {
*/
protected Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
if (parent instanceof IStackFrame) {
- String id = context.getId();
- IStackFrame frame = (IStackFrame) parent;
- if (id.equals(IDebugUIConstants.ID_VARIABLE_VIEW)) {
- return frame.getVariables();
- } else if (id.equals(IDebugUIConstants.ID_REGISTER_VIEW)) {
- return frame.getRegisterGroups();
- }
+ String id = context.getId();
+ IStackFrame frame = (IStackFrame) parent;
+ if (id.equals(IDebugUIConstants.ID_VARIABLE_VIEW)) {
+ return frame.getVariables();
+ } else if (id.equals(IDebugUIConstants.ID_REGISTER_VIEW)) {
+ return frame.getRegisterGroups();
+ }
} else {
monitor.cancel();
}
- return EMPTY;
+ return EMPTY;
}
@Override
@@ -65,13 +65,13 @@ public class StackFrameContentProvider extends ElementContentProvider {
@Override
protected boolean hasChildren(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
String id = context.getId();
- IStackFrame frame = (IStackFrame) element;
- if (id.equals(IDebugUIConstants.ID_VARIABLE_VIEW)) {
- return frame.hasVariables();
- } else if (id.equals(IDebugUIConstants.ID_REGISTER_VIEW)) {
- return frame.hasRegisterGroups();
- }
- return false;
+ IStackFrame frame = (IStackFrame) element;
+ if (id.equals(IDebugUIConstants.ID_VARIABLE_VIEW)) {
+ return frame.hasVariables();
+ } else if (id.equals(IDebugUIConstants.ID_REGISTER_VIEW)) {
+ return frame.hasRegisterGroups();
+ }
+ return false;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java
index 1d2be2c0d..cf873622b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java
@@ -72,168 +72,168 @@ public class VariableContentProvider extends ElementContentProvider {
* @throws CoreException
*/
protected Object[] getAllChildren(Object parent, IPresentationContext context) throws CoreException {
- IVariable variable = (IVariable) parent;
- IValue value = variable.getValue();
- if (value != null) {
- return getValueChildren(variable, value, context);
- }
- return EMPTY;
+ IVariable variable = (IVariable) parent;
+ IValue value = variable.getValue();
+ if (value != null) {
+ return getValueChildren(variable, value, context);
+ }
+ return EMPTY;
}
- /**
- * Return whether to show compute a logical structure or a raw structure
- * in the specified context
- *
- * @return whether to show compute a logical structure or a raw structure
- * in the specified context
- */
- protected boolean isShowLogicalStructure(IPresentationContext context) {
- Boolean show = (Boolean) context.getProperty(VariablesView.PRESENTATION_SHOW_LOGICAL_STRUCTURES);
- return show != null && show.booleanValue();
- }
+ /**
+ * Return whether to show compute a logical structure or a raw structure
+ * in the specified context
+ *
+ * @return whether to show compute a logical structure or a raw structure
+ * in the specified context
+ */
+ protected boolean isShowLogicalStructure(IPresentationContext context) {
+ Boolean show = (Boolean) context.getProperty(VariablesView.PRESENTATION_SHOW_LOGICAL_STRUCTURES);
+ return show != null && show.booleanValue();
+ }
- /**
- * Returns the number of entries that should be displayed in each partition
- * of an indexed collection.
- *
- * @return the number of entries that should be displayed in each partition
- * of an indexed collection
- */
- protected int getArrayPartitionSize() {
- // TODO: should fix this with a user preference
- return 100;
- }
+ /**
+ * Returns the number of entries that should be displayed in each partition
+ * of an indexed collection.
+ *
+ * @return the number of entries that should be displayed in each partition
+ * of an indexed collection
+ */
+ protected int getArrayPartitionSize() {
+ // TODO: should fix this with a user preference
+ return 100;
+ }
- /**
- * Returns any logical value for the raw value in the specified context
- *
- * @param value
- * @param context
- * @return logical value for the raw value
- */
- protected IValue getLogicalValue(IValue value, IPresentationContext context) throws CoreException {
+ /**
+ * Returns any logical value for the raw value in the specified context
+ *
+ * @param value
+ * @param context
+ * @return logical value for the raw value
+ */
+ protected IValue getLogicalValue(IValue value, IPresentationContext context) throws CoreException {
return getLogicalValue(value, new ArrayList<String>(), context);
- }
+ }
- /**
- * Returns children for the given value, creating array partitions if
- * required
- *
- * @param parent expression or variable containing the given value
- * @param value the value to retrieve children for
- * @param context the context in which children have been requested
- * @return children for the given value, creating array partitions if
- * required
- * @throws CoreException
- */
- protected Object[] getValueChildren(IDebugElement parent, IValue value, IPresentationContext context) throws CoreException {
- if (value == null) {
- return EMPTY;
- }
- IValue logicalValue = getLogicalValue(value, context);
- if (logicalValue instanceof IIndexedValue) {
- IIndexedValue indexedValue = (IIndexedValue) logicalValue;
- int partitionSize = computeParitionSize(indexedValue);
- if (partitionSize > 1) {
- int offset = indexedValue.getInitialOffset();
- int length = indexedValue.getSize();
- int numPartitions = length / partitionSize;
- int remainder = length % partitionSize;
- if (remainder > 0) {
- numPartitions++;
- }
- IVariable[] partitions = new IVariable[numPartitions];
- for (int i = 0; i < (numPartitions - 1); i++) {
- partitions[i] = new IndexedVariablePartition(parent, indexedValue, offset, partitionSize);
- offset = offset + partitionSize;
- }
- if (remainder == 0) {
- remainder = partitionSize;
- }
- partitions[numPartitions - 1] = new IndexedVariablePartition(parent, indexedValue, offset, remainder);
- return partitions;
- }
- }
- if (logicalValue == null) {
- // safeguard against an structure type returning null
- logicalValue = value;
- }
- return logicalValue.getVariables();
- }
+ /**
+ * Returns children for the given value, creating array partitions if
+ * required
+ *
+ * @param parent expression or variable containing the given value
+ * @param value the value to retrieve children for
+ * @param context the context in which children have been requested
+ * @return children for the given value, creating array partitions if
+ * required
+ * @throws CoreException
+ */
+ protected Object[] getValueChildren(IDebugElement parent, IValue value, IPresentationContext context) throws CoreException {
+ if (value == null) {
+ return EMPTY;
+ }
+ IValue logicalValue = getLogicalValue(value, context);
+ if (logicalValue instanceof IIndexedValue) {
+ IIndexedValue indexedValue = (IIndexedValue) logicalValue;
+ int partitionSize = computeParitionSize(indexedValue);
+ if (partitionSize > 1) {
+ int offset = indexedValue.getInitialOffset();
+ int length = indexedValue.getSize();
+ int numPartitions = length / partitionSize;
+ int remainder = length % partitionSize;
+ if (remainder > 0) {
+ numPartitions++;
+ }
+ IVariable[] partitions = new IVariable[numPartitions];
+ for (int i = 0; i < (numPartitions - 1); i++) {
+ partitions[i] = new IndexedVariablePartition(parent, indexedValue, offset, partitionSize);
+ offset = offset + partitionSize;
+ }
+ if (remainder == 0) {
+ remainder = partitionSize;
+ }
+ partitions[numPartitions - 1] = new IndexedVariablePartition(parent, indexedValue, offset, remainder);
+ return partitions;
+ }
+ }
+ if (logicalValue == null) {
+ // safeguard against an structure type returning null
+ logicalValue = value;
+ }
+ return logicalValue.getVariables();
+ }
- /**
- * Returns the partition size to use for the given indexed value. The
- * partition size is computed by determining the number of levels that an
- * indexed collection must be nested in order to partition the collection
- * sub-collections of the preferred partition size.
- *
- * @param value
- * indexed value
- * @return size of partitions the value should be subdivided into
- */
- protected int computeParitionSize(IIndexedValue value) {
- int partitionSize = 1;
- try {
- int length = value.getSize();
- int partitionDepth = 0;
- int preferredSize = getArrayPartitionSize();
- int remainder = length % preferredSize;
- length = length / preferredSize;
- while (length > 0) {
- if (remainder == 0 && length == 1) {
- break;
- }
- partitionDepth++;
- remainder = length % preferredSize;
- length = length / preferredSize;
- }
- for (int i = 0; i < partitionDepth; i++) {
- partitionSize = partitionSize * preferredSize;
- }
- } catch (DebugException e) {
- }
- return partitionSize;
- }
+ /**
+ * Returns the partition size to use for the given indexed value. The
+ * partition size is computed by determining the number of levels that an
+ * indexed collection must be nested in order to partition the collection
+ * sub-collections of the preferred partition size.
+ *
+ * @param value
+ * indexed value
+ * @return size of partitions the value should be subdivided into
+ */
+ protected int computeParitionSize(IIndexedValue value) {
+ int partitionSize = 1;
+ try {
+ int length = value.getSize();
+ int partitionDepth = 0;
+ int preferredSize = getArrayPartitionSize();
+ int remainder = length % preferredSize;
+ length = length / preferredSize;
+ while (length > 0) {
+ if (remainder == 0 && length == 1) {
+ break;
+ }
+ partitionDepth++;
+ remainder = length % preferredSize;
+ length = length / preferredSize;
+ }
+ for (int i = 0; i < partitionDepth; i++) {
+ partitionSize = partitionSize * preferredSize;
+ }
+ } catch (DebugException e) {
+ }
+ return partitionSize;
+ }
- /**
- * Returns any logical value for the raw value. This method will recurse
- * over the returned value until the same structure is encountered again (to
- * avoid infinite recursion).
- *
- * @param value raw value to possibly be replaced by a logical value
- * @param previousStructureIds
- * the list of logical structures that have already been applied
- * to the returned value during the recursion of this method.
- * Callers should always pass in a new, empty list.
- * @return logical value if one is calculated, otherwise the raw value is returned
- */
+ /**
+ * Returns any logical value for the raw value. This method will recurse
+ * over the returned value until the same structure is encountered again (to
+ * avoid infinite recursion).
+ *
+ * @param value raw value to possibly be replaced by a logical value
+ * @param previousStructureIds
+ * the list of logical structures that have already been applied
+ * to the returned value during the recursion of this method.
+ * Callers should always pass in a new, empty list.
+ * @return logical value if one is calculated, otherwise the raw value is returned
+ */
protected IValue getLogicalValue(IValue value, List<String> previousStructureIds, IPresentationContext context) throws CoreException {
- if (isShowLogicalStructure(context)) {
- ILogicalStructureType[] types = DebugPlugin.getLogicalStructureTypes(value);
- if (types.length > 0) {
- ILogicalStructureType type = DebugPlugin.getDefaultStructureType(types);
- if (type != null && !previousStructureIds.contains(type.getId())) {
- IValue logicalValue = getLogicalStructureCache().getLogicalStructure(type, value);
- previousStructureIds.add(type.getId());
- return getLogicalValue(logicalValue, previousStructureIds, context);
- }
- }
- }
- return value;
- }
+ if (isShowLogicalStructure(context)) {
+ ILogicalStructureType[] types = DebugPlugin.getLogicalStructureTypes(value);
+ if (types.length > 0) {
+ ILogicalStructureType type = DebugPlugin.getDefaultStructureType(types);
+ if (type != null && !previousStructureIds.contains(type.getId())) {
+ IValue logicalValue = getLogicalStructureCache().getLogicalStructure(type, value);
+ previousStructureIds.add(type.getId());
+ return getLogicalValue(logicalValue, previousStructureIds, context);
+ }
+ }
+ }
+ return value;
+ }
- /**
- * Returns the logical structure cache to use to store calculated structures. If the cache does not
- * exist yet, one is created and a debug event listener is added to clear the cache on RESUME and
- * TERMINATE events.
- *
- * @return the logical structure cache to use
- */
- protected synchronized LogicalStructureCache getLogicalStructureCache(){
- if (fgLogicalCache == null){
- fgLogicalCache = new LogicalStructureCache();
- // Add a listener to clear the cache when resuming, terminating, or suspending
- DebugPlugin.getDefault().addDebugEventListener(new IDebugEventSetListener(){
+ /**
+ * Returns the logical structure cache to use to store calculated structures. If the cache does not
+ * exist yet, one is created and a debug event listener is added to clear the cache on RESUME and
+ * TERMINATE events.
+ *
+ * @return the logical structure cache to use
+ */
+ protected synchronized LogicalStructureCache getLogicalStructureCache(){
+ if (fgLogicalCache == null){
+ fgLogicalCache = new LogicalStructureCache();
+ // Add a listener to clear the cache when resuming, terminating, or suspending
+ DebugPlugin.getDefault().addDebugEventListener(new IDebugEventSetListener(){
@Override
public void handleDebugEvents(DebugEvent[] events) {
for (int i = 0; i < events.length; i++) {
@@ -252,9 +252,9 @@ public class VariableContentProvider extends ElementContentProvider {
}
}
}
- });
- }
- return fgLogicalCache;
- }
+ });
+ }
+ return fgLogicalCache;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableLabelProvider.java
index 4968eeb14..576996b64 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableLabelProvider.java
@@ -37,12 +37,12 @@ public class VariableLabelProvider extends DebugElementLabelProvider {
protected RGB getBackground(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException {
Object element = elementPath.getLastSegment();
if (columnId != null) {
- if (element instanceof IVariable) {
- IVariable variable = (IVariable) element;
+ if (element instanceof IVariable) {
+ IVariable variable = (IVariable) element;
if (variable.hasValueChanged()) {
return DebugUIPlugin.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB();
}
- }
+ }
}
return super.getBackground(elementPath, presentationContext, columnId);
}
@@ -51,14 +51,14 @@ public class VariableLabelProvider extends DebugElementLabelProvider {
protected RGB getForeground(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException {
Object element = elementPath.getLastSegment();
if (columnId == null) {
- if (element instanceof IVariable) {
- IVariable variable = (IVariable) element;
+ if (element instanceof IVariable) {
+ IVariable variable = (IVariable) element;
if (variable.hasValueChanged()) {
return DebugUIPlugin.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR).getRGB();
}
- }
+ }
}
- return super.getForeground(elementPath, presentationContext, columnId);
+ return super.getForeground(elementPath, presentationContext, columnId);
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ViewerInputProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ViewerInputProvider.java
index 8a1db1735..711940b92 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ViewerInputProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ViewerInputProvider.java
@@ -50,12 +50,12 @@ public abstract class ViewerInputProvider implements IViewerInputProvider {
job.schedule();
}
- /**
- * Computes the viewer input for the specified context.
- *
- * @param update update request
- */
- protected void retrieveInput(IViewerInputUpdate update) {
+ /**
+ * Computes the viewer input for the specified context.
+ *
+ * @param update update request
+ */
+ protected void retrieveInput(IViewerInputUpdate update) {
if (!update.isCanceled()) {
IStatus status = Status.OK_STATUS;
try {
@@ -70,38 +70,38 @@ public abstract class ViewerInputProvider implements IViewerInputProvider {
}
update.setStatus(status);
}
- }
+ }
- /**
- * Returns the viewer input derived from the given source object in the specified
- * context, possibly <code>null</code>.
- *
- * @param source element to derive a viewer input from
- * @param context context for which an input is requested
- * @param update viewer update request
- * @throws CoreException if an exception occurs retrieving child
- */
- protected abstract Object getViewerInput(Object source, IPresentationContext context, IViewerUpdate update) throws CoreException;
+ /**
+ * Returns the viewer input derived from the given source object in the specified
+ * context, possibly <code>null</code>.
+ *
+ * @param source element to derive a viewer input from
+ * @param context context for which an input is requested
+ * @param update viewer update request
+ * @throws CoreException if an exception occurs retrieving child
+ */
+ protected abstract Object getViewerInput(Object source, IPresentationContext context, IViewerUpdate update) throws CoreException;
- /**
- * Returns whether this adapter supports the given context.
- *
- * @param context
- * @return whether this adapter supports the given context
- */
- protected boolean supportsContext(IPresentationContext context) {
+ /**
+ * Returns whether this adapter supports the given context.
+ *
+ * @param context
+ * @return whether this adapter supports the given context
+ */
+ protected boolean supportsContext(IPresentationContext context) {
return supportsContextId(context.getId());
- }
+ }
- /**
- * Returns whether this adapter provides content in the specified context id.
- *
- * @param id part id
- * @return whether this adapter provides content in the specified context id
- */
- protected abstract boolean supportsContextId(String id);
+ /**
+ * Returns whether this adapter provides content in the specified context id.
+ *
+ * @param id part id
+ * @return whether this adapter provides content in the specified context id
+ */
+ protected abstract boolean supportsContextId(String id);
/**
* Returns a scheduling rule to use when performing the given updates or
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
index c0ead1d23..93d9c16ac 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
@@ -68,12 +68,12 @@ public interface IDebugPreferenceConstants {
/**
* (boolean) Whether or not the console view is shown
* when there is program output.
- */
+ */
String CONSOLE_OPEN_ON_OUT= "DEBUG.consoleOpenOnOut"; //$NON-NLS-1$
/**
* (boolean) Whether or not the console view is shown
* when there is program error.
- */
+ */
String CONSOLE_OPEN_ON_ERR= "DEBUG.consoleOpenOnErr"; //$NON-NLS-1$
/**
@@ -99,8 +99,8 @@ public interface IDebugPreferenceConstants {
String VARIABLES_DETAIL_PANE_ORIENTATION = "Variables.detail.orientation"; //$NON-NLS-1$
String EXPRESSIONS_DETAIL_PANE_ORIENTATION = "Expressions.detail.orientation"; //$NON-NLS-1$
String REGISTERS_DETAIL_PANE_ORIENTATION = "Registers.detail.orientation"; //$NON-NLS-1$
- String MODULES_DETAIL_PANE_ORIENTATION = "Modules.detail.orientation"; //$NON-NLS-1$
- String BREAKPOINTS_DETAIL_PANE_ORIENTATION = "Breakpoints.detail.orientation"; //$NON-NLS-1$
+ String MODULES_DETAIL_PANE_ORIENTATION = "Modules.detail.orientation"; //$NON-NLS-1$
+ String BREAKPOINTS_DETAIL_PANE_ORIENTATION = "Breakpoints.detail.orientation"; //$NON-NLS-1$
String VARIABLES_DETAIL_PANE_RIGHT = "Variables.detail.orientation.right"; //$NON-NLS-1$
String VARIABLES_DETAIL_PANE_UNDERNEATH = "Variables.detail.orientation.underneath"; //$NON-NLS-1$
String VARIABLES_DETAIL_PANE_HIDDEN = "Variables.detail.orientation.hidden"; //$NON-NLS-1$
@@ -295,29 +295,29 @@ public interface IDebugPreferenceConstants {
*/
String PREF_TABLE_RENDERING_POST_BUFFER_SIZE = "org.eclispe.debug.ui.memory.postBufferSize"; //$NON-NLS-1$
- /**
- * The layout mode in Debug view.
- *
- * @since 3.5
- */
- String DEBUG_VIEW_MODE = "org.eclispe.debug.ui.Debug_view.mode"; //$NON-NLS-1$
- String DEBUG_VIEW_MODE_AUTO = "Debug_view.mode.auto"; //$NON-NLS-1$
- String DEBUG_VIEW_MODE_COMPACT = "Debug_view.mode.compact"; //$NON-NLS-1$
- String DEBUG_VIEW_MODE_FULL = "Debug_view.mode.full"; //$NON-NLS-1$
-
- /**
- * Preference whether to auto-expand in the breadcrumb drop-down viewers.
- *
- * @since 3.5
- */
- String DEBUG_VIEW_BREADCRUMB_AUTO_EXPAND_DROP_DOWN = "org.eclispe.debug.ui.Debug_view.Breadcrumb.dropDownAutoexpand"; //$NON-NLS-1$
-
- /**
- * Perspectives in which the debug toolbar is hidden.
- *
- * @since 3.8
- */
- String DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES = "org.eclispe.debug.ui.Debug_view.debug_toolbar_hidden_perspectives"; //$NON-NLS-1$
+ /**
+ * The layout mode in Debug view.
+ *
+ * @since 3.5
+ */
+ String DEBUG_VIEW_MODE = "org.eclispe.debug.ui.Debug_view.mode"; //$NON-NLS-1$
+ String DEBUG_VIEW_MODE_AUTO = "Debug_view.mode.auto"; //$NON-NLS-1$
+ String DEBUG_VIEW_MODE_COMPACT = "Debug_view.mode.compact"; //$NON-NLS-1$
+ String DEBUG_VIEW_MODE_FULL = "Debug_view.mode.full"; //$NON-NLS-1$
+
+ /**
+ * Preference whether to auto-expand in the breadcrumb drop-down viewers.
+ *
+ * @since 3.5
+ */
+ String DEBUG_VIEW_BREADCRUMB_AUTO_EXPAND_DROP_DOWN = "org.eclispe.debug.ui.Debug_view.Breadcrumb.dropDownAutoexpand"; //$NON-NLS-1$
+
+ /**
+ * Perspectives in which the debug toolbar is hidden.
+ *
+ * @since 3.8
+ */
+ String DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES = "org.eclispe.debug.ui.Debug_view.debug_toolbar_hidden_perspectives"; //$NON-NLS-1$
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java
index 9814eea8d..d0acf296e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java
@@ -468,7 +468,7 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
} catch (NumberFormatException e){
DebugUIPlugin.log(new Throwable("Problem loading persisted column sizes for StringVariablePreferencesPage",e)); //$NON-NLS-1$
}
- }
+ }
return true;
}
@@ -697,12 +697,12 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
case 3:
String contribution = IInternalDebugCoreConstants.EMPTY_STRING;
if (variable.isContributed()) {
- String pluginId = getVariableManager().getContributingPluginId(variable.getUnderlyingVariable());
- if (pluginId != null) {
- contribution = pluginId;
- } else {
- contribution = DebugPreferencesMessages.SimpleLaunchVariablePreferencePage_23;
- }
+ String pluginId = getVariableManager().getContributingPluginId(variable.getUnderlyingVariable());
+ if (pluginId != null) {
+ contribution = pluginId;
+ } else {
+ contribution = DebugPreferencesMessages.SimpleLaunchVariablePreferencePage_23;
+ }
}
return contribution;
default:
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
index 51d69d6d5..eba619326 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
@@ -59,22 +59,22 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
private CheckboxTableViewer fPerspectiveViewer;
private Button fTrackViewsButton;
private Button fResetViewsButton;
- // This flag indicates whether or not the user has pressed the reset button
+ // This flag indicates whether or not the user has pressed the reset button
private boolean fResetPressed= false;
private PerspectiveLabelProvider fLabelProvider= null;
- private SelectionListener fSelectionListener= new SelectionAdapter() {
+ private SelectionListener fSelectionListener= new SelectionAdapter() {
- @Override
+ @Override
public void widgetSelected(SelectionEvent e) {
- Object source = e.getSource();
- if (source == fResetViewsButton) {
- handleResetPressed();
- } else if (source == fTrackViewsButton) {
- handleTrackViewsToggled();
- }
- }
+ Object source = e.getSource();
+ if (source == fResetViewsButton) {
+ handleResetPressed();
+ } else if (source == fTrackViewsButton) {
+ handleTrackViewsToggled();
+ }
+ }
- };
+ };
public ViewManagementPreferencePage() {
super();
@@ -83,7 +83,7 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
setPreferenceStore(DebugUITools.getPreferenceStore());
}
- @Override
+ @Override
public void createControl(Composite parent) {
super.createControl(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.VIEW_MANAGEMENT_PREFERENCE_PAGE);
@@ -113,7 +113,7 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
fTrackViewsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fTrackViewsButton.setText(DebugPreferencesMessages.ViewManagementPreferencePage_3);
fTrackViewsButton.setSelection(DebugUITools.getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TRACK_VIEWS));
- fTrackViewsButton.addSelectionListener(fSelectionListener);
+ fTrackViewsButton.addSelectionListener(fSelectionListener);
Label label= new Label(composite, SWT.WRAP);
label.setText(DebugPreferencesMessages.ViewManagementPreferencePage_4);
@@ -125,20 +125,20 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
updateResetButton();
}
- private void handleResetPressed() {
- fResetPressed= true;
- fResetViewsButton.setEnabled(false);
- }
-
- protected void handleTrackViewsToggled() {
- if (fTrackViewsButton.getSelection()) {
- // When toggled on, possibly re-enable the reset button
- updateResetButton();
- } else {
- // When toggled off, disable the reset button
- fResetViewsButton.setEnabled(false);
- }
- }
+ private void handleResetPressed() {
+ fResetPressed= true;
+ fResetViewsButton.setEnabled(false);
+ }
+
+ protected void handleTrackViewsToggled() {
+ if (fTrackViewsButton.getSelection()) {
+ // When toggled on, possibly re-enable the reset button
+ updateResetButton();
+ } else {
+ // When toggled off, disable the reset button
+ fResetViewsButton.setEnabled(false);
+ }
+ }
/**
* @param parent
@@ -162,12 +162,12 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
Set<String> perspectives;
String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString(
- IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
- if (IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT.equals(preference)) {
- perspectives = ViewContextService.getDefaultEnabledPerspectives();
- } else {
- perspectives = ViewContextService.parseList(preference);
- }
+ IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
+ if (IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT.equals(preference)) {
+ perspectives = ViewContextService.getDefaultEnabledPerspectives();
+ } else {
+ perspectives = ViewContextService.parseList(preference);
+ }
checkPerspectives(perspectives);
}
@@ -176,9 +176,9 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry();
for (String id : perspectives) {
IPerspectiveDescriptor descriptor = registry.findPerspectiveWithId(id);
- if (descriptor != null) {
- fPerspectiveViewer.setChecked(descriptor, true);
- }
+ if (descriptor != null) {
+ fPerspectiveViewer.setChecked(descriptor, true);
+ }
}
}
@@ -187,23 +187,23 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
Object[] descriptors = fPerspectiveViewer.getCheckedElements();
Set<String> perspectives = new HashSet<>();
for (int i = 0; i < descriptors.length; i++) {
- perspectives.add( ((IPerspectiveDescriptor)descriptors[i]).getId() );
+ perspectives.add( ((IPerspectiveDescriptor)descriptors[i]).getId() );
}
if (perspectives.equals(ViewContextService.getDefaultEnabledPerspectives())) {
- getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES,
- IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT);
+ getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES,
+ IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT);
} else {
- StringBuilder buffer= new StringBuilder();
+ StringBuilder buffer= new StringBuilder();
for (Iterator<String> itr = perspectives.iterator(); itr.hasNext();) {
- buffer.append(itr.next()).append(',');
- }
- getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, buffer.toString());
+ buffer.append(itr.next()).append(',');
+ }
+ getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, buffer.toString());
}
boolean trackViews = fTrackViewsButton.getSelection();
- getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_TRACK_VIEWS, trackViews);
+ getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_TRACK_VIEWS, trackViews);
if (fResetPressed || !trackViews) {
- // Reset if the user has pressed reset or chosen to no longer track views
+ // Reset if the user has pressed reset or chosen to no longer track views
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, IInternalDebugCoreConstants.EMPTY_STRING);
}
return super.performOk();
@@ -211,7 +211,7 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
@Override
protected void performDefaults() {
- checkPerspectives( ViewContextService.getDefaultEnabledPerspectives() );
+ checkPerspectives( ViewContextService.getDefaultEnabledPerspectives() );
fTrackViewsButton.setSelection(getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_TRACK_VIEWS));
fResetPressed= false;
updateResetButton();
@@ -225,12 +225,12 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
/**
* Updates enablement of the reset button.
* Enable if either persisted view collection is not empty.
- * Always disable if "track views" is turned off.
+ * Always disable if "track views" is turned off.
*/
private void updateResetButton() {
boolean enableReset= !IInternalDebugCoreConstants.EMPTY_STRING.equals(getPreferenceStore().getString(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS));
- // Only enable the button if there are views to clear, the user hasn't pressed the reset
- // button, and the option to "track views" is turned on.
+ // Only enable the button if there are views to clear, the user hasn't pressed the reset
+ // button, and the option to "track views" is turned on.
fResetViewsButton.setEnabled(enableReset && !fResetPressed && fTrackViewsButton.getSelection());
}
@@ -245,21 +245,21 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
- @Override
+ @Override
public void dispose() {
- }
+ }
}
private static class PerspectiveComparator extends ViewerComparator {
- @Override
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof IPerspectiveDescriptor && e2 instanceof IPerspectiveDescriptor) {
- return ((IPerspectiveDescriptor) e1).getLabel().compareToIgnoreCase(((IPerspectiveDescriptor) e2).getLabel());
- }
- return super.compare(viewer, e1, e2);
- }
+ if (e1 instanceof IPerspectiveDescriptor && e2 instanceof IPerspectiveDescriptor) {
+ return ((IPerspectiveDescriptor) e1).getLabel().compareToIgnoreCase(((IPerspectiveDescriptor) e2).getLabel());
+ }
+ return super.compare(viewer, e1, e2);
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/AddSourceContainerDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/AddSourceContainerDialog.java
index 9c059e4fe..3cec78f55 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/AddSourceContainerDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/AddSourceContainerDialog.java
@@ -138,18 +138,18 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
protected void okPressed() {
ISourceContainerType type = (ISourceContainerType) fViewer.getStructuredSelection().getFirstElement();
if (type != null) {
- ISourceContainerBrowser browser = DebugUITools.getSourceContainerBrowser(type.getId());
- if (browser != null) {
- ISourceContainer[] results = browser.addSourceContainers(getShell(), fDirector);
- if (results != null && results.length > 0) {
- fSourceContainerViewer.addEntries(results);
- super.okPressed();
- }
- else {
- return;
- }
- }
- }
+ ISourceContainerBrowser browser = DebugUITools.getSourceContainerBrowser(type.getId());
+ if (browser != null) {
+ ISourceContainer[] results = browser.addSourceContainers(getShell(), fDirector);
+ if (results != null && results.length > 0) {
+ fSourceContainerViewer.addEntries(results);
+ super.okPressed();
+ }
+ else {
+ return;
+ }
+ }
+ }
super.okPressed();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java
index 6de0082d7..b69e76c96 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java
@@ -136,11 +136,11 @@ public class SourceContainerViewer extends TreeViewer {
* @param entries additions
*/
public void addEntries(ISourceContainer[] entries) {
- int index = 0;
+ int index = 0;
IStructuredSelection sel = getStructuredSelection();
if (!sel.isEmpty()) {
- index = fEntries.indexOf(sel.getFirstElement());
- }
+ index = fEntries.indexOf(sel.getFirstElement());
+ }
for (int i = 0; i < entries.length; i++) {
if (!fEntries.contains(entries[i])) {
fEntries.add(index, entries[i]);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
index 657781a50..28d0f4558 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java
@@ -374,15 +374,15 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
}
}
return result;
- }
-
- /**
- * Returns the model presentation for the given debug model, or <code>null</code>
- * if none.
- *
- * @param id debug model id
- * @return presentation for the model, or <code>null</code> if none.
- */
+ }
+
+ /**
+ * Returns the model presentation for the given debug model, or <code>null</code>
+ * if none.
+ *
+ * @param id debug model id
+ * @return presentation for the model, or <code>null</code> if none.
+ */
protected IDebugModelPresentation getPresentation(String id) {
return ((DelegatingModelPresentation)DebugUIPlugin.getModelPresentation()).getPresentation(id);
}
@@ -393,32 +393,32 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
* @return an editor presentation
*/
protected IDebugEditorPresentation getEditorPresentation() {
- return (DelegatingModelPresentation)DebugUIPlugin.getModelPresentation();
- }
-
- /**
- * Opens an editor in the given workbench page for the given source lookup
- * result. Has no effect if the result has an unknown editor id or editor input.
- * The editor is opened, positioned, and annotated.
- * <p>
- * Honor's the user preference of whether to re-use editors when displaying source.
- * </p>
- * @param result source lookup result to display
- * @param page the page to display the result in
- */
- public void display(ISourceLookupResult result, IWorkbenchPage page) {
+ return (DelegatingModelPresentation)DebugUIPlugin.getModelPresentation();
+ }
+
+ /**
+ * Opens an editor in the given workbench page for the given source lookup
+ * result. Has no effect if the result has an unknown editor id or editor input.
+ * The editor is opened, positioned, and annotated.
+ * <p>
+ * Honor's the user preference of whether to re-use editors when displaying source.
+ * </p>
+ * @param result source lookup result to display
+ * @param page the page to display the result in
+ */
+ public void display(ISourceLookupResult result, IWorkbenchPage page) {
IEditorPart editor= openEditor(result, page);
if (editor == null) {
return;
}
IStackFrame frame = null;
- if (result.getArtifact() instanceof IStackFrame) {
- frame = (IStackFrame) result.getArtifact();
- }
+ if (result.getArtifact() instanceof IStackFrame) {
+ frame = (IStackFrame) result.getArtifact();
+ }
// position and annotate editor for stack frame
- if (frame != null) {
+ if (frame != null) {
IDebugEditorPresentation editorPresentation = getEditorPresentation();
- if (editorPresentation.addAnnotations(editor, frame)) {
+ if (editorPresentation.addAnnotations(editor, frame)) {
Decoration decoration = new StandardDecoration(editorPresentation, editor, frame.getThread());
DecorationManager.addDecoration(decoration);
} else {
@@ -439,7 +439,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
}
}
}
- }
+ }
/**
* Opens the editor used to display the source for an element selected in
@@ -463,20 +463,20 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
page.bringToTop(editor);
}
if (editor == null) {
- IEditorPart editorForPage = getEditor(page);
+ IEditorPart editorForPage = getEditor(page);
if (editorForPage == null || editorForPage.isDirty() || page.isEditorPinned(editorForPage)) {
- // open a new editor
+ // open a new editor
editor = openEditor(page, input, id);
editorForPage = editor;
} else if (editorForPage instanceof IReusableEditor && editorForPage.getSite().getId().equals(id)) {
- // re-use editor
+ // re-use editor
page.reuseEditor((IReusableEditor)editorForPage, input);
editor = editorForPage;
- if(!page.isPartVisible(editor)) {
- page.bringToTop(editor);
- }
+ if(!page.isPartVisible(editor)) {
+ page.bringToTop(editor);
+ }
} else {
- // close editor, open a new one
+ // close editor, open a new one
editor = openEditor(page, input, id);
page.closeEditor(editorForPage, false);
editorForPage = editor;
@@ -569,108 +569,108 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
return false;
}
- @Override
+ @Override
public void pageActivated(IWorkbenchPage page) {
- }
+ }
- @Override
+ @Override
public void pageClosed(IWorkbenchPage page) {
- fEditorsByPage.remove(page);
- page.removePartListener(this);
- }
+ fEditorsByPage.remove(page);
+ page.removePartListener(this);
+ }
- @Override
+ @Override
public void pageOpened(IWorkbenchPage page) {
- page.addPartListener(this);
- }
+ page.addPartListener(this);
+ }
- @Override
+ @Override
public void partActivated(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partClosed(IWorkbenchPartReference partRef) {
- // clear the cached editor for the page if it has been closed
- IWorkbenchPage page = partRef.getPage();
- IEditorPart editor = getEditor(page);
- IWorkbenchPart part = partRef.getPart(false);
+ // clear the cached editor for the page if it has been closed
+ IWorkbenchPage page = partRef.getPage();
+ IEditorPart editor = getEditor(page);
+ IWorkbenchPart part = partRef.getPart(false);
if (part != null && part.equals(editor)) {
fEditorsByPage.remove(page);
}
- }
+ }
- @Override
+ @Override
public void partDeactivated(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partOpened(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partHidden(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partVisible(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partInputChanged(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
+ String property = event.getProperty();
if (property.equals(IDebugUIConstants.PREF_REUSE_EDITOR)) {
fReuseEditor = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_REUSE_EDITOR);
}
- }
-
- /**
- * Returns the editor to use to display source in the given page, or
- * <code>null</code> if a new editor should be opened.
- *
- * @param page workbench page
- * @return the editor to use to display source in the given page, or
- * <code>null</code> if a new editor should be opened
- */
- protected IEditorPart getEditor(IWorkbenchPage page) {
- return fEditorsByPage.get(page);
- }
-
- /**
- * Sets the editor to use to display source in the given page, or
- * <code>null</code> if a new editor should be opened.
- *
- * @param page workbench page
- * @return the editor to use to display source in the given page, or
- * <code>null</code> if a new editor should be opened
- */
- protected void setEditor(IWorkbenchPage page, IEditorPart editorPart) {
- if (editorPart == null) {
- fEditorsByPage.remove(page);
- } else {
- fEditorsByPage.put(page, editorPart);
- }
- page.addPartListener(this);
- page.getWorkbenchWindow().addPageListener(this);
- }
-
- /**
- * Performs cleanup.
- */
- protected void dispose() {
- DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
+ }
+
+ /**
+ * Returns the editor to use to display source in the given page, or
+ * <code>null</code> if a new editor should be opened.
+ *
+ * @param page workbench page
+ * @return the editor to use to display source in the given page, or
+ * <code>null</code> if a new editor should be opened
+ */
+ protected IEditorPart getEditor(IWorkbenchPage page) {
+ return fEditorsByPage.get(page);
+ }
+
+ /**
+ * Sets the editor to use to display source in the given page, or
+ * <code>null</code> if a new editor should be opened.
+ *
+ * @param page workbench page
+ * @return the editor to use to display source in the given page, or
+ * <code>null</code> if a new editor should be opened
+ */
+ protected void setEditor(IWorkbenchPage page, IEditorPart editorPart) {
+ if (editorPart == null) {
+ fEditorsByPage.remove(page);
+ } else {
+ fEditorsByPage.put(page, editorPart);
+ }
+ page.addPartListener(this);
+ page.getWorkbenchWindow().addPageListener(this);
+ }
+
+ /**
+ * Performs cleanup.
+ */
+ protected void dispose() {
+ DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
DebugPlugin.getDefault().removeDebugEventListener(this);
- fEditorsByPage.clear();
- fPresentation.dispose();
+ fEditorsByPage.clear();
+ fPresentation.dispose();
fLookupResults.clear();
- }
+ }
/**
* A job to perform source lookup on the currently selected stack frame.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupResult.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupResult.java
index c490b0ea5..c524b8cff 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupResult.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupResult.java
@@ -24,89 +24,89 @@ import org.eclipse.ui.IEditorInput;
*/
public class SourceLookupResult implements ISourceLookupResult {
- /**
- * Element that source was resolved for.
- */
- private Object fArtifact;
- /**
- * Corresponding source element, or <code>null</code>
- * if unknown.
- */
- private Object fSourceElement;
- /**
- * Associated editor id, used to display the source element,
- * or <code>null</code> if unknown.
- */
- private String fEditorId;
- /**
- * Associated editor input, used to display the source element,
- * or <code>null</code> if unknown.
- */
- private IEditorInput fEditorInput;
+ /**
+ * Element that source was resolved for.
+ */
+ private Object fArtifact;
+ /**
+ * Corresponding source element, or <code>null</code>
+ * if unknown.
+ */
+ private Object fSourceElement;
+ /**
+ * Associated editor id, used to display the source element,
+ * or <code>null</code> if unknown.
+ */
+ private String fEditorId;
+ /**
+ * Associated editor input, used to display the source element,
+ * or <code>null</code> if unknown.
+ */
+ private IEditorInput fEditorInput;
- /**
- * Creates a source lookup result on the given artifact, source element,
- * editor id, and editor input.
- */
- public SourceLookupResult(Object artifact, Object sourceElement, String editorId, IEditorInput editorInput) {
- fArtifact = artifact;
- setSourceElement(sourceElement);
- setEditorId(editorId);
- setEditorInput(editorInput);
- }
+ /**
+ * Creates a source lookup result on the given artifact, source element,
+ * editor id, and editor input.
+ */
+ public SourceLookupResult(Object artifact, Object sourceElement, String editorId, IEditorInput editorInput) {
+ fArtifact = artifact;
+ setSourceElement(sourceElement);
+ setEditorId(editorId);
+ setEditorInput(editorInput);
+ }
- @Override
+ @Override
public Object getArtifact() {
- return fArtifact;
- }
+ return fArtifact;
+ }
- @Override
+ @Override
public Object getSourceElement() {
- return fSourceElement;
- }
+ return fSourceElement;
+ }
- /**
- * Sets the source element resolved for the artifact that source
- * lookup was performed for, or <code>null</code> if a source element
- * was not resolved.
- *
- * @param element resolved source element or <code>null</code> if unknown
- */
- protected void setSourceElement(Object element) {
- fSourceElement = element;
- }
+ /**
+ * Sets the source element resolved for the artifact that source
+ * lookup was performed for, or <code>null</code> if a source element
+ * was not resolved.
+ *
+ * @param element resolved source element or <code>null</code> if unknown
+ */
+ protected void setSourceElement(Object element) {
+ fSourceElement = element;
+ }
- @Override
+ @Override
public String getEditorId() {
- return fEditorId;
- }
+ return fEditorId;
+ }
- /**
- * Sets the identifier of the editor used to display this source
- * lookup result's source element, or <code>null</code> if unknown.
- *
- * @param id the identifier of the editor used to display this source
- * lookup result's source element, or <code>null</code> if unknown
- */
- protected void setEditorId(String id) {
- fEditorId = id;
- }
+ /**
+ * Sets the identifier of the editor used to display this source
+ * lookup result's source element, or <code>null</code> if unknown.
+ *
+ * @param id the identifier of the editor used to display this source
+ * lookup result's source element, or <code>null</code> if unknown
+ */
+ protected void setEditorId(String id) {
+ fEditorId = id;
+ }
- @Override
+ @Override
public IEditorInput getEditorInput() {
- return fEditorInput;
- }
+ return fEditorInput;
+ }
- /**
- * Sets the editor input used to display this source lookup
- * result's source element, or <code>null</code> if unknown.
- *
- * @param input the editor input used to display this source lookup
- * result's source element, or <code>null</code> if unknown
- */
- protected void setEditorInput(IEditorInput input) {
- fEditorInput = input;
- }
+ /**
+ * Sets the editor input used to display this source lookup
+ * result's source element, or <code>null</code> if unknown.
+ *
+ * @param input the editor input used to display this source lookup
+ * result's source element, or <code>null</code> if unknown
+ */
+ protected void setEditorInput(IEditorInput input) {
+ fEditorInput = input;
+ }
/**
* Updates the artifact to refer to the given artifact
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
index e5dcf37d0..a19871086 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -131,10 +131,10 @@ public class SourceLookupService implements IDebugContextListener, ISourceDispla
IAdaptable adaptable = (IAdaptable) context;
ISourceDisplay adapter = adaptable.getAdapter(ISourceDisplay.class);
if (adapter == null && !(context instanceof PlatformObject)) {
- // for objects that don't properly subclass PlatformObject to inherit default
- // adapters, just delegate to the adapter factory
- adapter = new DebugElementAdapterFactory().getAdapter(context, ISourceDisplay.class);
- }
+ // for objects that don't properly subclass PlatformObject to inherit default
+ // adapters, just delegate to the adapter factory
+ adapter = new DebugElementAdapterFactory().getAdapter(context, ISourceDisplay.class);
+ }
if (adapter != null) {
adapter.displaySource(context, page, forceSourceLookup);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/DirectorySourceContainerDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/DirectorySourceContainerDialog.java
index e45518885..24b6e283c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/DirectorySourceContainerDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/DirectorySourceContainerDialog.java
@@ -124,50 +124,50 @@ public class DirectorySourceContainerDialog extends TitleAreaDialog {
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setFont(font);
- Composite dirComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout(2, false);
+ Composite dirComposite = new Composite(composite, SWT.NONE);
+ layout = new GridLayout(2, false);
dirComposite.setLayout(layout);
dirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
dirComposite.setFont(font);
- Label label = new Label(dirComposite, SWT.NONE);
- label.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_4);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setFont(font);
-
- fDirText = new Text(dirComposite, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 1;
- fDirText.setLayoutData(data);
- fDirText.setFont(font);
- fDirText.addModifyListener(new ModifyListener() {
+ Label label = new Label(dirComposite, SWT.NONE);
+ label.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_4);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ label.setFont(font);
+
+ fDirText = new Text(dirComposite, SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 1;
+ fDirText.setLayoutData(data);
+ fDirText.setFont(font);
+ fDirText.addModifyListener(new ModifyListener() {
@Override
public void modifyText( ModifyEvent e ) {
validate();
}
- });
-
- Button button = new Button(dirComposite, SWT.PUSH);
- button.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_5);
- data = new GridData();
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- data.widthHint = Math.max(widthHint, minSize.x);
- button.setLayoutData(data);
- button.setFont(JFaceResources.getDialogFont());
- button.addSelectionListener(new SelectionAdapter() {
- @Override
+ });
+
+ Button button = new Button(dirComposite, SWT.PUSH);
+ button.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_5);
+ data = new GridData();
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ data.widthHint = Math.max(widthHint, minSize.x);
+ button.setLayoutData(data);
+ button.setFont(JFaceResources.getDialogFont());
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent event) {
- browse();
- }
- });
+ browse();
+ }
+ });
- fSubfoldersButton = new Button(composite, SWT.CHECK);
- fSubfoldersButton.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_6);
+ fSubfoldersButton = new Button(composite, SWT.CHECK);
+ fSubfoldersButton.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_6);
- return parentComposite;
+ return parentComposite;
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerDialog.java
index 2cf2b3c1a..fedf26804 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerDialog.java
@@ -73,8 +73,8 @@ public class FolderSourceContainerDialog extends ElementTreeSelectionDialog {
protected Control createDialogArea(Composite parent) {
Composite parentc = (Composite)super.createDialogArea(parent);
fSubfoldersButton = new Button(parentc, SWT.CHECK);
- fSubfoldersButton.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_6);
- fSubfoldersButton.setSelection(fSearchSubfolders);
+ fSubfoldersButton.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_6);
+ fSubfoldersButton.setSelection(fSearchSubfolders);
return parentc;
}
@@ -88,7 +88,7 @@ public class FolderSourceContainerDialog extends ElementTreeSelectionDialog {
super(parent, labelProvider, contentProvider);
setTitle(SourceLookupUIMessages.folderSelection_title); //
setInput(ResourcesPlugin.getWorkspace().getRoot());
- setComparator(new ResourceComparator(ResourceComparator.NAME));
+ setComparator(new ResourceComparator(ResourceComparator.NAME));
ISelectionStatusValidator validator= new ISelectionStatusValidator() {
@Override
public IStatus validate(Object[] selection) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PasswordPrompt.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PasswordPrompt.java
index 84ae28714..be146152f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PasswordPrompt.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PasswordPrompt.java
@@ -41,43 +41,43 @@ public class PasswordPrompt extends PromptingResolver {
@Override
protected Control createDialogArea(Composite parent) {
// create composite
- Composite composite = (Composite) super.createDialogArea(parent);
- // create message
- if (dialogMessage != null) {
- Label label = new Label(composite, SWT.WRAP);
- label.setText(dialogMessage);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(parent.getFont());
- }
- text = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
- text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL));
- String value = defaultValue == null ? lastValue : defaultValue;
- if (value != null){
- text.setText(value);
- }
- applyDialogFont(composite);
- return composite;
+ Composite composite = (Composite) super.createDialogArea(parent);
+ // create message
+ if (dialogMessage != null) {
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(dialogMessage);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ }
+ text = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
+ text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ String value = defaultValue == null ? lastValue : defaultValue;
+ if (value != null){
+ text.setText(value);
+ }
+ applyDialogFont(composite);
+ return composite;
}
@Override
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
returnValue = text.getText();
- } else {
- returnValue = null;
- }
- super.buttonPressed(buttonId);
+ } else {
+ returnValue = null;
+ }
+ super.buttonPressed(buttonId);
}
@Override
protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(StringSubstitutionMessages.StringPromptExpander_0);
+ super.configureShell(newShell);
+ newShell.setText(StringSubstitutionMessages.StringPromptExpander_0);
}
};
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
index 49978b4f5..77668b3e8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java
@@ -64,7 +64,7 @@ public abstract class AsynchronousModel {
// by
// element
private AsynchronousViewer fViewer; // viewer this model works for
- private boolean fDisposed = false; // whether disposed
+ private boolean fDisposed = false; // whether disposed
class EmptyContentAdapter extends AsynchronousContentAdapter {
@@ -143,8 +143,8 @@ public abstract class AsynchronousModel {
buffer.append(")"); //$NON-NLS-1$
DebugUIPlugin.trace(buffer.toString());
}
- fDisposed = true;
- cancelPendingUpdates();
+ fDisposed = true;
+ cancelPendingUpdates();
disposeAllModelProxies();
ModelNode rootNode = getRootNode();
if (rootNode != null) {
@@ -153,26 +153,26 @@ public abstract class AsynchronousModel {
fElementToNodes.clear();
}
- /**
- * Returns whether this model has been disposed
- * @return <code>true</code> if the model is disposed <code>false</code> otherwise
- */
- public synchronized boolean isDisposed() {
- return fDisposed;
- }
-
- /**
- * Cancels all pending update requests.
- */
- protected synchronized void cancelPendingUpdates() {
+ /**
+ * Returns whether this model has been disposed
+ * @return <code>true</code> if the model is disposed <code>false</code> otherwise
+ */
+ public synchronized boolean isDisposed() {
+ return fDisposed;
+ }
+
+ /**
+ * Cancels all pending update requests.
+ */
+ protected synchronized void cancelPendingUpdates() {
Iterator<IStatusMonitor> updates = fPendingUpdates.iterator();
- while (updates.hasNext()) {
- IStatusMonitor update = updates.next();
- updates.remove();
- update.setCanceled(true);
- }
- fPendingUpdates.clear();
- }
+ while (updates.hasNext()) {
+ IStatusMonitor update = updates.next();
+ updates.remove();
+ update.setCanceled(true);
+ }
+ fPendingUpdates.clear();
+ }
/**
* Installs the model proxy for the given element into this viewer
@@ -222,13 +222,13 @@ public abstract class AsynchronousModel {
* Unintalls all model proxies installed for this model
*/
private void disposeAllModelProxies() {
- synchronized(fModelProxies) {
+ synchronized(fModelProxies) {
for (IModelProxy proxy : fModelProxies.values()) {
- getViewer().modelProxyRemoved(proxy);
- proxy.dispose();
- }
- fModelProxies.clear();
- }
+ getViewer().modelProxyRemoved(proxy);
+ proxy.dispose();
+ }
+ fModelProxies.clear();
+ }
}
/**
@@ -265,7 +265,7 @@ public abstract class AsynchronousModel {
*/
protected synchronized void mapElement(Object element, ModelNode node) {
ModelNode[] nodes = getNodes(element);
- node.remap(element);
+ node.remap(element);
if (nodes == null) {
fElementToNodes.put(element, new ModelNode[] { node});
} else {
@@ -280,41 +280,41 @@ public abstract class AsynchronousModel {
newNodes[old.length] = node;
fElementToNodes.put(element, newNodes);
}
- installModelProxy(element);
+ installModelProxy(element);
}
- /**
- * Unmaps the given node from its element and widget.
- *
- * @param node the model node
- */
- protected synchronized void unmapNode(ModelNode node) {
- Object element = node.getElement();
- ModelNode[] nodes = fElementToNodes.get(element);
- if (nodes == null) {
- return;
- }
- if (nodes.length == 1) {
- fElementToNodes.remove(element);
- disposeModelProxy(element);
- } else {
- for (int i = 0; i < nodes.length; i++) {
- ModelNode node2 = nodes[i];
- if (node2 == node) {
- ModelNode[] newNodes= new ModelNode[nodes.length - 1];
- System.arraycopy(nodes, 0, newNodes, 0, i);
- if (i < newNodes.length) {
- System.arraycopy(nodes, i + 1, newNodes, i, newNodes.length - i);
- }
- fElementToNodes.put(element, newNodes);
- }
- }
- }
- }
+ /**
+ * Unmaps the given node from its element and widget.
+ *
+ * @param node the model node
+ */
+ protected synchronized void unmapNode(ModelNode node) {
+ Object element = node.getElement();
+ ModelNode[] nodes = fElementToNodes.get(element);
+ if (nodes == null) {
+ return;
+ }
+ if (nodes.length == 1) {
+ fElementToNodes.remove(element);
+ disposeModelProxy(element);
+ } else {
+ for (int i = 0; i < nodes.length; i++) {
+ ModelNode node2 = nodes[i];
+ if (node2 == node) {
+ ModelNode[] newNodes= new ModelNode[nodes.length - 1];
+ System.arraycopy(nodes, 0, newNodes, 0, i);
+ if (i < newNodes.length) {
+ System.arraycopy(nodes, i + 1, newNodes, i, newNodes.length - i);
+ }
+ fElementToNodes.put(element, newNodes);
+ }
+ }
+ }
+ }
/**
* Returns the nodes in this model for the given element or
- * <code>null</code> if none.
+ * <code>null</code> if none.
*
* @param element model element
* @return associated nodes or <code>null</code>
@@ -441,43 +441,43 @@ public abstract class AsynchronousModel {
return adapter;
}
- /**
- * Returns the tree element adapter for the given element or
- * <code>null</code> if none.
- *
- * @param element
- * element to retrieve adapter for
- * @return presentation adapter or <code>null</code>
- */
- protected IAsynchronousContentAdapter getContentAdapter(Object element) {
- IAsynchronousContentAdapter adapter = null;
- if (element instanceof IAsynchronousContentAdapter) {
- adapter = (IAsynchronousContentAdapter) element;
- } else if (element instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) element;
- adapter = adaptable.getAdapter(IAsynchronousContentAdapter.class);
- }
- return adapter;
- }
-
- /**
- * Updates the children of the given node.
- *
- * @param parent
- * node of which to update children
- */
- public void updateChildren(ModelNode parent) {
- Object element = parent.getElement();
- IAsynchronousContentAdapter adapter = getContentAdapter(element);
- if (adapter == null) {
- adapter = fEmptyContentAdapter;
- }
- if (adapter != null) {
- IChildrenRequestMonitor update = new ChildrenRequestMonitor(parent, this);
- requestScheduled(update);
- adapter.retrieveChildren(element, getPresentationContext(), update);
- }
- }
+ /**
+ * Returns the tree element adapter for the given element or
+ * <code>null</code> if none.
+ *
+ * @param element
+ * element to retrieve adapter for
+ * @return presentation adapter or <code>null</code>
+ */
+ protected IAsynchronousContentAdapter getContentAdapter(Object element) {
+ IAsynchronousContentAdapter adapter = null;
+ if (element instanceof IAsynchronousContentAdapter) {
+ adapter = (IAsynchronousContentAdapter) element;
+ } else if (element instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) element;
+ adapter = adaptable.getAdapter(IAsynchronousContentAdapter.class);
+ }
+ return adapter;
+ }
+
+ /**
+ * Updates the children of the given node.
+ *
+ * @param parent
+ * node of which to update children
+ */
+ public void updateChildren(ModelNode parent) {
+ Object element = parent.getElement();
+ IAsynchronousContentAdapter adapter = getContentAdapter(element);
+ if (adapter == null) {
+ adapter = fEmptyContentAdapter;
+ }
+ if (adapter != null) {
+ IChildrenRequestMonitor update = new ChildrenRequestMonitor(parent, this);
+ requestScheduled(update);
+ adapter.retrieveChildren(element, getPresentationContext(), update);
+ }
+ }
/**
* Update this model's viewer preserving its selection.
@@ -523,12 +523,12 @@ public abstract class AsynchronousModel {
}
}
- /**
- * Asynchronous update for add/set children request.
- *
- * @param parent the parent model node
- * @param element the element context
- */
+ /**
+ * Asynchronous update for add/set children request.
+ *
+ * @param parent the parent model node
+ * @param element the element context
+ */
protected abstract void add(ModelNode parent, Object element);
/**
@@ -538,37 +538,37 @@ public abstract class AsynchronousModel {
* @param kids list of model elements
*/
protected void setChildren(final ModelNode parentNode, List<Object> kids) {
- final Object[] children = filter(parentNode.getElement(), kids.toArray());
- final AsynchronousViewer viewer = getViewer();
+ final Object[] children = filter(parentNode.getElement(), kids.toArray());
+ final AsynchronousViewer viewer = getViewer();
ViewerComparator comparator = viewer.getComparator();
- if (comparator != null) {
- comparator.sort(viewer, children);
- }
-
- ModelNode[] prevKids = null;
- ModelNode[] newChildren = null;
- ModelNode[] unmap = null;
-
- synchronized (this) {
- if (isDisposed()) {
- return;
- }
- prevKids = parentNode.getChildrenNodes();
- if (prevKids == null) {
- newChildren = new ModelNode[children.length];
- for (int i = 0; i < children.length; i++) {
- ModelNode node = new ModelNode(parentNode, children[i]);
- mapElement(children[i], node);
- newChildren[i] = node;
- }
- parentNode.setChildren(newChildren);
- } else {
- newChildren = new ModelNode[children.length];
- unmap = new ModelNode[prevKids.length];
- for (int i = 0; i < prevKids.length; i++) {
+ if (comparator != null) {
+ comparator.sort(viewer, children);
+ }
+
+ ModelNode[] prevKids = null;
+ ModelNode[] newChildren = null;
+ ModelNode[] unmap = null;
+
+ synchronized (this) {
+ if (isDisposed()) {
+ return;
+ }
+ prevKids = parentNode.getChildrenNodes();
+ if (prevKids == null) {
+ newChildren = new ModelNode[children.length];
+ for (int i = 0; i < children.length; i++) {
+ ModelNode node = new ModelNode(parentNode, children[i]);
+ mapElement(children[i], node);
+ newChildren[i] = node;
+ }
+ parentNode.setChildren(newChildren);
+ } else {
+ newChildren = new ModelNode[children.length];
+ unmap = new ModelNode[prevKids.length];
+ for (int i = 0; i < prevKids.length; i++) {
unmap[i] = prevKids[i];
}
- for (int i = 0; i < children.length; i++) {
+ for (int i = 0; i < children.length; i++) {
Object child = children[i];
boolean found = false;
for (int j = 0; j < prevKids.length; j++) {
@@ -585,23 +585,23 @@ public abstract class AsynchronousModel {
mapElement(child, newChildren[i]);
}
}
- for (int i = 0; i < prevKids.length; i++) {
- ModelNode kid = prevKids[i];
- if (kid != null) {
- kid.dispose();
- unmapNode(kid);
- }
- }
- parentNode.setChildren(newChildren);
- }
- if (DebugUIPlugin.DEBUG_MODEL) {
- DebugUIPlugin.trace("CHILDREN CHANGED: " + parentNode); //$NON-NLS-1$
- DebugUIPlugin.trace(toString());
- }
- }
-
- //update viewer outside the lock
- final ModelNode[] finalUnmap = unmap;
+ for (int i = 0; i < prevKids.length; i++) {
+ ModelNode kid = prevKids[i];
+ if (kid != null) {
+ kid.dispose();
+ unmapNode(kid);
+ }
+ }
+ parentNode.setChildren(newChildren);
+ }
+ if (DebugUIPlugin.DEBUG_MODEL) {
+ DebugUIPlugin.trace("CHILDREN CHANGED: " + parentNode); //$NON-NLS-1$
+ DebugUIPlugin.trace(toString());
+ }
+ }
+
+ //update viewer outside the lock
+ final ModelNode[] finalUnmap = unmap;
preservingSelection(() -> {
if (finalUnmap != null) {
for (int i = 0; i < finalUnmap.length; i++) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java
index fde0aef0c..f18dc2e7c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousRequestMonitor.java
@@ -33,148 +33,148 @@ public abstract class AsynchronousRequestMonitor extends AbstractRequestMonitor
/**
* Model node the update is rooted at
*/
- private ModelNode fNode;
+ private ModelNode fNode;
- /**
- * Model the update is being performed for
- */
- private AsynchronousModel fModel;
+ /**
+ * Model the update is being performed for
+ */
+ private AsynchronousModel fModel;
- /**
- * Whether this request's 'done' method has been called.
- */
- private boolean fDone = false;
+ /**
+ * Whether this request's 'done' method has been called.
+ */
+ private boolean fDone = false;
- protected WorkbenchJob fViewerUpdateJob = new WorkbenchJob("Asynchronous viewer update") { //$NON-NLS-1$
- @Override
+ protected WorkbenchJob fViewerUpdateJob = new WorkbenchJob("Asynchronous viewer update") { //$NON-NLS-1$
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- // necessary to check if widget is disposed. The item may
- // have been removed from the tree when another children update
- // occurred.
- getModel().viewerUpdateScheduled(AsynchronousRequestMonitor.this);
- if (fDone) {
- getModel().requestComplete(AsynchronousRequestMonitor.this);
- }
- if (!isCanceled() && !getNode().isDisposed()) {
- IStatus status = getStatus();
- if (status != null && !status.isOK()) {
- getModel().getViewer().handlePresentationFailure(AsynchronousRequestMonitor.this, status);
- } else {
- performUpdate();
- }
- }
- getModel().viewerUpdateComplete(AsynchronousRequestMonitor.this);
- return Status.OK_STATUS;
- }
- };
-
- /**
- * Constructs an update rooted at the given item.
- *
- * @param node model node
- * @param model model the node is in
- */
- public AsynchronousRequestMonitor(ModelNode node, AsynchronousModel model) {
- fNode = node;
- fModel = model;
- // serialize updates per viewer
- fViewerUpdateJob.setRule(getUpdateSchedulingRule());
- fViewerUpdateJob.setSystem(true);
- }
-
- /**
- * Returns the scheduling rule for viewer update job.
- *
- * @return rule or <code>null</code>
- */
- protected ISchedulingRule getUpdateSchedulingRule() {
- return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(getModel().getViewer());
- }
-
- /**
- * Returns the model this update is being performed for
- *
- * @return the model this update is being performed for
- */
- protected AsynchronousModel getModel() {
- return fModel;
- }
-
- /**
- * Returns the model node this update is rooted at
- *
- * @return the model node this update is rooted at
- */
- protected ModelNode getNode() {
- return fNode;
- }
-
- /**
- * Returns whether this update contains the given node.
- * That is, whether this update is for the same node or a child of
- * the given node.
- *
- * @param node node to test containment on
- * @return whether this update contains the given node
- */
- protected boolean contains(ModelNode node) {
- if (node == getNode()) {
- return true;
- }
- ModelNode parentNode = getNode().getParentNode();
- while (parentNode != null) {
- if (parentNode.equals(getNode())) {
- return true;
- }
- parentNode = parentNode.getParentNode();
- }
- return false;
- }
-
- @Override
+ // necessary to check if widget is disposed. The item may
+ // have been removed from the tree when another children update
+ // occurred.
+ getModel().viewerUpdateScheduled(AsynchronousRequestMonitor.this);
+ if (fDone) {
+ getModel().requestComplete(AsynchronousRequestMonitor.this);
+ }
+ if (!isCanceled() && !getNode().isDisposed()) {
+ IStatus status = getStatus();
+ if (status != null && !status.isOK()) {
+ getModel().getViewer().handlePresentationFailure(AsynchronousRequestMonitor.this, status);
+ } else {
+ performUpdate();
+ }
+ }
+ getModel().viewerUpdateComplete(AsynchronousRequestMonitor.this);
+ return Status.OK_STATUS;
+ }
+ };
+
+ /**
+ * Constructs an update rooted at the given item.
+ *
+ * @param node model node
+ * @param model model the node is in
+ */
+ public AsynchronousRequestMonitor(ModelNode node, AsynchronousModel model) {
+ fNode = node;
+ fModel = model;
+ // serialize updates per viewer
+ fViewerUpdateJob.setRule(getUpdateSchedulingRule());
+ fViewerUpdateJob.setSystem(true);
+ }
+
+ /**
+ * Returns the scheduling rule for viewer update job.
+ *
+ * @return rule or <code>null</code>
+ */
+ protected ISchedulingRule getUpdateSchedulingRule() {
+ return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(getModel().getViewer());
+ }
+
+ /**
+ * Returns the model this update is being performed for
+ *
+ * @return the model this update is being performed for
+ */
+ protected AsynchronousModel getModel() {
+ return fModel;
+ }
+
+ /**
+ * Returns the model node this update is rooted at
+ *
+ * @return the model node this update is rooted at
+ */
+ protected ModelNode getNode() {
+ return fNode;
+ }
+
+ /**
+ * Returns whether this update contains the given node.
+ * That is, whether this update is for the same node or a child of
+ * the given node.
+ *
+ * @param node node to test containment on
+ * @return whether this update contains the given node
+ */
+ protected boolean contains(ModelNode node) {
+ if (node == getNode()) {
+ return true;
+ }
+ ModelNode parentNode = getNode().getParentNode();
+ while (parentNode != null) {
+ if (parentNode.equals(getNode())) {
+ return true;
+ }
+ parentNode = parentNode.getParentNode();
+ }
+ return false;
+ }
+
+ @Override
public void setCanceled(boolean value) {
- super.setCanceled(value);
- if (value) {
- getModel().requestCanceled(this);
- }
- }
+ super.setCanceled(value);
+ if (value) {
+ getModel().requestCanceled(this);
+ }
+ }
- @Override
+ @Override
public final void done() {
- synchronized (this) {
- fDone = true;
+ synchronized (this) {
+ fDone = true;
}
scheduleViewerUpdate(0L);
}
- /**
- * Returns whether this request is done yet.
- *
- * @return if the request is done
- */
- protected synchronized boolean isDone() {
- return fDone;
- }
-
- protected void scheduleViewerUpdate(long ms) {
- if(!isCanceled()) {
+ /**
+ * Returns whether this request is done yet.
+ *
+ * @return if the request is done
+ */
+ protected synchronized boolean isDone() {
+ return fDone;
+ }
+
+ protected void scheduleViewerUpdate(long ms) {
+ if(!isCanceled()) {
fViewerUpdateJob.schedule(ms);
}
- }
+ }
- /**
+ /**
* Notification this update has been completed and should now be applied to
* this update's viewer. This method is called in the UI thread.
*/
- protected abstract void performUpdate();
-
- /**
- * Returns whether this update effectively contains the given update.
- * That is, whether this update will also perform the given update.
- *
- * @param update update to compare to
- * @return whether this update will also perform the given update
- */
- protected abstract boolean contains(AsynchronousRequestMonitor update);
+ protected abstract void performUpdate();
+
+ /**
+ * Returns whether this update effectively contains the given update.
+ * That is, whether this update will also perform the given update.
+ *
+ * @param update update to compare to
+ * @return whether this update will also perform the given update
+ */
+ protected abstract boolean contains(AsynchronousRequestMonitor update);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java
index 50d7014bd..a9f1a0c4b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java
@@ -43,13 +43,13 @@ public class AsynchronousSchedulingRuleFactory {
}
}
- class SerialPerObjectRule implements ISchedulingRule {
+ class SerialPerObjectRule implements ISchedulingRule {
- private Object fObject = null;
+ private Object fObject = null;
- public SerialPerObjectRule(Object lock) {
- fObject = lock;
- }
+ public SerialPerObjectRule(Object lock) {
+ fObject = lock;
+ }
@Override
public boolean contains(ISchedulingRule rule) {
@@ -65,7 +65,7 @@ public class AsynchronousSchedulingRuleFactory {
return false;
}
- }
+ }
private AsynchronousSchedulingRuleFactory() {}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableModel.java
index 4cfba8d89..92247cf22 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableModel.java
@@ -54,26 +54,26 @@ public class AsynchronousTableModel extends AsynchronousModel {
protected void added(Object[] elements) {
List<Object> kids = null;
boolean changed = false;
- synchronized (this) {
- ModelNode[] childrenNodes = getRootNode().getChildrenNodes();
- if (childrenNodes == null) {
+ synchronized (this) {
+ ModelNode[] childrenNodes = getRootNode().getChildrenNodes();
+ if (childrenNodes == null) {
kids = new ArrayList<>(elements.length);
- } else {
+ } else {
kids = new ArrayList<>(elements.length + childrenNodes.length);
- for (int i = 0; i < childrenNodes.length; i++) {
+ for (int i = 0; i < childrenNodes.length; i++) {
kids.add(childrenNodes[i].getElement());
}
- }
- for (int i = 0; i < elements.length; i++) {
- if (!kids.contains(elements[i])) {
- kids.add(elements[i]);
- changed = true;
- }
}
+ for (int i = 0; i < elements.length; i++) {
+ if (!kids.contains(elements[i])) {
+ kids.add(elements[i]);
+ changed = true;
+ }
+ }
+ }
+ if (changed) {
+ setChildren(getRootNode(), kids);
}
- if (changed) {
- setChildren(getRootNode(), kids);
- }
}
/**
@@ -97,27 +97,27 @@ public class AsynchronousTableModel extends AsynchronousModel {
protected void inserted(Object[] elements, int index) {
List<Object> kids = null;
boolean changed = false;
- synchronized (this) {
- ModelNode[] childrenNodes = getRootNode().getChildrenNodes();
- if (childrenNodes == null) {
+ synchronized (this) {
+ ModelNode[] childrenNodes = getRootNode().getChildrenNodes();
+ if (childrenNodes == null) {
kids = new ArrayList<>(elements.length);
- } else {
+ } else {
kids = new ArrayList<>(elements.length + childrenNodes.length);
- for (int i = 0; i < childrenNodes.length; i++) {
+ for (int i = 0; i < childrenNodes.length; i++) {
kids.add(childrenNodes[i].getElement());
}
- }
- for (int i = 0; i < elements.length; i++) {
- if (!kids.contains(elements[i])) {
- kids.add(index, elements[i]);
- index++;
- changed = true;
- }
}
+ for (int i = 0; i < elements.length; i++) {
+ if (!kids.contains(elements[i])) {
+ kids.add(index, elements[i]);
+ index++;
+ changed = true;
+ }
+ }
+ }
+ if (changed) {
+ setChildren(getRootNode(), kids);
}
- if (changed) {
- setChildren(getRootNode(), kids);
- }
}
/**
@@ -139,23 +139,23 @@ public class AsynchronousTableModel extends AsynchronousModel {
protected void removed(Object[] elements) {
List<Object> kids = null;
boolean changed = false;
- synchronized (this) {
- ModelNode[] childrenNodes = getRootNode().getChildrenNodes();
- if (childrenNodes != null) {
+ synchronized (this) {
+ ModelNode[] childrenNodes = getRootNode().getChildrenNodes();
+ if (childrenNodes != null) {
kids = new ArrayList<>(childrenNodes.length);
- for (int i = 0; i < childrenNodes.length; i++) {
+ for (int i = 0; i < childrenNodes.length; i++) {
kids.add(childrenNodes[i].getElement());
}
- for (int i = 0; i < elements.length; i++) {
- if (kids.remove(elements[i])) {
- changed = true;
- }
- }
- }
+ for (int i = 0; i < elements.length; i++) {
+ if (kids.remove(elements[i])) {
+ changed = true;
+ }
+ }
+ }
+ }
+ if (changed) {
+ setChildren(getRootNode(), kids);
}
- if (changed) {
- setChildren(getRootNode(), kids);
- }
}
/**
@@ -175,24 +175,24 @@ public class AsynchronousTableModel extends AsynchronousModel {
* @param replacement the element that replaced the old element
*/
protected void replaced(Object element, Object replacement) {
- Object[] filtered = filter(getRootNode().getElement(), new Object[] { replacement });
- if (filtered.length == 0) {
- remove(new Object[]{element});
- return;
- }
+ Object[] filtered = filter(getRootNode().getElement(), new Object[] { replacement });
+ if (filtered.length == 0) {
+ remove(new Object[]{element});
+ return;
+ }
List<ModelNode> list = new ArrayList<>();
- synchronized (this) {
- ModelNode[] nodes = getNodes(element);
- for (int i = 0; i < nodes.length; i++) {
+ synchronized (this) {
+ ModelNode[] nodes = getNodes(element);
+ for (int i = 0; i < nodes.length; i++) {
ModelNode node = nodes[i];
node.remap(replacement);
list.add(node);
}
}
- if (!list.isEmpty()) {
+ if (!list.isEmpty()) {
for (ModelNode node : list) {
- getViewer().nodeChanged(node);
- }
- }
+ getViewer().nodeChanged(node);
+ }
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java
index 8f0d2168c..a4715aa7f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java
@@ -55,135 +55,135 @@ import org.eclipse.ui.progress.WorkbenchJob;
*/
public class AsynchronousTableViewer extends AsynchronousViewer implements Listener {
- private Table fTable;
-
- private TableEditor fTableEditor;
-
- private TableEditorImpl fTableEditorImpl;
-
- public AsynchronousTableViewer(Composite parent) {
- this(parent, SWT.VIRTUAL);
- }
-
- public AsynchronousTableViewer(Composite parent, int style) {
- this(new Table(parent, style));
- }
-
- /**
- * Table must be SWT.VIRTUAL. This is intentional. Labels will never be
- * retrieved for non-visible items.
- *
- * @see SWT#VIRTUAL
- * @param table the backing table widget
- */
- public AsynchronousTableViewer(Table table) {
- Assert.isTrue((table.getStyle() & SWT.VIRTUAL) != 0);
- fTable = table;
- hookControl(fTable);
- fTableEditor = new TableEditor(fTable);
- fTableEditorImpl = createTableEditorImpl();
- }
-
- @Override
+ private Table fTable;
+
+ private TableEditor fTableEditor;
+
+ private TableEditorImpl fTableEditorImpl;
+
+ public AsynchronousTableViewer(Composite parent) {
+ this(parent, SWT.VIRTUAL);
+ }
+
+ public AsynchronousTableViewer(Composite parent, int style) {
+ this(new Table(parent, style));
+ }
+
+ /**
+ * Table must be SWT.VIRTUAL. This is intentional. Labels will never be
+ * retrieved for non-visible items.
+ *
+ * @see SWT#VIRTUAL
+ * @param table the backing table widget
+ */
+ public AsynchronousTableViewer(Table table) {
+ Assert.isTrue((table.getStyle() & SWT.VIRTUAL) != 0);
+ fTable = table;
+ hookControl(fTable);
+ fTableEditor = new TableEditor(fTable);
+ fTableEditorImpl = createTableEditorImpl();
+ }
+
+ @Override
protected void hookControl(Control control) {
- super.hookControl(control);
- control.addMouseListener(new MouseAdapter() {
- @Override
+ super.hookControl(control);
+ control.addMouseListener(new MouseAdapter() {
+ @Override
public void mouseDown(MouseEvent e) {
- fTableEditorImpl.handleMouseDown(e);
- }
- });
- }
+ fTableEditorImpl.handleMouseDown(e);
+ }
+ });
+ }
- @Override
+ @Override
public synchronized void dispose() {
- fTableEditor.dispose();
- fTable.dispose();
- super.dispose();
- }
+ fTableEditor.dispose();
+ fTable.dispose();
+ super.dispose();
+ }
- @Override
+ @Override
protected ISelection doAttemptSelectionToWidget(ISelection selection, boolean reveal) {
- if (acceptsSelection(selection)) {
+ if (acceptsSelection(selection)) {
List<?> list = ((IStructuredSelection) selection).toList();
- if (list == null) {
- fTable.deselectAll();
- return StructuredSelection.EMPTY;
- }
-
- int[] indices = new int[list.size()];
- ModelNode[] nodes = getModel().getRootNode().getChildrenNodes();
- if (nodes != null) {
- int index = 0;
-
- // I'm not sure if it would be faster to check TableItems first...
- for (int i = 0; i < nodes.length; i++) {
- Object element = nodes[i].getElement();
- if (list.contains(element)) {
- indices[index] = i;
- index++;
- }
- }
-
- fTable.setSelection(indices);
- if (reveal && indices.length > 0) {
- TableItem item = fTable.getItem(indices[0]);
- fTable.showItem(item);
- }
- }
- }
- return StructuredSelection.EMPTY;
- }
-
- @Override
+ if (list == null) {
+ fTable.deselectAll();
+ return StructuredSelection.EMPTY;
+ }
+
+ int[] indices = new int[list.size()];
+ ModelNode[] nodes = getModel().getRootNode().getChildrenNodes();
+ if (nodes != null) {
+ int index = 0;
+
+ // I'm not sure if it would be faster to check TableItems first...
+ for (int i = 0; i < nodes.length; i++) {
+ Object element = nodes[i].getElement();
+ if (list.contains(element)) {
+ indices[index] = i;
+ index++;
+ }
+ }
+
+ fTable.setSelection(indices);
+ if (reveal && indices.length > 0) {
+ TableItem item = fTable.getItem(indices[0]);
+ fTable.showItem(item);
+ }
+ }
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ @Override
protected boolean acceptsSelection(ISelection selection) {
- return selection instanceof IStructuredSelection;
- }
+ return selection instanceof IStructuredSelection;
+ }
- @Override
+ @Override
protected ISelection getEmptySelection() {
- return StructuredSelection.EMPTY;
- }
+ return StructuredSelection.EMPTY;
+ }
- protected Widget getParent(Widget widget) {
- if (widget instanceof TableItem) {
- return fTable;
- }
- return null;
- }
+ protected Widget getParent(Widget widget) {
+ if (widget instanceof TableItem) {
+ return fTable;
+ }
+ return null;
+ }
- @Override
+ @Override
protected List getSelectionFromWidget() {
- TableItem[] selection = fTable.getSelection();
+ TableItem[] selection = fTable.getSelection();
List<Object> datas = new ArrayList<>(selection.length);
- for (int i = 0; i < selection.length; i++) {
- datas.add(selection[i].getData());
- }
- return datas;
- }
+ for (int i = 0; i < selection.length; i++) {
+ datas.add(selection[i].getData());
+ }
+ return datas;
+ }
- @Override
+ @Override
public Control getControl() {
- return fTable;
- }
+ return fTable;
+ }
- public Table getTable() {
- return (Table) getControl();
- }
+ public Table getTable() {
+ return (Table) getControl();
+ }
- @Override
+ @Override
protected void internalRefresh(ModelNode node) {
- super.internalRefresh(node);
- if (node.getElement().equals(getInput())) {
- updateChildren(node);
- }
- }
+ super.internalRefresh(node);
+ if (node.getElement().equals(getInput())) {
+ updateChildren(node);
+ }
+ }
- @Override
+ @Override
protected void restoreLabels(Item item) {
- TableItem tableItem = (TableItem) item;
- String[] values = (String[]) tableItem.getData(OLD_LABEL);
- Image[] images = (Image[]) tableItem.getData(OLD_IMAGE);
+ TableItem tableItem = (TableItem) item;
+ String[] values = (String[]) tableItem.getData(OLD_LABEL);
+ Image[] images = (Image[]) tableItem.getData(OLD_IMAGE);
if (values != null) {
tableItem.setText(values);
tableItem.setImage(images);
@@ -192,289 +192,289 @@ public class AsynchronousTableViewer extends AsynchronousViewer implements Liste
@Override
public void setLabels(Widget widget, String[] labels, ImageDescriptor[] imageDescriptors) {
- TableItem item = (TableItem) widget;
- item.setText(labels);
- item.setData(OLD_LABEL, labels);
- Image[] images = new Image[labels.length];
- item.setData(OLD_IMAGE, images);
- if (imageDescriptors != null) {
- for (int i = 0; i < images.length; i++) {
- if (i < imageDescriptors.length) {
+ TableItem item = (TableItem) widget;
+ item.setText(labels);
+ item.setData(OLD_LABEL, labels);
+ Image[] images = new Image[labels.length];
+ item.setData(OLD_IMAGE, images);
+ if (imageDescriptors != null) {
+ for (int i = 0; i < images.length; i++) {
+ if (i < imageDescriptors.length) {
images[i] = getImage(imageDescriptors[i]);
}
- }
- }
- item.setImage(images);
- }
+ }
+ }
+ item.setImage(images);
+ }
- @Override
+ @Override
public void setColors(Widget widget, RGB[] foregrounds, RGB[] backgrounds) {
- TableItem item = (TableItem) widget;
- if (foregrounds == null) {
- foregrounds = new RGB[fTable.getColumnCount()];
- }
- if (backgrounds == null) {
- backgrounds = new RGB[fTable.getColumnCount()];
- }
-
- for (int i = 0; i < foregrounds.length; i++) {
- Color fg = getColor(foregrounds[i]);
- item.setForeground(i, fg);
- }
- for (int i = 0; i < backgrounds.length; i++) {
- Color bg = getColor(backgrounds[i]);
- item.setBackground(i, bg);
- }
- }
-
- @Override
+ TableItem item = (TableItem) widget;
+ if (foregrounds == null) {
+ foregrounds = new RGB[fTable.getColumnCount()];
+ }
+ if (backgrounds == null) {
+ backgrounds = new RGB[fTable.getColumnCount()];
+ }
+
+ for (int i = 0; i < foregrounds.length; i++) {
+ Color fg = getColor(foregrounds[i]);
+ item.setForeground(i, fg);
+ }
+ for (int i = 0; i < backgrounds.length; i++) {
+ Color bg = getColor(backgrounds[i]);
+ item.setBackground(i, bg);
+ }
+ }
+
+ @Override
public void setFonts(Widget widget, FontData[] fontDatas) {
- TableItem item = (TableItem) widget;
- if (fontDatas != null) {
- for (int i = 0; i < fontDatas.length; i++) {
- Font font = getFont(fontDatas[i]);
- item.setFont(i, font);
- }
- }
- }
-
- public void setColumnHeaders(final String[] headers) {
- fTableEditorImpl.setColumnProperties(headers);
- }
-
- public Object[] getColumnProperties() {
- return fTableEditorImpl.getColumnProperties();
- }
-
- public void showColumnHeader(final boolean showHeaders) {
- WorkbenchJob job = new WorkbenchJob("Set Header Visibility") { //$NON-NLS-1$
- @Override
+ TableItem item = (TableItem) widget;
+ if (fontDatas != null) {
+ for (int i = 0; i < fontDatas.length; i++) {
+ Font font = getFont(fontDatas[i]);
+ item.setFont(i, font);
+ }
+ }
+ }
+
+ public void setColumnHeaders(final String[] headers) {
+ fTableEditorImpl.setColumnProperties(headers);
+ }
+
+ public Object[] getColumnProperties() {
+ return fTableEditorImpl.getColumnProperties();
+ }
+
+ public void showColumnHeader(final boolean showHeaders) {
+ WorkbenchJob job = new WorkbenchJob("Set Header Visibility") { //$NON-NLS-1$
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (!fTable.isDisposed())
- {
- fTable.setHeaderVisible(showHeaders);
- }
- return Status.OK_STATUS;
- }
- };
- job.setPriority(Job.INTERACTIVE);
- job.setSystem(true);
- job.schedule();
- }
-
- @Override
+ if (!fTable.isDisposed())
+ {
+ fTable.setHeaderVisible(showHeaders);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setPriority(Job.INTERACTIVE);
+ job.setSystem(true);
+ job.schedule();
+ }
+
+ @Override
public void reveal(Object element) {
- Assert.isNotNull(element);
- Widget w = findItem(element);
- if (w instanceof TableItem) {
+ Assert.isNotNull(element);
+ Widget w = findItem(element);
+ if (w instanceof TableItem) {
getTable().showItem((TableItem) w);
}
- }
-
- /**
- * Sets the cell editors of this table viewer.
- *
- * @param editors
- * the list of cell editors
- */
- public void setCellEditors(CellEditor[] editors) {
- fTableEditorImpl.setCellEditors(editors);
- }
-
- /**
- * Sets the cell modifier of this table viewer.
- *
- * @param modifier
- * the cell modifier
- */
- public void setCellModifier(ICellModifier modifier) {
- fTableEditorImpl.setCellModifier(modifier);
- }
-
- protected TableEditorImpl createTableEditorImpl() {
- return new TableEditorImpl(this) {
- @Override
+ }
+
+ /**
+ * Sets the cell editors of this table viewer.
+ *
+ * @param editors
+ * the list of cell editors
+ */
+ public void setCellEditors(CellEditor[] editors) {
+ fTableEditorImpl.setCellEditors(editors);
+ }
+
+ /**
+ * Sets the cell modifier of this table viewer.
+ *
+ * @param modifier
+ * the cell modifier
+ */
+ public void setCellModifier(ICellModifier modifier) {
+ fTableEditorImpl.setCellModifier(modifier);
+ }
+
+ protected TableEditorImpl createTableEditorImpl() {
+ return new TableEditorImpl(this) {
+ @Override
Rectangle getBounds(Item item, int columnNumber) {
- return ((TableItem) item).getBounds(columnNumber);
- }
+ return ((TableItem) item).getBounds(columnNumber);
+ }
- @Override
+ @Override
int getColumnCount() {
- return getTable().getColumnCount();
- }
+ return getTable().getColumnCount();
+ }
- @Override
+ @Override
Item[] getSelection() {
- return getTable().getSelection();
- }
+ return getTable().getSelection();
+ }
- @Override
+ @Override
void setEditor(Control w, Item item, int columnNumber) {
- fTableEditor.setEditor(w, (TableItem) item, columnNumber);
- }
+ fTableEditor.setEditor(w, (TableItem) item, columnNumber);
+ }
- @Override
+ @Override
void setSelection(StructuredSelection selection, boolean b) {
- AsynchronousTableViewer.this.setSelection(selection, b);
- }
+ AsynchronousTableViewer.this.setSelection(selection, b);
+ }
- @Override
+ @Override
void showSelection() {
- getTable().showSelection();
- }
+ getTable().showSelection();
+ }
- @Override
+ @Override
void setLayoutData(CellEditor.LayoutData layoutData) {
- fTableEditor.grabHorizontal = layoutData.grabHorizontal;
- fTableEditor.horizontalAlignment = layoutData.horizontalAlignment;
- fTableEditor.minimumWidth = layoutData.minimumWidth;
- }
+ fTableEditor.grabHorizontal = layoutData.grabHorizontal;
+ fTableEditor.horizontalAlignment = layoutData.horizontalAlignment;
+ fTableEditor.minimumWidth = layoutData.minimumWidth;
+ }
- @Override
+ @Override
void handleDoubleClickEvent() {
- Viewer viewer = getViewer();
- fireDoubleClick(new DoubleClickEvent(viewer, viewer.getSelection()));
- fireOpen(new OpenEvent(viewer, viewer.getSelection()));
- }
- };
- }
-
- @Override
+ Viewer viewer = getViewer();
+ fireDoubleClick(new DoubleClickEvent(viewer, viewer.getSelection()));
+ fireOpen(new OpenEvent(viewer, viewer.getSelection()));
+ }
+ };
+ }
+
+ @Override
protected ISelection newSelectionFromWidget() {
- Control control = getControl();
- if (control == null || control.isDisposed()) {
- return StructuredSelection.EMPTY;
- }
+ Control control = getControl();
+ if (control == null || control.isDisposed()) {
+ return StructuredSelection.EMPTY;
+ }
List<?> list = getSelectionFromWidget();
- return new StructuredSelection(list);
- }
-
- public CellEditor[] getCellEditors() {
- return fTableEditorImpl.getCellEditors();
- }
-
- public ICellModifier getCellModifier() {
- return fTableEditorImpl.getCellModifier();
- }
-
- public boolean isCellEditorActive() {
- return fTableEditorImpl.isCellEditorActive();
- }
-
- /**
- * This is not asynchronous. This method must be called in the UI Thread.
- */
- public void cancelEditing() {
- fTableEditorImpl.cancelEditing();
- }
-
- /**
- * This is not asynchronous. This method must be called in the UI Thread.
- *
- * @param element
- * The element to edit. Each element maps to a row in the Table.
- * @param column
- * The column to edit
- */
- public void editElement(Object element, int column) {
- fTableEditorImpl.editElement(element, column);
- }
-
- protected int indexForElement(Object element) {
+ return new StructuredSelection(list);
+ }
+
+ public CellEditor[] getCellEditors() {
+ return fTableEditorImpl.getCellEditors();
+ }
+
+ public ICellModifier getCellModifier() {
+ return fTableEditorImpl.getCellModifier();
+ }
+
+ public boolean isCellEditorActive() {
+ return fTableEditorImpl.isCellEditorActive();
+ }
+
+ /**
+ * This is not asynchronous. This method must be called in the UI Thread.
+ */
+ public void cancelEditing() {
+ fTableEditorImpl.cancelEditing();
+ }
+
+ /**
+ * This is not asynchronous. This method must be called in the UI Thread.
+ *
+ * @param element
+ * The element to edit. Each element maps to a row in the Table.
+ * @param column
+ * The column to edit
+ */
+ public void editElement(Object element, int column) {
+ fTableEditorImpl.editElement(element, column);
+ }
+
+ protected int indexForElement(Object element) {
ViewerComparator comparator = getComparator();
- if (comparator == null) {
+ if (comparator == null) {
return fTable.getItemCount();
}
- int count = fTable.getItemCount();
- int min = 0, max = count - 1;
- while (min <= max) {
- int mid = (min + max) / 2;
- Object data = fTable.getItem(mid).getData();
- int compare = comparator.compare(this, data, element);
- if (compare == 0) {
- // find first item > element
- while (compare == 0) {
- ++mid;
- if (mid >= count) {
- break;
- }
- data = fTable.getItem(mid).getData();
- compare = comparator.compare(this, data, element);
- }
- return mid;
- }
- if (compare < 0) {
+ int count = fTable.getItemCount();
+ int min = 0, max = count - 1;
+ while (min <= max) {
+ int mid = (min + max) / 2;
+ Object data = fTable.getItem(mid).getData();
+ int compare = comparator.compare(this, data, element);
+ if (compare == 0) {
+ // find first item > element
+ while (compare == 0) {
+ ++mid;
+ if (mid >= count) {
+ break;
+ }
+ data = fTable.getItem(mid).getData();
+ compare = comparator.compare(this, data, element);
+ }
+ return mid;
+ }
+ if (compare < 0) {
min = mid + 1;
} else {
max = mid - 1;
}
- }
- return min;
- }
+ }
+ return min;
+ }
- public void add(Object element) {
- if (element != null) {
+ public void add(Object element) {
+ if (element != null) {
add(new Object[] { element });
}
- }
+ }
- public void add(Object[] elements) {
- if (elements == null || elements.length == 0)
+ public void add(Object[] elements) {
+ if (elements == null || elements.length == 0)
{
return; // done
}
- ((AsynchronousTableModel)getModel()).add(elements);
- }
+ ((AsynchronousTableModel)getModel()).add(elements);
+ }
- public void remove(Object element) {
- if (element != null) {
+ public void remove(Object element) {
+ if (element != null) {
remove(new Object[] { element });
}
- }
+ }
- public void remove(final Object[] elements) {
- if (elements == null || elements.length == 0)
+ public void remove(final Object[] elements) {
+ if (elements == null || elements.length == 0)
{
return; // done
}
- ((AsynchronousTableModel)getModel()).remove(elements);
- }
+ ((AsynchronousTableModel)getModel()).remove(elements);
+ }
- public void insert(Object element, int position) {
- if (element != null) {
+ public void insert(Object element, int position) {
+ if (element != null) {
insert(new Object[] { element }, position);
}
- }
+ }
- public void insert(Object[] elements, int position) {
- if (elements == null || elements.length == 0) {
+ public void insert(Object[] elements, int position) {
+ if (elements == null || elements.length == 0) {
return;
}
- ((AsynchronousTableModel)getModel()).insert(elements, position);
- }
+ ((AsynchronousTableModel)getModel()).insert(elements, position);
+ }
- public void replace(Object element, Object replacement) {
- if (element == null || replacement == null)
+ public void replace(Object element, Object replacement) {
+ if (element == null || replacement == null)
{
throw new IllegalArgumentException("unexpected null parameter"); //$NON-NLS-1$
}
- ((AsynchronousTableModel)getModel()).replace(element, replacement);
- }
+ ((AsynchronousTableModel)getModel()).replace(element, replacement);
+ }
@Override
protected AsynchronousModel createModel() {
return new AsynchronousTableModel(this);
}
- @Override
+ @Override
protected void setItemCount(Widget parent, int itemCount) {
fTable.setItemCount(itemCount);
}
protected int getVisibleItemCount(int top) {
- int itemCount = fTable.getItemCount();
- return Math.min((fTable.getBounds().height / fTable.getItemHeight()) + 2, itemCount - top);
- }
+ int itemCount = fTable.getItemCount();
+ return Math.min((fTable.getBounds().height / fTable.getItemHeight()) + 2, itemCount - top);
+ }
@Override
public AbstractUpdatePolicy createUpdatePolicy() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
index 55659efab..54511edf7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java
@@ -237,7 +237,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
}
if (fUpdatePolicy == null) {
fUpdatePolicy = createUpdatePolicy();
- fUpdatePolicy.init(this);
+ fUpdatePolicy.init(this);
}
if (fModel != null) {
fModel.dispose();
@@ -251,7 +251,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
unmapAllElements();
getControl().setData(null);
}
- refresh();
+ refresh();
}
/**
@@ -269,14 +269,14 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
public abstract AbstractUpdatePolicy createUpdatePolicy();
Image[] getImages(ImageDescriptor[] descriptors) {
- if (descriptors == null || descriptors.length == 0) {
- String[] columns = getPresentationContext().getColumns();
- if (columns == null) {
- return new Image[1];
- } else {
- return new Image[columns.length];
- }
- }
+ if (descriptors == null || descriptors.length == 0) {
+ String[] columns = getPresentationContext().getColumns();
+ if (columns == null) {
+ return new Image[1];
+ } else {
+ return new Image[columns.length];
+ }
+ }
Image[] images = new Image[descriptors.length];
for (int i = 0; i < images.length; i++) {
images[i] = getImage(descriptors[i]);
@@ -306,12 +306,12 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
protected Font[] getFonts(FontData[] fontDatas) {
if (fontDatas == null || fontDatas.length == 0) {
- String[] columns = getPresentationContext().getColumns();
- if (columns == null) {
- return new Font[1];
- } else {
- return new Font[columns.length];
- }
+ String[] columns = getPresentationContext().getColumns();
+ if (columns == null) {
+ return new Font[1];
+ } else {
+ return new Font[columns.length];
+ }
}
Font[] fonts = new Font[fontDatas.length];
@@ -341,14 +341,14 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
}
protected Color[] getColors(RGB[] rgb) {
- if (rgb == null || rgb.length == 0) {
- String[] columns = getPresentationContext().getColumns();
- if (columns == null) {
- return new Color[1];
- } else {
- return new Color[columns.length];
- }
- }
+ if (rgb == null || rgb.length == 0) {
+ String[] columns = getPresentationContext().getColumns();
+ if (columns == null) {
+ return new Color[1];
+ } else {
+ return new Color[columns.length];
+ }
+ }
Color[] colors = new Color[rgb.length];
for (int i = 0; i < colors.length; i++) {
colors[i] = getColor(rgb[i]);
@@ -399,16 +399,16 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
return null;
}
- @Override
+ @Override
protected Widget doFindInputItem(Object element) {
- if (element instanceof ModelNode) {
+ if (element instanceof ModelNode) {
ModelNode node = (ModelNode) element;
if (node.getElement().equals(getInput())) {
return getControl();
}
}
- return null;
- }
+ return null;
+ }
@Override
protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
@@ -693,19 +693,19 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
synchronized (AsynchronousViewer.this) {
- if (!getControl().isDisposed()) {
- if (fPendingSelection == null || fPendingSelection.isEmpty()) {
- ISelection tempSelection = fCurrentSelection;
- if (tempSelection == null) {
- tempSelection = new StructuredSelection();
- }
- if (!tempSelection.equals(newSelectionFromWidget())) {
- restoreSelection(tempSelection);
- }
- }
- }
+ if (!getControl().isDisposed()) {
+ if (fPendingSelection == null || fPendingSelection.isEmpty()) {
+ ISelection tempSelection = fCurrentSelection;
+ if (tempSelection == null) {
+ tempSelection = new StructuredSelection();
+ }
+ if (!tempSelection.equals(newSelectionFromWidget())) {
+ restoreSelection(tempSelection);
+ }
+ }
+ }
}
- return Status.OK_STATUS;
+ return Status.OK_STATUS;
}
};
@@ -843,7 +843,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
* @return if there are any more pending updates in the viewer
*/
public synchronized boolean hasPendingUpdates() {
- return getModel().hasPendingUpdates();
+ return getModel().hasPendingUpdates();
}
/**
@@ -860,22 +860,22 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
*
* @param item the widget
*/
- protected abstract void clear(Widget item);
-
- /**
- * Clears the children of the widget.
- *
- * @param item the widget to clear children from
- */
- protected abstract void clearChildren(Widget item);
-
- /**
- * Clears the child at the given index.
- *
- * @param parent the parent widget
- * @param childIndex the index of the child widget to clear
- */
- protected abstract void clearChild(Widget parent, int childIndex);
+ protected abstract void clear(Widget item);
+
+ /**
+ * Clears the children of the widget.
+ *
+ * @param item the widget to clear children from
+ */
+ protected abstract void clearChildren(Widget item);
+
+ /**
+ * Clears the child at the given index.
+ *
+ * @param parent the parent widget
+ * @param childIndex the index of the child widget to clear
+ */
+ protected abstract void clearChild(Widget parent, int childIndex);
/**
* Returns the child widget at the given index for the given parent or
@@ -895,12 +895,12 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
*/
protected abstract void setItemCount(Widget parent, int itemCount);
- /**
- * Attempt pending updates. Subclasses may override but should call super.
- */
- protected void attemptPendingUpdates() {
- attemptSelection(false);
- }
+ /**
+ * Attempt pending updates. Subclasses may override but should call super.
+ */
+ protected void attemptPendingUpdates() {
+ attemptSelection(false);
+ }
/**
* Notification a node's children have changed.
@@ -975,33 +975,33 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
}
}
- /**
- * Returns the node corresponding to the given widget or <code>null</code>
- * @param widget widget for which a node is requested
- * @return node or <code>null</code>
- */
- protected ModelNode findNode(Widget widget) {
- ModelNode[] nodes = getModel().getNodes(widget.getData());
- if (nodes != null) {
- for (int i = 0; i < nodes.length; i++) {
+ /**
+ * Returns the node corresponding to the given widget or <code>null</code>
+ * @param widget widget for which a node is requested
+ * @return node or <code>null</code>
+ */
+ protected ModelNode findNode(Widget widget) {
+ ModelNode[] nodes = getModel().getNodes(widget.getData());
+ if (nodes != null) {
+ for (int i = 0; i < nodes.length; i++) {
ModelNode node = nodes[i];
Widget item = findItem(node);
if (widget == item) {
return node;
}
}
- }
- return null;
- }
-
- /**
- * Returns the item for the node or <code>null</code>
- * @param node the model node
- * @return the widget or <code>null</code>
- */
- protected Widget findItem(ModelNode node) {
- return findItem((Object)node);
- }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the item for the node or <code>null</code>
+ * @param node the model node
+ * @return the widget or <code>null</code>
+ */
+ protected Widget findItem(ModelNode node) {
+ return findItem((Object)node);
+ }
/*
* A virtual item has been exposed in the control, map its data.
@@ -1009,7 +1009,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
@Override
public void handleEvent(final Event event) {
update((Item)event.item, event.index);
- }
+ }
/**
* Update the given item.
@@ -1035,10 +1035,10 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
ModelNode parentNode = nodes[i];
Widget parentWidget = findItem(parentNode);
if (parentWidget == parentItem) {
- ModelNode[] childrenNodes = parentNode.getChildrenNodes();
- if (childrenNodes != null && index < childrenNodes.length) {
- node = childrenNodes[index];
- }
+ ModelNode[] childrenNodes = parentNode.getChildrenNodes();
+ if (childrenNodes != null && index < childrenNodes.length) {
+ node = childrenNodes[index];
+ }
}
}
}
@@ -1089,11 +1089,11 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
// map the node to the element and refresh it
if (node != null) {
mapElement(node, item);
- item.setData(node.getElement());
- if (DebugUIPlugin.DEBUG_VIEWER) {
+ item.setData(node.getElement());
+ if (DebugUIPlugin.DEBUG_VIEWER) {
DebugUIPlugin.trace("\titem mapped: " + node); //$NON-NLS-1$
- }
- internalRefresh(node);
+ }
+ internalRefresh(node);
} else {
if (DebugUIPlugin.DEBUG_VIEWER) {
DebugUIPlugin.trace("\tFAILED - unable to find corresponding node"); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
index 6405632f6..b47f2125e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java
@@ -30,63 +30,63 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IChildrenRequestMonitor
*/
class ChildrenRequestMonitor extends AsynchronousRequestMonitor implements IChildrenRequestMonitor {
- private boolean fFirstUpdate = true;
+ private boolean fFirstUpdate = true;
/**
* Collection of children retrieved
*/
private List<Object> fChildren = new ArrayList<>();
- /**
- * Constucts a monitor to retrieve and update the children of the given
- * node.
- *
- * @param parent parent to retrieve children for
- * @param model model being updated
- */
- ChildrenRequestMonitor(ModelNode parent, AsynchronousModel model) {
- super(parent, model);
- }
+ /**
+ * Constucts a monitor to retrieve and update the children of the given
+ * node.
+ *
+ * @param parent parent to retrieve children for
+ * @param model model being updated
+ */
+ ChildrenRequestMonitor(ModelNode parent, AsynchronousModel model) {
+ super(parent, model);
+ }
- @Override
+ @Override
public void addChild(Object child) {
- synchronized (fChildren) {
- fChildren.add(child);
- }
+ synchronized (fChildren) {
+ fChildren.add(child);
+ }
- scheduleViewerUpdate(250);
- }
+ scheduleViewerUpdate(250);
+ }
- @Override
+ @Override
public void addChildren(Object[] children) {
- synchronized (fChildren) {
- for (int i = 0; i < children.length; i++) {
- fChildren.add(children[i]);
- }
- }
+ synchronized (fChildren) {
+ for (int i = 0; i < children.length; i++) {
+ fChildren.add(children[i]);
+ }
+ }
- scheduleViewerUpdate(0);
- }
+ scheduleViewerUpdate(0);
+ }
- @Override
+ @Override
protected boolean contains(AsynchronousRequestMonitor update) {
- return (update instanceof ChildrenRequestMonitor) && contains(update.getNode());
- }
+ return (update instanceof ChildrenRequestMonitor) && contains(update.getNode());
+ }
- @Override
+ @Override
protected void performUpdate() {
- synchronized (fChildren) {
- if (fFirstUpdate) {
- getModel().setChildren(getNode(), fChildren);
- fFirstUpdate = false;
- } else {
+ synchronized (fChildren) {
+ if (fFirstUpdate) {
+ getModel().setChildren(getNode(), fChildren);
+ fFirstUpdate = false;
+ } else {
for (Iterator<Object> iter = fChildren.iterator(); iter.hasNext();) {
- Object child = iter.next();
- getModel().add(getNode(), child);
- }
- }
- fChildren.clear();
- }
- }
+ Object child = iter.next();
+ getModel().add(getNode(), child);
+ }
+ }
+ fChildren.clear();
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/LabelRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/LabelRequestMonitor.java
index a80c019a5..c079d5748 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/LabelRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/LabelRequestMonitor.java
@@ -68,10 +68,10 @@ class LabelRequestMonitor extends AsynchronousRequestMonitor implements ILabelRe
AsynchronousViewer viewer = getModel().getViewer();
Widget widget = viewer.findItem(getNode());
if (widget != null && !widget.isDisposed()) {
- viewer.setLabels(widget, fLabels, fImageDescriptors);
- viewer.setColors(widget, fForegrounds, fBackgrounds);
- viewer.setFonts(widget, fFontDatas);
- }
+ viewer.setLabels(widget, fLabels, fImageDescriptors);
+ viewer.setColors(widget, fForegrounds, fBackgrounds);
+ viewer.setFonts(widget, fFontDatas);
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java
index 4bca52a57..5888a294b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java
@@ -40,9 +40,9 @@ public class ModelNode {
return fElement;
}
- public synchronized void remap(Object element) {
- fElement = element;
- }
+ public synchronized void remap(Object element) {
+ fElement = element;
+ }
public ModelNode getParentNode() {
return fParent;
@@ -62,12 +62,12 @@ public class ModelNode {
public synchronized void dispose() {
fDisposed = true;
- ModelNode[] childrenNodes = getChildrenNodes();
- if (childrenNodes != null) {
- for (int i = 0; i < childrenNodes.length; i++) {
- childrenNodes[i].dispose();
- }
- }
+ ModelNode[] childrenNodes = getChildrenNodes();
+ if (childrenNodes != null) {
+ for (int i = 0; i < childrenNodes.length; i++) {
+ childrenNodes[i].dispose();
+ }
+ }
}
/**
@@ -121,27 +121,27 @@ public class ModelNode {
}
}
- /**
- * Removes the given child from this node.
- *
- * @param child
- */
- public synchronized void removeChild(ModelNode child) {
- if (fChildren != null) {
- for (int i = 0; i < fChildren.length; i++) {
- ModelNode kid = fChildren[i];
- if (child == kid) {
- ModelNode[] newNodes= new ModelNode[fChildren.length - 1];
- System.arraycopy(fChildren, 0, newNodes, 0, i);
- if (i < newNodes.length) {
- System.arraycopy(fChildren, i + 1, newNodes, i, newNodes.length - i);
- }
- fChildren = newNodes;
- return;
- }
- }
- }
- }
+ /**
+ * Removes the given child from this node.
+ *
+ * @param child
+ */
+ public synchronized void removeChild(ModelNode child) {
+ if (fChildren != null) {
+ for (int i = 0; i < fChildren.length; i++) {
+ ModelNode kid = fChildren[i];
+ if (child == kid) {
+ ModelNode[] newNodes= new ModelNode[fChildren.length - 1];
+ System.arraycopy(fChildren, 0, newNodes, 0, i);
+ if (i < newNodes.length) {
+ System.arraycopy(fChildren, i + 1, newNodes, i, newNodes.length - i);
+ }
+ fChildren = newNodes;
+ return;
+ }
+ }
+ }
+ }
/**
* Sets the children for this node
@@ -164,50 +164,50 @@ public class ModelNode {
*/
public synchronized int getChildCount() {
if (fChildren == null) {
- if (isContainer()) {
- return 1;
- }
+ if (isContainer()) {
+ return 1;
+ }
return 0;
}
return fChildren.length;
}
- /**
- * Returns the index of the given child in this parent, or -1
- *
- * @param child
- */
- public synchronized int getChildIndex(ModelNode child) {
- if (fChildren != null) {
- for (int i = 0; i < fChildren.length; i++) {
- if (child == fChildren[i]) {
- return i;
- }
- }
- }
- return -1;
- }
-
- /**
- * Sets whether this node has children.
- *
- * @param container
- */
- public synchronized void setIsContainer(boolean container) {
- fIsContainer = container;
- }
-
- @Override
+ /**
+ * Returns the index of the given child in this parent, or -1
+ *
+ * @param child
+ */
+ public synchronized int getChildIndex(ModelNode child) {
+ if (fChildren != null) {
+ for (int i = 0; i < fChildren.length; i++) {
+ if (child == fChildren[i]) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Sets whether this node has children.
+ *
+ * @param container
+ */
+ public synchronized void setIsContainer(boolean container) {
+ fIsContainer = container;
+ }
+
+ @Override
public String toString() {
- StringBuilder buf = new StringBuilder();
- if (isDisposed()) {
- buf.append("[DISPOSED] "); //$NON-NLS-1$
- }
- if (isContainer()) {
- buf.append("[+] "); //$NON-NLS-1$
- }
- buf.append(getElement());
- return buf.toString();
- }
+ StringBuilder buf = new StringBuilder();
+ if (isDisposed()) {
+ buf.append("[DISPOSED] "); //$NON-NLS-1$
+ }
+ if (isContainer()) {
+ buf.append("[+] "); //$NON-NLS-1$
+ }
+ buf.append(getElement());
+ return buf.toString();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PartPresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PartPresentationContext.java
index 2c350af9b..1e2f148f2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PartPresentationContext.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/PartPresentationContext.java
@@ -36,7 +36,7 @@ public class PartPresentationContext extends PresentationContext {
@Override
public IWorkbenchPart getPart() {
- return super.getPart();
+ return super.getPart();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java
index 7c8ff41de..83c471574 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java
@@ -25,88 +25,88 @@ import org.eclipse.jface.viewers.StructuredSelection;
*/
public class TableUpdatePolicy extends org.eclipse.debug.internal.ui.viewers.AbstractUpdatePolicy implements IModelChangedListener {
- @Override
+ @Override
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- updateNodes(new IModelDelta[] {delta});
- }
+ updateNodes(new IModelDelta[] {delta});
+ }
- private void handleState(IModelDelta node) {
- AsynchronousViewer viewer = getViewer();
- if (viewer != null) {
- Object element = node.getElement();
+ private void handleState(IModelDelta node) {
+ AsynchronousViewer viewer = getViewer();
+ if (viewer != null) {
+ Object element = node.getElement();
viewer.update(element);
- updateSelection(element, node.getFlags());
- }
- }
- private void handleContent(IModelDelta node) {
- AsynchronousViewer viewer = getViewer();
- if (viewer != null) {
- Object element = node.getElement();
+ updateSelection(element, node.getFlags());
+ }
+ }
+ private void handleContent(IModelDelta node) {
+ AsynchronousViewer viewer = getViewer();
+ if (viewer != null) {
+ Object element = node.getElement();
viewer.refresh(element);
- updateSelection(element, node.getFlags());
- }
- }
+ updateSelection(element, node.getFlags());
+ }
+ }
- private void updateSelection(Object element, int flags) {
- AsynchronousViewer viewer = getViewer();
- if (viewer != null) {
- if ((flags & IModelDelta.SELECT) != 0) {
- getViewer().setSelection(new StructuredSelection(element));
- }
- }
- }
+ private void updateSelection(Object element, int flags) {
+ AsynchronousViewer viewer = getViewer();
+ if (viewer != null) {
+ if ((flags & IModelDelta.SELECT) != 0) {
+ getViewer().setSelection(new StructuredSelection(element));
+ }
+ }
+ }
- protected void updateNodes(IModelDelta[] nodes) {
- for (int i = 0; i < nodes.length; i++) {
- IModelDelta node = nodes[i];
- int flags = node.getFlags();
+ protected void updateNodes(IModelDelta[] nodes) {
+ for (int i = 0; i < nodes.length; i++) {
+ IModelDelta node = nodes[i];
+ int flags = node.getFlags();
- if ((flags & IModelDelta.STATE) != 0) {
- handleState(node);
- }
- if ((flags & IModelDelta.CONTENT) != 0) {
- handleContent(node);
- }
- if ((flags & IModelDelta.ADDED) != 0) {
- handleAdd(node);
- }
- if ((flags & IModelDelta.REMOVED) != 0) {
- handleRemove(node);
- }
- if ((flags & IModelDelta.REPLACED) != 0) {
- handleReplace(node);
- }
- if ((flags & IModelDelta.INSERTED) != 0) {
- handleInsert(node);
- }
+ if ((flags & IModelDelta.STATE) != 0) {
+ handleState(node);
+ }
+ if ((flags & IModelDelta.CONTENT) != 0) {
+ handleContent(node);
+ }
+ if ((flags & IModelDelta.ADDED) != 0) {
+ handleAdd(node);
+ }
+ if ((flags & IModelDelta.REMOVED) != 0) {
+ handleRemove(node);
+ }
+ if ((flags & IModelDelta.REPLACED) != 0) {
+ handleReplace(node);
+ }
+ if ((flags & IModelDelta.INSERTED) != 0) {
+ handleInsert(node);
+ }
- IModelDelta[] childNodes = node.getChildDeltas();
- updateNodes(childNodes);
- }
- }
+ IModelDelta[] childNodes = node.getChildDeltas();
+ updateNodes(childNodes);
+ }
+ }
- private void handleInsert(IModelDelta node) {
- AsynchronousTableViewer viewer = (AsynchronousTableViewer) getViewer();
- if (viewer != null) {
- viewer.insert(node.getElement(), node.getIndex());
- updateSelection(node.getElement(), node.getFlags());
- }
- }
+ private void handleInsert(IModelDelta node) {
+ AsynchronousTableViewer viewer = (AsynchronousTableViewer) getViewer();
+ if (viewer != null) {
+ viewer.insert(node.getElement(), node.getIndex());
+ updateSelection(node.getElement(), node.getFlags());
+ }
+ }
- private void handleReplace(IModelDelta node) {
- AsynchronousTableViewer viewer = (AsynchronousTableViewer) getViewer();
- if (viewer != null) {
- viewer.replace(node.getElement(), node.getReplacementElement());
- updateSelection(node.getReplacementElement(), node.getFlags());
- }
- }
+ private void handleReplace(IModelDelta node) {
+ AsynchronousTableViewer viewer = (AsynchronousTableViewer) getViewer();
+ if (viewer != null) {
+ viewer.replace(node.getElement(), node.getReplacementElement());
+ updateSelection(node.getReplacementElement(), node.getFlags());
+ }
+ }
- protected void handleAdd(IModelDelta node) {
- ((AsynchronousTableViewer) getViewer()).add(node.getElement());
- updateSelection(node.getElement(), node.getFlags());
- }
+ protected void handleAdd(IModelDelta node) {
+ ((AsynchronousTableViewer) getViewer()).add(node.getElement());
+ updateSelection(node.getElement(), node.getFlags());
+ }
- protected void handleRemove(IModelDelta node) {
- ((AsynchronousTableViewer) getViewer()).remove(node.getElement());
- }
+ protected void handleRemove(IModelDelta node) {
+ ((AsynchronousTableViewer) getViewer()).remove(node.getElement());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java
index 07a0a3b7c..0a0641f9b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java
@@ -93,27 +93,27 @@ public abstract class AbstractBreadcrumb {
*/
protected abstract void deactivateBreadcrumb();
- /**
- * Returns the selection provider for this breadcrumb.
- *
- * @return the selection provider for this breadcrumb
- */
+ /**
+ * Returns the selection provider for this breadcrumb.
+ *
+ * @return the selection provider for this breadcrumb
+ */
public ISelectionProvider getSelectionProvider() {
return fBreadcrumbViewer;
}
- /**
- * Set the input of the breadcrumb to the given element
- *
- * @param element the input element can be <code>null</code>
- */
+ /**
+ * Set the input of the breadcrumb to the given element
+ *
+ * @param element the input element can be <code>null</code>
+ */
public void setInput(Object element) {
if (element == null || fBreadcrumbViewer == null || fBreadcrumbViewer.getControl().isDisposed())
return;
Object input= fBreadcrumbViewer.getInput();
if (input == element || element.equals(input)) {
- refresh();
+ refresh();
return;
}
@@ -121,38 +121,38 @@ public abstract class AbstractBreadcrumb {
}
protected void refresh() {
- if (!fBreadcrumbViewer.getControl().isDisposed()) {
- fBreadcrumbViewer.refresh();
- }
+ if (!fBreadcrumbViewer.getControl().isDisposed()) {
+ fBreadcrumbViewer.refresh();
+ }
}
- /**
- * Activates the breadcrumb. This sets the keyboard focus
- * inside this breadcrumb and retargets the editor
- * actions.
- */
+ /**
+ * Activates the breadcrumb. This sets the keyboard focus
+ * inside this breadcrumb and retargets the editor
+ * actions.
+ */
public void activate() {
if (fBreadcrumbViewer.getSelection().isEmpty())
fBreadcrumbViewer.setSelection(new StructuredSelection(fBreadcrumbViewer.getInput()));
fBreadcrumbViewer.setFocus();
}
- /**
- * A breadcrumb is active if it either has the focus or another workbench part has the focus and
- * the breadcrumb had the focus before the other workbench part was made active.
- *
- * @return <code>true</code> if this breadcrumb is active
- */
+ /**
+ * A breadcrumb is active if it either has the focus or another workbench part has the focus and
+ * the breadcrumb had the focus before the other workbench part was made active.
+ *
+ * @return <code>true</code> if this breadcrumb is active
+ */
public boolean isActive() {
return true;
}
- /**
- * Create breadcrumb content.
- *
- * @param parent the parent of the content
- * @return the control containing the created content
- */
+ /**
+ * Create breadcrumb content.
+ *
+ * @param parent the parent of the content
+ * @return the control containing the created content
+ */
public Control createContent(Composite parent) {
Assert.isTrue(fComposite == null, "Content must only be created once."); //$NON-NLS-1$
@@ -172,7 +172,7 @@ public abstract class AbstractBreadcrumb {
fDisplayFocusListener= new Listener() {
@Override
public void handleEvent(Event event) {
- if (fComposite.isDisposed()) return;
+ if (fComposite.isDisposed()) return;
if (isBreadcrumbEvent(event)) {
if (fHasFocus)
@@ -215,9 +215,9 @@ public abstract class AbstractBreadcrumb {
return fComposite;
}
- /**
- * Dispose all resources hold by this breadcrumb.
- */
+ /**
+ * Dispose all resources hold by this breadcrumb.
+ */
public void dispose() {
if (fDisplayFocusListener != null) {
Display.getDefault().removeFilter(SWT.FocusIn, fDisplayFocusListener);
@@ -233,7 +233,7 @@ public abstract class AbstractBreadcrumb {
*/
private void doOpen(ISelection selection) {
if (open(selection)) {
- fBreadcrumbViewer.setInput(getCurrentInput());
+ fBreadcrumbViewer.setInput(getCurrentInput());
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java
index 3fb9b0d06..77e161f11 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItem.java
@@ -40,15 +40,15 @@ import org.eclipse.swt.widgets.Shell;
*/
class BreadcrumbItem extends Item {
- private TreePath fPath;
+ private TreePath fPath;
private final BreadcrumbViewer fParent;
private Composite fContainer;
- private BreadcrumbItemDropDown fExpandBlock;
- private BreadcrumbItemDetails fDetailsBlock;
+ private BreadcrumbItemDropDown fExpandBlock;
+ private BreadcrumbItemDetails fDetailsBlock;
- private boolean fIsLast;
+ private boolean fIsLast;
/**
* A new breadcrumb item which is shown inside the given viewer.
@@ -70,7 +70,7 @@ class BreadcrumbItem extends Item {
layout.horizontalSpacing= 0;
fContainer.setLayout(layout);
- fExpandBlock= new BreadcrumbItemDropDown(this, fContainer);
+ fExpandBlock= new BreadcrumbItemDropDown(this, fContainer);
fDetailsBlock= new BreadcrumbItemDetails(this, fContainer);
fContainer.setData("org.eclipse.e4.ui.css.id", "DebugBreadcrumbItemComposite"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -94,11 +94,11 @@ class BreadcrumbItem extends Item {
}
public TreePath getPath() {
- return fPath;
+ return fPath;
}
public void setPath(TreePath path) {
- fPath = path;
+ fPath = path;
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java
index 4a3e1b2a4..aa98d175f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java
@@ -318,7 +318,7 @@ class BreadcrumbItemDetails {
}
break;
case SWT.ARROW_DOWN:
- case SWT.ARROW_UP:
+ case SWT.ARROW_UP:
case SWT.KEYPAD_ADD:
if (!fSelected) {
viewer.selectItem(fParent);
@@ -345,12 +345,12 @@ class BreadcrumbItemDetails {
}
private void openDropDown() {
- Shell shell = fParent.getDropDownShell();
- if (shell == null) {
- fParent.openDropDownMenu();
- shell = fParent.getDropDownShell();
- }
- shell.setFocus();
+ Shell shell = fParent.getDropDownShell();
+ if (shell == null) {
+ fParent.openDropDownMenu();
+ shell = fParent.getDropDownShell();
+ }
+ shell.setFocus();
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java
index a31365c9c..08739bb78 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java
@@ -138,15 +138,15 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
// Workaround for bug 258196: set the minimum size to 500 because on Linux
// the size is not adjusted correctly in a virtual tree.
- private static final int DROP_DOWN_MIN_WIDTH= 500;
- private static final int DROP_DOWN_MAX_WIDTH= 501;
+ private static final int DROP_DOWN_MIN_WIDTH= 500;
+ private static final int DROP_DOWN_MAX_WIDTH= 501;
- private static final int DROP_DOWN_DEFAULT_MIN_HEIGHT= 100;
- private static final int DROP_DOWN_DEFAULT_MAX_HEIGHT= 500;
+ private static final int DROP_DOWN_DEFAULT_MIN_HEIGHT= 100;
+ private static final int DROP_DOWN_DEFAULT_MAX_HEIGHT= 500;
- private static final String DIALOG_SETTINGS= "BreadcrumbItemDropDown"; //$NON-NLS-1$
- private static final String DIALOG_HEIGHT= "height"; //$NON-NLS-1$
- private static final String DIALOG_WIDTH= "width"; //$NON-NLS-1$
+ private static final String DIALOG_SETTINGS= "BreadcrumbItemDropDown"; //$NON-NLS-1$
+ private static final String DIALOG_HEIGHT= "height"; //$NON-NLS-1$
+ private static final String DIALOG_WIDTH= "width"; //$NON-NLS-1$
private final BreadcrumbItem fParent;
private final Composite fParentComposite;
@@ -155,9 +155,9 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
private boolean fMenuIsShown;
private boolean fEnabled;
private Shell fShell;
- private boolean fIsResizingProgrammatically;
- private int fCurrentWidth = -1;
- private int fCurrentHeight = -1;
+ private boolean fIsResizingProgrammatically;
+ private int fCurrentWidth = -1;
+ private int fCurrentHeight = -1;
public BreadcrumbItemDropDown(BreadcrumbItem parent, Composite composite) {
@@ -169,11 +169,11 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
fToolBar= new ToolBar(composite, SWT.FLAT);
fToolBar.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
fToolBar.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- @Override
+ @Override
public void getName(AccessibleEvent e) {
- e.result= BreadcrumbMessages.BreadcrumbItemDropDown_showDropDownMenu_action_toolTip;
- }
- });
+ e.result= BreadcrumbMessages.BreadcrumbItemDropDown_showDropDownMenu_action_toolTip;
+ }
+ });
ToolBarManager manager= new ToolBarManager(fToolBar);
final Action showDropDownMenuAction= new Action(null, SWT.NONE) {
@@ -273,23 +273,23 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
DebugUIPlugin.trace(" creating new shell"); //$NON-NLS-1$
}
- fShell.addControlListener(new ControlAdapter() {
- /*
- * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
- */
- @Override
+ fShell.addControlListener(new ControlAdapter() {
+ /*
+ * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
+ */
+ @Override
public void controlResized(ControlEvent e) {
- if (fIsResizingProgrammatically) {
+ if (fIsResizingProgrammatically) {
return;
}
- Point size= fShell.getSize();
- fCurrentWidth = size.x;
- fCurrentHeight = size.y;
- getDialogSettings().put(DIALOG_WIDTH, size.x);
- getDialogSettings().put(DIALOG_HEIGHT, size.y);
- }
- });
+ Point size= fShell.getSize();
+ fCurrentWidth = size.x;
+ fCurrentHeight = size.y;
+ getDialogSettings().put(DIALOG_WIDTH, size.x);
+ getDialogSettings().put(DIALOG_HEIGHT, size.y);
+ }
+ });
GridLayout layout= new GridLayout(1, false);
layout.marginHeight= 0;
@@ -303,7 +303,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
gridLayout.marginWidth= 0;
composite.setLayout(gridLayout);
- TreePath path= fParent.getPath();
+ TreePath path= fParent.getPath();
Control control = fParent.getViewer().createDropDown(composite, this, path);
@@ -366,16 +366,16 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
final ControlListener controlListener= new ControlListener() {
@Override
public void controlMoved(ControlEvent e) {
- if (!shell.isDisposed()) {
- shell.close();
- }
+ if (!shell.isDisposed()) {
+ shell.close();
+ }
}
@Override
public void controlResized(ControlEvent e) {
- if (!shell.isDisposed()) {
- shell.close();
- }
+ if (!shell.isDisposed()) {
+ shell.close();
+ }
}
};
fToolBar.getShell().addControlListener(controlListener);
@@ -427,28 +427,28 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
}
private IDialogSettings getDialogSettings() {
- IDialogSettings javaSettings= DebugUIPlugin.getDefault().getDialogSettings();
- IDialogSettings settings= javaSettings.getSection(DIALOG_SETTINGS);
- if (settings == null) {
+ IDialogSettings javaSettings= DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings= javaSettings.getSection(DIALOG_SETTINGS);
+ if (settings == null) {
settings= javaSettings.addNewSection(DIALOG_SETTINGS);
}
- return settings;
+ return settings;
}
private int getMaxWidth() {
- try {
- return getDialogSettings().getInt(DIALOG_WIDTH);
- } catch (NumberFormatException e) {
- return DROP_DOWN_MAX_WIDTH;
- }
+ try {
+ return getDialogSettings().getInt(DIALOG_WIDTH);
+ } catch (NumberFormatException e) {
+ return DROP_DOWN_MAX_WIDTH;
+ }
}
private int getMaxHeight() {
- try {
- return getDialogSettings().getInt(DIALOG_HEIGHT);
- } catch (NumberFormatException e) {
- return DROP_DOWN_DEFAULT_MAX_HEIGHT;
- }
+ try {
+ return getDialogSettings().getInt(DIALOG_HEIGHT);
+ } catch (NumberFormatException e) {
+ return DROP_DOWN_DEFAULT_MAX_HEIGHT;
+ }
}
/**
@@ -496,52 +496,52 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
}
shell.setLocation(pt);
- fIsResizingProgrammatically= true;
- try {
- shell.setSize(width, height);
- fCurrentWidth = width;
- fCurrentHeight = height;
- } finally {
- fIsResizingProgrammatically= false;
- }
+ fIsResizingProgrammatically= true;
+ try {
+ shell.setSize(width, height);
+ fCurrentWidth = width;
+ fCurrentHeight = height;
+ } finally {
+ fIsResizingProgrammatically= false;
+ }
}
/**
* Set the size of the given shell such that more content can be shown. The shell size does not
- * exceed a user-configurable maximum.
+ * exceed a user-configurable maximum.
*
* @param shell the shell to resize
*/
private void resizeShell(final Shell shell) {
- int maxHeight= getMaxHeight();
- int maxWidth = getMaxWidth();
+ int maxHeight= getMaxHeight();
+ int maxWidth = getMaxWidth();
- if (fCurrentHeight >= maxHeight && fCurrentWidth >= maxWidth) {
+ if (fCurrentHeight >= maxHeight && fCurrentWidth >= maxWidth) {
return;
}
Point preferedSize= shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
int newWidth;
- if (fCurrentWidth >= DROP_DOWN_MAX_WIDTH) {
+ if (fCurrentWidth >= DROP_DOWN_MAX_WIDTH) {
newWidth= fCurrentWidth;
} else {
- // Workaround for bug 319612: Do not resize width below the
- // DROP_DOWN_MIN_WIDTH. This can happen because the Shell.getSize()
- // is incorrectly small on Linux.
- newWidth= Math.min(Math.max(Math.max(preferedSize.x, fCurrentWidth), DROP_DOWN_MIN_WIDTH), maxWidth);
+ // Workaround for bug 319612: Do not resize width below the
+ // DROP_DOWN_MIN_WIDTH. This can happen because the Shell.getSize()
+ // is incorrectly small on Linux.
+ newWidth= Math.min(Math.max(Math.max(preferedSize.x, fCurrentWidth), DROP_DOWN_MIN_WIDTH), maxWidth);
}
int newHeight;
- if (fCurrentHeight >= maxHeight) {
+ if (fCurrentHeight >= maxHeight) {
newHeight= fCurrentHeight;
} else {
- newHeight= Math.min(Math.max(preferedSize.y, fCurrentHeight), maxHeight);
+ newHeight= Math.min(Math.max(preferedSize.y, fCurrentHeight), maxHeight);
}
if (newHeight != fCurrentHeight || newWidth != fCurrentWidth) {
shell.setRedraw(false);
try {
- fIsResizingProgrammatically= true;
+ fIsResizingProgrammatically= true;
shell.setSize(newWidth, newHeight);
fCurrentWidth = newWidth;
fCurrentHeight = newHeight;
@@ -552,13 +552,13 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
newLocation = new Point(newLocation.x - (newWidth - fCurrentWidth), newLocation.y);
}
if (!isTop()) {
- newLocation = new Point(newLocation.x, newLocation.y - (newHeight - fCurrentHeight));
+ newLocation = new Point(newLocation.x, newLocation.y - (newHeight - fCurrentHeight));
}
if (!location.equals(newLocation)) {
- shell.setLocation(newLocation.x, newLocation.y);
+ shell.setLocation(newLocation.x, newLocation.y);
}
} finally {
- fIsResizingProgrammatically= false;
+ fIsResizingProgrammatically= false;
shell.setRedraw(true);
}
}
@@ -573,37 +573,37 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
*/
private boolean isLeft() {
return (fParentComposite.getStyle() & SWT.RIGHT_TO_LEFT) == 0 &&
- (fParent.getViewer().getStyle() & SWT.RIGHT) == 0;
+ (fParent.getViewer().getStyle() & SWT.RIGHT) == 0;
}
- /**
- * Tells whether this the breadcrumb is in LTR mode or RTL mode. Or whether the breadcrumb
- * is on the right-side status coolbar, which has the same effect on layout.
- *
- * @return <code>true</code> if the breadcrumb in left-to-right mode, <code>false</code>
- * otherwise
- */
- private boolean isTop() {
- return (fParent.getViewer().getStyle() & SWT.BOTTOM) == 0;
- }
-
- @Override
+ /**
+ * Tells whether this the breadcrumb is in LTR mode or RTL mode. Or whether the breadcrumb
+ * is on the right-side status coolbar, which has the same effect on layout.
+ *
+ * @return <code>true</code> if the breadcrumb in left-to-right mode, <code>false</code>
+ * otherwise
+ */
+ private boolean isTop() {
+ return (fParent.getViewer().getStyle() & SWT.BOTTOM) == 0;
+ }
+
+ @Override
public void close() {
- if (fShell != null && !fShell.isDisposed()) {
- fShell.close();
- }
- }
+ if (fShell != null && !fShell.isDisposed()) {
+ fShell.close();
+ }
+ }
- @Override
+ @Override
public void notifySelection(ISelection selection) {
- fParent.getViewer().fireMenuSelection(selection);
- }
+ fParent.getViewer().fireMenuSelection(selection);
+ }
- @Override
+ @Override
public void updateSize() {
- if (fShell != null && !fShell.isDisposed()) {
- resizeShell(fShell);
- }
- }
+ if (fShell != null && !fShell.isDisposed()) {
+ resizeShell(fShell);
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java
index d0c57d4bd..64d38a7f4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java
@@ -80,15 +80,15 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
* <li>SWT.NONE</li>
* <li>SWT.VERTICAL</li>
* <li>SWT.HORIZONTAL</li>
- * <li>SWT.BOTTOM</li>
- * <li>SWT.RIGHT</li>
+ * <li>SWT.BOTTOM</li>
+ * <li>SWT.RIGHT</li>
* </ul>
*
* @param parent the container for the viewer
* @param style the style flag used for this viewer
*/
public BreadcrumbViewer(Composite parent, int style) {
- fStyle = style;
+ fStyle = style;
fBreadcrumbItems = new ArrayList<>();
fMenuListeners= new ListenerList<>();
@@ -119,17 +119,17 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
}
int getStyle() {
- return fStyle;
+ return fStyle;
}
- /**
- * Configure the given drop down viewer. The given input is used for the viewers input. Clients
- * must at least set the label and the content provider for the viewer.
- * @param parent the parent composite
- * @param site the site to create the drop down for
- * @param path the path to show
- * @return the drop down control
- */
+ /**
+ * Configure the given drop down viewer. The given input is used for the viewers input. Clients
+ * must at least set the label and the content provider for the viewer.
+ * @param parent the parent composite
+ * @param site the site to create the drop down for
+ * @param path the path to show
+ * @return the drop down control
+ */
protected abstract Control createDropDown(Composite parent, IBreadcrumbDropDownSite site, TreePath path);
/*
@@ -307,39 +307,39 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
return false;
}
- /**
- * This implementation of getSelection() returns an instance of
- * ITreeSelection.
- * @return the current selection
- */
- @Override
+ /**
+ * This implementation of getSelection() returns an instance of
+ * ITreeSelection.
+ * @return the current selection
+ */
+ @Override
public ISelection getSelection() {
- Control control = getControl();
- if (control == null || control.isDisposed()) {
- return TreeSelection.EMPTY;
- }
- if (fSelectedItem != null) {
- TreePath path = getTreePathFromItem(fSelectedItem);
- if (path != null) {
- return new TreeSelection(new TreePath[] { path });
- }
- }
- return TreeSelection.EMPTY;
- }
-
- protected TreePath getTreePathFromItem(BreadcrumbItem item) {
+ Control control = getControl();
+ if (control == null || control.isDisposed()) {
+ return TreeSelection.EMPTY;
+ }
+ if (fSelectedItem != null) {
+ TreePath path = getTreePathFromItem(fSelectedItem);
+ if (path != null) {
+ return new TreeSelection(new TreePath[] { path });
+ }
+ }
+ return TreeSelection.EMPTY;
+ }
+
+ protected TreePath getTreePathFromItem(BreadcrumbItem item) {
List<Object> elements = new ArrayList<>(fBreadcrumbItems.size());
- for (int i = 0; i < fBreadcrumbItems.size(); i++) {
- elements.add( fBreadcrumbItems.get(i).getData() );
- if (fBreadcrumbItems.get(i).equals(item)) {
- return new TreePath(elements.toArray());
- }
- }
- return null;
- }
+ for (int i = 0; i < fBreadcrumbItems.size(); i++) {
+ elements.add( fBreadcrumbItems.get(i).getData() );
+ if (fBreadcrumbItems.get(i).equals(item)) {
+ return new TreePath(elements.toArray());
+ }
+ }
+ return null;
+ }
/*
- * @see org.eclipse.jface.viewers.StructuredViewer#getSelectionFromWidget()
+ * @see org.eclipse.jface.viewers.StructuredViewer#getSelectionFromWidget()
*/
@Override
protected List getSelectionFromWidget() {
@@ -364,7 +364,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
disableRedraw();
try {
- boolean layoutChanged = false;
+ boolean layoutChanged = false;
BreadcrumbItem item= (BreadcrumbItem) doFindItem(element);
if (item == null || element != null && element.equals(getInput())) {
@@ -373,12 +373,12 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
layoutChanged = refreshItem(item1) || layoutChanged;
}
} else {
- layoutChanged = refreshItem(item) || layoutChanged;
+ layoutChanged = refreshItem(item) || layoutChanged;
}
if (layoutChanged) {
- updateSize();
- fContainer.layout(true, true);
+ updateSize();
+ fContainer.layout(true, true);
}
} finally {
enableRedraw();
@@ -403,7 +403,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
}
if (l == null) {
- l = Collections.EMPTY_LIST;
+ l = Collections.EMPTY_LIST;
}
// Set the new selection to items.
@@ -423,7 +423,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
// If there is a new selection, and it does not overlap the old selection,
// remove the focus marker from the old focus item.
if (fSelectedItem != null && focusItem != null) {
- focusItem.setFocus(false);
+ focusItem.setFocus(false);
}
}
@@ -557,46 +557,46 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
last.setIsLastItem(false);
}
- int index = 0;
- boolean updateLayout = false;
+ int index = 0;
+ boolean updateLayout = false;
if (input != null) {
- ITreePathContentProvider contentProvider= (ITreePathContentProvider) getContentProvider();
- TreePath path = new TreePath(new Object[0]);
-
- // Top level elements need to be retrieved using getElements(), rest
- // using getChildren().
- Object[] children = contentProvider.getElements(input);
- Object element = children != null && children.length != 0 ? children[0] : null;
- while (element != null) {
- path = path.createChildPath(element);
-
- // All but last item are hidden if the viewer is in a vertical toolbar.
- children = contentProvider.getChildren(path);
- if ((getStyle() & SWT.VERTICAL) == 0 || children == null || children.length == 0) {
- updateLayout = updateOrCreateItem(index++, path, element) || updateLayout;
- }
+ ITreePathContentProvider contentProvider= (ITreePathContentProvider) getContentProvider();
+ TreePath path = new TreePath(new Object[0]);
+
+ // Top level elements need to be retrieved using getElements(), rest
+ // using getChildren().
+ Object[] children = contentProvider.getElements(input);
+ Object element = children != null && children.length != 0 ? children[0] : null;
+ while (element != null) {
+ path = path.createChildPath(element);
+
+ // All but last item are hidden if the viewer is in a vertical toolbar.
+ children = contentProvider.getChildren(path);
+ if ((getStyle() & SWT.VERTICAL) == 0 || children == null || children.length == 0) {
+ updateLayout = updateOrCreateItem(index++, path, element) || updateLayout;
+ }
- if (children != null && children.length != 0) {
- element = children[0];
- } else {
- break;
- }
+ if (children != null && children.length != 0) {
+ element = children[0];
+ } else {
+ break;
+ }
- }
+ }
}
- BreadcrumbItem last = null;
- if (index <= fBreadcrumbItems.size()) {
- last = (fBreadcrumbItems.get(index - 1));
- last.setIsLastItem(true);
- }
+ BreadcrumbItem last = null;
+ if (index <= fBreadcrumbItems.size()) {
+ last = (fBreadcrumbItems.get(index - 1));
+ last.setIsLastItem(true);
+ }
while (index < fBreadcrumbItems.size()) {
updateLayout = true;
BreadcrumbItem item= fBreadcrumbItems.remove(fBreadcrumbItems.size() - 1);
- if (item.hasFocus() && last != null) {
- last.setFocus(true);
- }
+ if (item.hasFocus() && last != null) {
+ last.setFocus(true);
+ }
if (item == fSelectedItem) {
selectItem(null);
}
@@ -617,25 +617,25 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
* @return returns whether the item's size and layout needs to be updated.
*/
private boolean refreshItem(BreadcrumbItem item) {
- boolean layoutChanged = false;
+ boolean layoutChanged = false;
- TreePath path = getTreePathFromItem(item);
+ TreePath path = getTreePathFromItem(item);
- ViewerLabel label = new ViewerLabel(item.getText(), item.getImage());
- ((ITreePathLabelProvider)getLabelProvider()).updateLabel(label, path);
+ ViewerLabel label = new ViewerLabel(item.getText(), item.getImage());
+ ((ITreePathLabelProvider)getLabelProvider()).updateLabel(label, path);
- if (label.hasNewText()) {
- item.setText(label.getText());
- layoutChanged = true;
- }
- if (label.hasNewImage()) {
- item.setImage(label.getImage());
- layoutChanged = true;
- }
- if (label.hasNewTooltipText()) {
- item.setToolTip(label.getTooltipText());
- }
- return layoutChanged;
+ if (label.hasNewText()) {
+ item.setText(label.getText());
+ layoutChanged = true;
+ }
+ if (label.hasNewImage()) {
+ item.setImage(label.getImage());
+ layoutChanged = true;
+ }
+ if (label.hasNewTooltipText()) {
+ item.setToolTip(label.getTooltipText());
+ }
+ return layoutChanged;
}
/**
@@ -647,30 +647,30 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
* @return whether breadcrumb layout needs to be updated due to this change
*/
private boolean updateOrCreateItem(int index, TreePath path, Object element) {
- BreadcrumbItem item;
- if (fBreadcrumbItems.size() > index) {
- item = fBreadcrumbItems.get(index);
- if (item.getData() != null) {
- unmapElement(item.getData());
- }
- } else {
- item = new BreadcrumbItem(this, fContainer);
- fBreadcrumbItems.add(item);
- }
+ BreadcrumbItem item;
+ if (fBreadcrumbItems.size() > index) {
+ item = fBreadcrumbItems.get(index);
+ if (item.getData() != null) {
+ unmapElement(item.getData());
+ }
+ } else {
+ item = new BreadcrumbItem(this, fContainer);
+ fBreadcrumbItems.add(item);
+ }
boolean updateLayout = false;
- if (equals(element, item.getData())) {
- item.setPath(path);
- updateLayout = myDoUpdateItem(item, element, false);
- } else {
- item.setData(element);
- item.setPath(path);
- mapElement(element, item);
- updateLayout = refreshItem(item);
- }
-
- return updateLayout;
+ if (equals(element, item.getData())) {
+ item.setPath(path);
+ updateLayout = myDoUpdateItem(item, element, false);
+ } else {
+ item.setData(element);
+ item.setPath(path);
+ mapElement(element, item);
+ updateLayout = refreshItem(item);
+ }
+
+ return updateLayout;
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java
index f316c012d..e86cff955 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/IBreadcrumbDropDownSite.java
@@ -23,21 +23,21 @@ import org.eclipse.jface.viewers.ISelection;
*/
public interface IBreadcrumbDropDownSite {
- /**
- * Notifies the breadcrumb that the given selection was made in the drop-down
- * viewer.
- * @param selection Selection to set to breadcrumb.
- */
- void notifySelection(ISelection selection);
+ /**
+ * Notifies the breadcrumb that the given selection was made in the drop-down
+ * viewer.
+ * @param selection Selection to set to breadcrumb.
+ */
+ void notifySelection(ISelection selection);
- /**
- * Notifies the breadcrumb that the drop-down viewer should be closed.
- */
- void close();
+ /**
+ * Notifies the breadcrumb that the drop-down viewer should be closed.
+ */
+ void close();
- /**
- * Notifies the breadcrumb that the drop-down viewer's contents have
- * changed and viewer shell should be adjusted for the new size.
- */
- void updateSize();
+ /**
+ * Notifies the breadcrumb that the drop-down viewer's contents have
+ * changed and viewer shell should be adjusted for the new size.
+ */
+ void updateSize();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java
index 311a3e105..3bdec56c0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java
@@ -57,95 +57,95 @@ import org.eclipse.ui.progress.UIJob;
*/
public abstract class TreeViewerDropDown {
- /**
- * Delay to control scrolling when the mouse pointer reaches the edge of
- * the tree viewer.
- */
- private static long MOUSE_MOVE_SCROLL_DELAY = 500;
-
- /**
- * The breadcrumb site in which the viewer is created.
- */
- private IBreadcrumbDropDownSite fDropDownSite;
-
- /**
- * The tree viewer.
- */
- private TreeViewer fDropDownViewer;
-
- /**
- * Creates the viewer and installs the listeners.
- *
- * @param composite Parent control of the viewer.
- * @param site Breadcrumb site for the viewer.
- * @param path Path to the element for which the drop-down is being opened.
- * @return The control created for the viewer.
- */
- public Control createDropDown(Composite composite, IBreadcrumbDropDownSite site, TreePath path) {
-
- fDropDownSite = site;
- fDropDownViewer= createTreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL, path);
-
- fDropDownViewer.addOpenListener(new IOpenListener() {
- @Override
+ /**
+ * Delay to control scrolling when the mouse pointer reaches the edge of
+ * the tree viewer.
+ */
+ private static long MOUSE_MOVE_SCROLL_DELAY = 500;
+
+ /**
+ * The breadcrumb site in which the viewer is created.
+ */
+ private IBreadcrumbDropDownSite fDropDownSite;
+
+ /**
+ * The tree viewer.
+ */
+ private TreeViewer fDropDownViewer;
+
+ /**
+ * Creates the viewer and installs the listeners.
+ *
+ * @param composite Parent control of the viewer.
+ * @param site Breadcrumb site for the viewer.
+ * @param path Path to the element for which the drop-down is being opened.
+ * @return The control created for the viewer.
+ */
+ public Control createDropDown(Composite composite, IBreadcrumbDropDownSite site, TreePath path) {
+
+ fDropDownSite = site;
+ fDropDownViewer= createTreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL, path);
+
+ fDropDownViewer.addOpenListener(new IOpenListener() {
+ @Override
public void open(OpenEvent event) {
- if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) {
- DebugUIPlugin.trace("BreadcrumbItemDropDown.showMenu()$treeViewer>open"); //$NON-NLS-1$
- }
- openElement(event.getSelection());
- }
- });
+ if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) {
+ DebugUIPlugin.trace("BreadcrumbItemDropDown.showMenu()$treeViewer>open"); //$NON-NLS-1$
+ }
+ openElement(event.getSelection());
+ }
+ });
- final Tree tree = fDropDownViewer.getTree();
+ final Tree tree = fDropDownViewer.getTree();
- tree.addMouseListener(new MouseListener() {
- @Override
+ tree.addMouseListener(new MouseListener() {
+ @Override
public void mouseUp(MouseEvent e) {
- if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) {
- DebugUIPlugin.trace("BreadcrumbItemDropDown.showMenu()$treeViewer>mouseUp"); //$NON-NLS-1$
- }
- if (e.button != 1) {
+ if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) {
+ DebugUIPlugin.trace("BreadcrumbItemDropDown.showMenu()$treeViewer>mouseUp"); //$NON-NLS-1$
+ }
+ if (e.button != 1) {
return;
}
- if ((OpenStrategy.getOpenMethod() & OpenStrategy.SINGLE_CLICK) != 0) {
+ if ((OpenStrategy.getOpenMethod() & OpenStrategy.SINGLE_CLICK) != 0) {
return;
}
- TreeItem item= tree.getItem(new Point(e.x, e.y));
- if (item == null) {
+ TreeItem item= tree.getItem(new Point(e.x, e.y));
+ if (item == null) {
return;
}
List<Object> pathElements = new LinkedList<>();
- while(item != null) {
- Object data = item.getData();
- if (data == null) {
+ while(item != null) {
+ Object data = item.getData();
+ if (data == null) {
return;
}
- pathElements.add(0, data);
- item = item.getParentItem();
- }
+ pathElements.add(0, data);
+ item = item.getParentItem();
+ }
- openElement(new TreeSelection(new TreePath(pathElements.toArray())));
- }
+ openElement(new TreeSelection(new TreePath(pathElements.toArray())));
+ }
- @Override
+ @Override
public void mouseDown(MouseEvent e) {
- }
+ }
- @Override
+ @Override
public void mouseDoubleClick(MouseEvent e) {
- }
- });
+ }
+ });
- tree.addMouseMoveListener(new MouseMoveListener() {
- TreeItem fLastItem= null;
- long fLastScrollTime = 0;
+ tree.addMouseMoveListener(new MouseMoveListener() {
+ TreeItem fLastItem= null;
+ long fLastScrollTime = 0;
- @Override
+ @Override
public void mouseMove(MouseEvent e) {
- if (tree.equals(e.getSource())) {
+ if (tree.equals(e.getSource())) {
TreeItem currentItem = tree.getItem(new Point(e.x, e.y));
if (fLastItem == null ^ currentItem == null) {
tree.setCursor(currentItem == null ? null : tree.getDisplay()
@@ -154,176 +154,176 @@ public abstract class TreeViewerDropDown {
if (currentItem != null) {
if (!currentItem.equals(fLastItem)) {
fLastItem = currentItem;
- tree.setSelection(new TreeItem[] { fLastItem });
- } else if (System.currentTimeMillis() > (fLastScrollTime + MOUSE_MOVE_SCROLL_DELAY)) {
- if (e.y < tree.getItemHeight() / 4)
- {
- // Scroll up
- if (currentItem.getParentItem() == null) {
+ tree.setSelection(new TreeItem[] { fLastItem });
+ } else if (System.currentTimeMillis() > (fLastScrollTime + MOUSE_MOVE_SCROLL_DELAY)) {
+ if (e.y < tree.getItemHeight() / 4)
+ {
+ // Scroll up
+ if (currentItem.getParentItem() == null) {
int index = tree.indexOf(currentItem);
- if (index < 1) {
+ if (index < 1) {
return;
}
- fLastItem= tree.getItem(index - 1);
- tree.setSelection(new TreeItem[] { fLastItem });
- } else {
- Point p= tree.toDisplay(e.x, e.y);
- Item item= fDropDownViewer.scrollUp(p.x, p.y);
- fLastScrollTime = System.currentTimeMillis();
- if (item instanceof TreeItem) {
- fLastItem= (TreeItem) item;
- tree.setSelection(new TreeItem[] { fLastItem });
- }
- }
- } else if (e.y > tree.getBounds().height - tree.getItemHeight() / 4) {
- // Scroll down
- if (currentItem.getParentItem() == null) {
+ fLastItem= tree.getItem(index - 1);
+ tree.setSelection(new TreeItem[] { fLastItem });
+ } else {
+ Point p= tree.toDisplay(e.x, e.y);
+ Item item= fDropDownViewer.scrollUp(p.x, p.y);
+ fLastScrollTime = System.currentTimeMillis();
+ if (item instanceof TreeItem) {
+ fLastItem= (TreeItem) item;
+ tree.setSelection(new TreeItem[] { fLastItem });
+ }
+ }
+ } else if (e.y > tree.getBounds().height - tree.getItemHeight() / 4) {
+ // Scroll down
+ if (currentItem.getParentItem() == null) {
int index = tree.indexOf(currentItem);
- if (index >= tree.getItemCount() - 1) {
+ if (index >= tree.getItemCount() - 1) {
return;
}
- fLastItem= tree.getItem(index + 1);
- tree.setSelection(new TreeItem[] { fLastItem });
- } else {
- Point p= tree.toDisplay(e.x, e.y);
- Item item= fDropDownViewer.scrollDown(p.x, p.y);
- fLastScrollTime = System.currentTimeMillis();
- if (item instanceof TreeItem) {
- fLastItem= (TreeItem) item;
- tree.setSelection(new TreeItem[] { fLastItem });
- }
- }
- }
- }
+ fLastItem= tree.getItem(index + 1);
+ tree.setSelection(new TreeItem[] { fLastItem });
+ } else {
+ Point p= tree.toDisplay(e.x, e.y);
+ Item item= fDropDownViewer.scrollDown(p.x, p.y);
+ fLastScrollTime = System.currentTimeMillis();
+ if (item instanceof TreeItem) {
+ fLastItem= (TreeItem) item;
+ tree.setSelection(new TreeItem[] { fLastItem });
+ }
+ }
+ }
+ }
} else {
fLastItem = null;
- }
- }
- }
- });
+ }
+ }
+ }
+ });
- tree.addKeyListener(new KeyListener() {
- @Override
+ tree.addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.ARROW_UP) {
- // No elements in the tree (bug 262961).
- if (tree.getItemCount() == 0) {
- fDropDownSite.close();
- return;
- }
-
- TreeItem[] selection= tree.getSelection();
- if (selection.length != 1) {
+ if (e.keyCode == SWT.ARROW_UP) {
+ // No elements in the tree (bug 262961).
+ if (tree.getItemCount() == 0) {
+ fDropDownSite.close();
+ return;
+ }
+
+ TreeItem[] selection= tree.getSelection();
+ if (selection.length != 1) {
return;
}
- int selectionIndex= tree.indexOf(selection[0]);
- if (selectionIndex != 0) {
+ int selectionIndex= tree.indexOf(selection[0]);
+ if (selectionIndex != 0) {
return;
}
- fDropDownSite.close();
- }
- }
+ fDropDownSite.close();
+ }
+ }
- @Override
+ @Override
public void keyReleased(KeyEvent e) {
- }
- });
+ }
+ });
- fDropDownViewer.addTreeListener(new ITreeViewerListener() {
- @Override
+ fDropDownViewer.addTreeListener(new ITreeViewerListener() {
+ @Override
public void treeCollapsed(TreeExpansionEvent event) {
- }
+ }
- @Override
+ @Override
public void treeExpanded(TreeExpansionEvent event) {
- tree.setRedraw(false);
- new UIJob(tree.getDisplay(), IInternalDebugCoreConstants.EMPTY_STRING) {
- { setSystem(true); }
- @Override
+ tree.setRedraw(false);
+ new UIJob(tree.getDisplay(), IInternalDebugCoreConstants.EMPTY_STRING) {
+ { setSystem(true); }
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (!tree.isDisposed()) {
- try {
- fDropDownSite.updateSize();
- } finally {
- tree.setRedraw(true);
- }
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- });
-
- return tree;
- }
-
- /**
- * Creates and returns the tree viewer.
- *
- * @param composite Parent control of the viewer.
- * @param style Style flags to use in creating the tree viewer.
- * @param path Path to the element for which the drop-down is being opened.
- * @return The newly created tree viewer.
- */
- protected abstract TreeViewer createTreeViewer(Composite composite, int style, TreePath path);
-
- /**
- * Called when the given element was selected in the viewer. It causes the
- * breadcrumb viewer to fire an opened event. If the viewer loses focus
- * as a result of the open operation, then the drop-down is closed.
- * Otherwise the selected element is expanded.
- *
- * @param selection The selection to open.
- */
- protected void openElement(ISelection selection) {
- if (selection == null || !(selection instanceof ITreeSelection) || selection.isEmpty()) {
+ if (!tree.isDisposed()) {
+ try {
+ fDropDownSite.updateSize();
+ } finally {
+ tree.setRedraw(true);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+
+ });
+
+ return tree;
+ }
+
+ /**
+ * Creates and returns the tree viewer.
+ *
+ * @param composite Parent control of the viewer.
+ * @param style Style flags to use in creating the tree viewer.
+ * @param path Path to the element for which the drop-down is being opened.
+ * @return The newly created tree viewer.
+ */
+ protected abstract TreeViewer createTreeViewer(Composite composite, int style, TreePath path);
+
+ /**
+ * Called when the given element was selected in the viewer. It causes the
+ * breadcrumb viewer to fire an opened event. If the viewer loses focus
+ * as a result of the open operation, then the drop-down is closed.
+ * Otherwise the selected element is expanded.
+ *
+ * @param selection The selection to open.
+ */
+ protected void openElement(ISelection selection) {
+ if (selection == null || !(selection instanceof ITreeSelection) || selection.isEmpty()) {
return;
}
- // This might or might not open an editor
- fDropDownSite.notifySelection(selection);
+ // This might or might not open an editor
+ fDropDownSite.notifySelection(selection);
- Tree tree = fDropDownViewer.getTree();
+ Tree tree = fDropDownViewer.getTree();
- boolean treeHasFocus= !tree.isDisposed() && tree.isFocusControl();
+ boolean treeHasFocus= !tree.isDisposed() && tree.isFocusControl();
- if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) {
- DebugUIPlugin.trace(" isDisposed: " + tree.isDisposed()); //$NON-NLS-1$
- DebugUIPlugin.trace(" shell hasFocus: " + (!tree.isDisposed() && tree.isFocusControl())); //$NON-NLS-1$
- DebugUIPlugin.trace(" tree hasFocus: " + treeHasFocus); //$NON-NLS-1$
- }
+ if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) {
+ DebugUIPlugin.trace(" isDisposed: " + tree.isDisposed()); //$NON-NLS-1$
+ DebugUIPlugin.trace(" shell hasFocus: " + (!tree.isDisposed() && tree.isFocusControl())); //$NON-NLS-1$
+ DebugUIPlugin.trace(" tree hasFocus: " + treeHasFocus); //$NON-NLS-1$
+ }
- if (tree.isDisposed()) {
+ if (tree.isDisposed()) {
return;
}
- if (!treeHasFocus) {
- fDropDownSite.close();
- return;
- }
+ if (!treeHasFocus) {
+ fDropDownSite.close();
+ return;
+ }
- toggleExpansionState( ((ITreeSelection)selection).getPaths()[0]);
- }
+ toggleExpansionState( ((ITreeSelection)selection).getPaths()[0]);
+ }
- private void toggleExpansionState(TreePath path) {
- Tree tree= fDropDownViewer.getTree();
- if (fDropDownViewer.getExpandedState(path)) {
+ private void toggleExpansionState(TreePath path) {
+ Tree tree= fDropDownViewer.getTree();
+ if (fDropDownViewer.getExpandedState(path)) {
fDropDownViewer.collapseToLevel(path, 1);
} else {
- tree.setRedraw(false);
- try {
- fDropDownViewer.expandToLevel(path, 1);
- fDropDownSite.updateSize();
- } finally {
- tree.setRedraw(true);
- }
- }
- }
+ tree.setRedraw(false);
+ try {
+ fDropDownViewer.expandToLevel(path, 1);
+ fDropDownSite.updateSize();
+ } finally {
+ tree.setRedraw(true);
+ }
+ }
+ }
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
index 940d18bf2..b77fcc474 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java
@@ -28,9 +28,9 @@ import org.eclipse.jface.viewers.TreePath;
*/
class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountUpdate {
- /**
- * Child count result.
- */
+ /**
+ * Child count result.
+ */
private int fCount = 0;
/**
@@ -39,18 +39,18 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
*/
private List<ViewerUpdateMonitor> fBatchedRequests = null;
- /**
- * Flag whether filtering is enabled in viewer. If filtering is enabled, then a
- * children update is performed on child elements to filter them as part of the
- * child count calculation.
- */
+ /**
+ * Flag whether filtering is enabled in viewer. If filtering is enabled, then a
+ * children update is performed on child elements to filter them as part of the
+ * child count calculation.
+ */
private boolean fShouldFilter = false;
/**
* Children indexes which are currently filtered. When updating child count, also need
* to verify that currently filtered children are still filtered.
*/
- private int[] fFilteredChildren = null;
+ private int[] fFilteredChildren = null;
/**
* Children update used to filter children.
@@ -81,42 +81,42 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
@Override
protected synchronized void scheduleViewerUpdate() {
- // If filtering is enabled perform child update on all children in order to update
- // viewer filters.
+ // If filtering is enabled perform child update on all children in order to update
+ // viewer filters.
if (fShouldFilter || fFilteredChildren != null) {
- if (fChildrenUpdate == null) {
- int startIdx;
- int count;
- if (fShouldFilter) {
- startIdx = 0;
- count = getCount();
- } else {
- startIdx = fFilteredChildren[0];
- int endIdx = fFilteredChildren[fFilteredChildren.length - 1];
- count = endIdx - startIdx + 1;
- }
-
- fChildrenUpdate = new ChildrenUpdate(getContentProvider(), getViewerInput(), getElementPath(), getElement(), startIdx, count, getElementContentProvider()) {
- @Override
+ if (fChildrenUpdate == null) {
+ int startIdx;
+ int count;
+ if (fShouldFilter) {
+ startIdx = 0;
+ count = getCount();
+ } else {
+ startIdx = fFilteredChildren[0];
+ int endIdx = fFilteredChildren[fFilteredChildren.length - 1];
+ count = endIdx - startIdx + 1;
+ }
+
+ fChildrenUpdate = new ChildrenUpdate(getContentProvider(), getViewerInput(), getElementPath(), getElement(), startIdx, count, getElementContentProvider()) {
+ @Override
protected void performUpdate() {
- performUpdate(true);
- ChildrenCountUpdate.super.scheduleViewerUpdate();
- }
+ performUpdate(true);
+ ChildrenCountUpdate.super.scheduleViewerUpdate();
+ }
- @Override
+ @Override
protected void scheduleViewerUpdate() {
execInDisplayThread(() -> {
if (!getContentProvider().isDisposed() && !isCanceled()) {
performUpdate();
}
});
- }
- };
+ }
+ };
execInDisplayThread(() -> fChildrenUpdate.startRequest());
- return;
- }
+ return;
+ }
} else {
- super.scheduleViewerUpdate();
+ super.scheduleViewerUpdate();
}
}
@@ -137,9 +137,9 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
// Child 0 is automatically updated by the tree at the same time that the child count is requested. Therefore,
// If this child count update filtered out this element, it needs to be updated again.
if (fShouldFilter && getContentProvider().isFiltered(elementPath, 0)) {
- getContentProvider().updateElement(elementPath, 0);
+ getContentProvider().updateElement(elementPath, 0);
}
- getContentProvider().getViewer().setChildCount(elementPath, viewCount);
+ getContentProvider().getViewer().setChildCount(elementPath, viewCount);
getContentProvider().getStateTracker().restorePendingStateOnUpdate(getElementPath(), -1, true, true, false);
}
@@ -192,16 +192,16 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
@Override
boolean containsUpdate(TreePath path) {
- if (getElementPath().equals(path)) {
- return true;
- } else if (fBatchedRequests != null) {
- for (int i = 0; i < fBatchedRequests.size(); i++) {
- if (fBatchedRequests.get(i).getElementPath().equals(path)) {
- return true;
- }
- }
- }
- return false;
+ if (getElementPath().equals(path)) {
+ return true;
+ } else if (fBatchedRequests != null) {
+ for (int i = 0; i < fBatchedRequests.size(); i++) {
+ if (fBatchedRequests.get(i).getElementPath().equals(path)) {
+ return true;
+ }
+ }
+ }
+ return false;
}
@Override
@@ -219,19 +219,19 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
}
int getCount() {
- return fCount;
+ return fCount;
}
- @Override
+ @Override
protected boolean doEquals(ViewerUpdateMonitor update) {
- return
- update instanceof ChildrenCountUpdate &&
- getViewerInput().equals(update.getViewerInput()) &&
- getElementPath().equals(update.getElementPath());
- }
+ return
+ update instanceof ChildrenCountUpdate &&
+ getViewerInput().equals(update.getViewerInput()) &&
+ getElementPath().equals(update.getElementPath());
+ }
- @Override
+ @Override
protected int doHashCode() {
- return getClass().hashCode() + getViewerInput().hashCode() + getElementPath().hashCode();
- }
+ return getClass().hashCode() + getViewerInput().hashCode() + getElementPath().hashCode();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java
index 8819290ea..0a29af029 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenUpdate.java
@@ -66,26 +66,26 @@ public class ChildrenUpdate extends ViewerUpdateMonitor implements IChildrenUpda
int viewIndex = provider.modelToViewIndex(elementPath, modelIndex);
if (provider.shouldFilter(elementPath, element)) {
if (provider.addFilteredIndex(elementPath, modelIndex, element)) {
- if (!updateFilterOnly) {
- if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("REMOVE(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
- viewer.remove(elementPath, viewIndex);
- }
+ if (!updateFilterOnly) {
+ if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("REMOVE(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
+ viewer.remove(elementPath, viewIndex);
+ }
}
} else {
if (provider.isFiltered(elementPath, modelIndex)) {
provider.clearFilteredChild(elementPath, modelIndex);
- if (!updateFilterOnly) {
+ if (!updateFilterOnly) {
int insertIndex = provider.modelToViewIndex(elementPath, modelIndex);
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER) {
DebugUIPlugin.trace("insert(" + getElement() + ", modelIndex: " + modelIndex + " insertIndex: " + insertIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
viewer.insert(elementPath, element, insertIndex);
- }
+ }
} else if (!updateFilterOnly){
- if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("replace(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("replace(" + getElement() + ", modelIndex: " + modelIndex + " viewIndex: " + viewIndex + ", " + element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
viewer.replace(elementPath, viewIndex, element);
}
@@ -149,8 +149,8 @@ public class ChildrenUpdate extends ViewerUpdateMonitor implements IChildrenUpda
@Override
boolean containsUpdate(TreePath path) {
- return getElementPath().equals(path);
- }
+ return getElementPath().equals(path);
+ }
@Override
public int getLength() {
@@ -201,24 +201,24 @@ public class ChildrenUpdate extends ViewerUpdateMonitor implements IChildrenUpda
}
Object[] getElements() {
- return fElements;
+ return fElements;
}
- @Override
+ @Override
protected boolean doEquals(ViewerUpdateMonitor update) {
- return
- update instanceof ChildrenUpdate &&
- ((ChildrenUpdate)update).getOffset() == getOffset() &&
- ((ChildrenUpdate)update).getLength() == getLength() &&
- getViewerInput().equals(update.getViewerInput()) &&
- getElementPath().equals(update.getElementPath());
- }
-
- @Override
+ return
+ update instanceof ChildrenUpdate &&
+ ((ChildrenUpdate)update).getOffset() == getOffset() &&
+ ((ChildrenUpdate)update).getLength() == getLength() &&
+ getViewerInput().equals(update.getViewerInput()) &&
+ getElementPath().equals(update.getElementPath());
+ }
+
+ @Override
protected int doHashCode() {
- return (int)Math.pow(
- (getClass().hashCode() + getViewerInput().hashCode() + getElementPath().hashCode()) * (getOffset() + 2),
- getLength() + 2);
- }
+ return (int)Math.pow(
+ (getClass().hashCode() + getViewerInput().hashCode() + getElementPath().hashCode()) * (getOffset() + 2),
+ getLength() + 2);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java
index 25d737dad..76f30f905 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementCompareRequest.java
@@ -26,30 +26,30 @@ import org.eclipse.ui.IMemento;
public class ElementCompareRequest extends MementoUpdate implements IElementCompareRequest {
private boolean fEqual;
- private final int fModelIndex;
+ private final int fModelIndex;
private ModelDelta fDelta;
- private boolean fKnowsHasChildren;
- private boolean fKnowsChildCount;
- private boolean fCheckChildrenRealized;
-
-
- /**
- * @param provider the content provider to use for the update
- * @param viewerInput the current input
- * @param element the element to update
- * @param elementPath the path of the element to update
- * @param memento Memento to encode result into
- * @param delta Delta to write the result comparison into.
- * @param modelIndex Index of element to compare.
- * @param knowsHasChildren Flag indicating whether provider knows the has
- * children state of element.
- * @param knowsChildCount Flag indicating whether provider knows the
- * child count state of element.
- * @param checkChildrenRealized Flag indicating if any realized children should be checked
- */
+ private boolean fKnowsHasChildren;
+ private boolean fKnowsChildCount;
+ private boolean fCheckChildrenRealized;
+
+
+ /**
+ * @param provider the content provider to use for the update
+ * @param viewerInput the current input
+ * @param element the element to update
+ * @param elementPath the path of the element to update
+ * @param memento Memento to encode result into
+ * @param delta Delta to write the result comparison into.
+ * @param modelIndex Index of element to compare.
+ * @param knowsHasChildren Flag indicating whether provider knows the has
+ * children state of element.
+ * @param knowsChildCount Flag indicating whether provider knows the
+ * child count state of element.
+ * @param checkChildrenRealized Flag indicating if any realized children should be checked
+ */
public ElementCompareRequest(TreeModelContentProvider provider, Object viewerInput, Object element,
- TreePath elementPath, IMemento memento, ModelDelta delta, int modelIndex,
- boolean knowsHasChildren, boolean knowsChildCount, boolean checkChildrenRealized)
+ TreePath elementPath, IMemento memento, ModelDelta delta, int modelIndex,
+ boolean knowsHasChildren, boolean knowsChildCount, boolean checkChildrenRealized)
{
super(provider, viewerInput, provider.getPresentationContext(), element, elementPath, memento);
fProvider = provider;
@@ -67,21 +67,21 @@ public class ElementCompareRequest extends MementoUpdate implements IElementComp
@Override
public void done() {
- ITreeModelViewer viewer = getContentProvider().getViewer();
- if (viewer == null)
+ ITreeModelViewer viewer = getContentProvider().getViewer();
+ if (viewer == null)
{
return; // disposed
}
- if (viewer.getDisplay().getThread() == Thread.currentThread()) {
- fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
- } else {
+ if (viewer.getDisplay().getThread() == Thread.currentThread()) {
+ fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
+ } else {
viewer.getDisplay().asyncExec(() -> {
if (getContentProvider().isDisposed()) {
return;
}
fProvider.getStateTracker().compareFinished(ElementCompareRequest.this, fDelta);
});
- }
+ }
}
public boolean isEqual() {
@@ -113,20 +113,20 @@ public class ElementCompareRequest extends MementoUpdate implements IElementComp
return fKnowsChildCount;
}
- void setCheckChildrenRealized(boolean checkChildrenRealized) {
- fCheckChildrenRealized = checkChildrenRealized;
- }
+ void setCheckChildrenRealized(boolean checkChildrenRealized) {
+ fCheckChildrenRealized = checkChildrenRealized;
+ }
- boolean checkChildrenRealized() {
- return fCheckChildrenRealized;
- }
+ boolean checkChildrenRealized() {
+ return fCheckChildrenRealized;
+ }
- @Override
+ @Override
public String toString() {
- StringBuilder buf = new StringBuilder();
- buf.append("IElementCompareRequest: "); //$NON-NLS-1$
- buf.append(getElement());
- return buf.toString();
- }
+ StringBuilder buf = new StringBuilder();
+ buf.append("IElementCompareRequest: "); //$NON-NLS-1$
+ buf.append(getElement());
+ return buf.toString();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java
index 7b3c8e73b..d3887179a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ElementMementoRequest.java
@@ -32,11 +32,11 @@ class ElementMementoRequest extends MementoUpdate implements IElementMementoRequ
private ModelDelta fDelta;
/**
- * @param provider the content provider to use for the update
- * @param viewerInput the current input
- * @param collector Collector to report the result to
- * @param element the element to update
- * @param elementPath the path of the element to update
+ * @param provider the content provider to use for the update
+ * @param viewerInput the current input
+ * @param collector Collector to report the result to
+ * @param element the element to update
+ * @param elementPath the path of the element to update
* @param memento Memento to encode result into
* @param delta Delta to write the result comparison into.
*/
@@ -63,22 +63,22 @@ class ElementMementoRequest extends MementoUpdate implements IElementMementoRequ
}
private void doComplete() {
- if (getContentProvider().isDisposed()) {
+ if (getContentProvider().isDisposed()) {
return;
}
- if (!isCanceled() && (getStatus() == null || getStatus().isOK())) {
- // replace the element with a memento
- fDelta.setElement(getMemento());
- }
- fManager.requestComplete(ElementMementoRequest.this);
+ if (!isCanceled() && (getStatus() == null || getStatus().isOK())) {
+ // replace the element with a memento
+ fDelta.setElement(getMemento());
+ }
+ fManager.requestComplete(ElementMementoRequest.this);
}
@Override
public String toString() {
- StringBuilder buf = new StringBuilder();
- buf.append("IElementMementoRequest: "); //$NON-NLS-1$
- buf.append(getElement());
- return buf.toString();
+ StringBuilder buf = new StringBuilder();
+ buf.append("IElementMementoRequest: "); //$NON-NLS-1$
+ buf.append(getElement());
+ return buf.toString();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
index f43a6dd9b..60c8125bd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java
@@ -375,11 +375,11 @@ public class FilterTransform {
}
public int indexOfFilteredElement(TreePath parentPath, Object element) {
- Node parentNode = root.find(parentPath, 0);
- if (parentNode == null) {
- return -1;
- }
- return parentNode.indexOfFilteredElement(element);
+ Node parentNode = root.find(parentPath, 0);
+ if (parentNode == null) {
+ return -1;
+ }
+ return parentNode.indexOfFilteredElement(element);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java
index 808f66e5a..b05729bfa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java
@@ -32,15 +32,15 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat
private List<ViewerUpdateMonitor> fBatchedRequests = null;
- /**
- * Constructs a request to update an element
- *
- * @param provider the content provider
- * @param viewerInput the current input
- * @param elementPath the path to the element being update
- * @param element the element
- * @param elementContentProvider the content provider for the element
- */
+ /**
+ * Constructs a request to update an element
+ *
+ * @param provider the content provider
+ * @param viewerInput the current input
+ * @param elementPath the path to the element being update
+ * @param element the element
+ * @param elementContentProvider the content provider for the element
+ */
public HasChildrenUpdate(TreeModelContentProvider provider, Object viewerInput, TreePath elementPath, Object element, IElementContentProvider elementContentProvider) {
super(provider, viewerInput, elementPath, element, elementContentProvider, provider.getPresentationContext());
}
@@ -52,7 +52,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat
if (!fHasChildren) {
contentProvider.clearFilters(elementPath);
}
- if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
}
contentProvider.getViewer().setHasChildren(elementPath, fHasChildren);
if (fHasChildren) {
@@ -112,17 +112,17 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat
@Override
boolean containsUpdate(TreePath path) {
- if (getElementPath().equals(path)) {
- return true;
- } else if (fBatchedRequests != null) {
- for (int i = 0; i < fBatchedRequests.size(); i++) {
- if (fBatchedRequests.get(i).getElementPath().equals(path)) {
- return true;
- }
- }
- }
- return false;
- }
+ if (getElementPath().equals(path)) {
+ return true;
+ } else if (fBatchedRequests != null) {
+ for (int i = 0; i < fBatchedRequests.size(); i++) {
+ if (fBatchedRequests.get(i).getElementPath().equals(path)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
@Override
int getPriority() {
@@ -139,20 +139,20 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat
}
boolean hasChildren() {
- return fHasChildren;
+ return fHasChildren;
}
- @Override
+ @Override
protected boolean doEquals(ViewerUpdateMonitor update) {
- return
- update instanceof HasChildrenUpdate &&
- getViewerInput().equals(update.getViewerInput()) &&
- getElementPath().equals(update.getElementPath());
- }
+ return
+ update instanceof HasChildrenUpdate &&
+ getViewerInput().equals(update.getViewerInput()) &&
+ getElementPath().equals(update.getElementPath());
+ }
- @Override
+ @Override
protected int doHashCode() {
- return getClass().hashCode() + getViewerInput().hashCode() + getElementPath().hashCode();
- }
+ return getClass().hashCode() + getViewerInput().hashCode() + getElementPath().hashCode();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/IInternalTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/IInternalTreeModelViewer.java
index c71362168..d89111ae1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/IInternalTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/IInternalTreeModelViewer.java
@@ -32,291 +32,291 @@ import org.eclipse.swt.graphics.RGB;
*/
public interface IInternalTreeModelViewer extends ITreeModelViewer {
- /**
- * Returns this viewer's filters.
- *
- * @return an array of viewer filters
- * @see org.eclipse.jface.viewers.StructuredViewer#setFilters(ViewerFilter[])
- */
- @Override ViewerFilter[] getFilters();
+ /**
+ * Returns this viewer's filters.
+ *
+ * @return an array of viewer filters
+ * @see org.eclipse.jface.viewers.StructuredViewer#setFilters(ViewerFilter[])
+ */
+ @Override ViewerFilter[] getFilters();
- /**
- * Reveals the given element in the viewer.
- * @param path Path to the element's parent.
- * @param index Index of the element to be revealed.
- */
- void reveal(TreePath path, int index);
+ /**
+ * Reveals the given element in the viewer.
+ * @param path Path to the element's parent.
+ * @param index Index of the element to be revealed.
+ */
+ void reveal(TreePath path, int index);
- /**
- * Triggers an update of the given element's state. If multiple instances
- * of the given element are found in the tree, they will all be updated.
- *
- * @param element Element to update.
- */
- void update(Object element);
+ /**
+ * Triggers an update of the given element's state. If multiple instances
+ * of the given element are found in the tree, they will all be updated.
+ *
+ * @param element Element to update.
+ */
+ void update(Object element);
- /**
- * Sets the given object to be the element at the given index of the given parent.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param parentOrTreePath Parent object, or a tree path of the parent element.
- * @param index Index at which to set the new element.
- * @param element Element object.
- * @noreference This method is not intended to be referenced by clients.
- */
- void replace(Object parentOrTreePath, final int index, Object element);
+ /**
+ * Sets the given object to be the element at the given index of the given parent.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param parentOrTreePath Parent object, or a tree path of the parent element.
+ * @param index Index at which to set the new element.
+ * @param element Element object.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void replace(Object parentOrTreePath, final int index, Object element);
- /**
- * Set the number of children of the given element or tree path. To set the
- * number of children of the invisible root of the tree, you can pass the
- * input object or an empty tree path.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param elementOrTreePath The element, or tree path.
- * @param count new value
- * @noreference This method is not intended to be referenced by clients.
- */
- void setChildCount(final Object elementOrTreePath, final int count);
+ /**
+ * Set the number of children of the given element or tree path. To set the
+ * number of children of the invisible root of the tree, you can pass the
+ * input object or an empty tree path.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param elementOrTreePath The element, or tree path.
+ * @param count new value
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void setChildCount(final Object elementOrTreePath, final int count);
- /**
- * Inform the viewer about whether the given element or tree path has
- * children. Avoid calling this method if the number of children has
- * already been set.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param elementOrTreePath the element, or tree path
- * @param hasChildren new value.
- * @noreference This method is not intended to be referenced by clients.
- */
- void setHasChildren(final Object elementOrTreePath, final boolean hasChildren);
+ /**
+ * Inform the viewer about whether the given element or tree path has
+ * children. Avoid calling this method if the number of children has
+ * already been set.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param elementOrTreePath the element, or tree path
+ * @param hasChildren new value.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void setHasChildren(final Object elementOrTreePath, final boolean hasChildren);
- /**
- * Performs auto expand on an element at the specified path if the auto expand
- * level dictates the element should be expanded.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param elementPath tree path to element to consider for expansion
- * @noreference This method is not intended to be referenced by clients.
- */
- void autoExpand(TreePath elementPath);
+ /**
+ * Performs auto expand on an element at the specified path if the auto expand
+ * level dictates the element should be expanded.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param elementPath tree path to element to consider for expansion
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void autoExpand(TreePath elementPath);
- /**
- * Sets whether the node corresponding to the given element or tree path is
- * expanded or collapsed.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param elementOrTreePath
- * the element, or the tree path to the element
- * @param expanded
- * <code>true</code> if the node is expanded, and
- * <code>false</code> if collapsed
- *
- * @noreference This method is not intended to be referenced by clients.
- */
- void setExpandedState(Object elementOrTreePath, boolean expanded);
+ /**
+ * Sets whether the node corresponding to the given element or tree path is
+ * expanded or collapsed.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param elementOrTreePath
+ * the element, or the tree path to the element
+ * @param expanded
+ * <code>true</code> if the node is expanded, and
+ * <code>false</code> if collapsed
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void setExpandedState(Object elementOrTreePath, boolean expanded);
- /**
- * Expands all ancestors of the given element or tree path so that the given
- * element becomes visible in this viewer's tree control, and then expands
- * the subtree rooted at the given element to the given level.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param elementOrTreePath
- * the element
- * @param level
- * non-negative level, or <code>ALL_LEVELS</code> to expand all
- * levels of the tree
- *
- * @noreference This method is not intended to be referenced by clients.
- */
- void expandToLevel(Object elementOrTreePath, int level);
+ /**
+ * Expands all ancestors of the given element or tree path so that the given
+ * element becomes visible in this viewer's tree control, and then expands
+ * the subtree rooted at the given element to the given level.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param elementOrTreePath
+ * the element
+ * @param level
+ * non-negative level, or <code>ALL_LEVELS</code> to expand all
+ * levels of the tree
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void expandToLevel(Object elementOrTreePath, int level);
- /**
- * Removes the given element from the viewer. The selection is updated if
- * necessary.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- * @param elementOrTreePath the element, or the tree path to the element
- * @noreference This method is not intended to be referenced by clients.
- */
- void remove(Object elementOrTreePath);
+ /**
+ * Removes the given element from the viewer. The selection is updated if
+ * necessary.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ * @param elementOrTreePath the element, or the tree path to the element
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void remove(Object elementOrTreePath);
- /**
- * Removes the element at the specified index of the parent. The selection is updated if required.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param parentOrTreePath the parent element, the input element, or a tree path to the parent element
- * @param index child index
- * @noreference This method is not intended to be referenced by clients.
- */
- void remove(Object parentOrTreePath, final int index);
+ /**
+ * Removes the element at the specified index of the parent. The selection is updated if required.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param parentOrTreePath the parent element, the input element, or a tree path to the parent element
+ * @param index child index
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void remove(Object parentOrTreePath, final int index);
- /**
- * Inserts the given element as a new child element of the given parent
- * element at the given position. If this viewer has a sorter, the position
- * is ignored and the element is inserted at the correct position in the
- * sort order.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- * @param parentOrTreePath the parent element, or the tree path to the parent
- *
- * @param element the element
- * @param position a 0-based position relative to the model, or -1 to indicate
- * the last position
- * @noreference This method is not intended to be referenced by clients.
- */
- void insert(Object parentOrTreePath, Object element, int position);
+ /**
+ * Inserts the given element as a new child element of the given parent
+ * element at the given position. If this viewer has a sorter, the position
+ * is ignored and the element is inserted at the correct position in the
+ * sort order.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ * @param parentOrTreePath the parent element, or the tree path to the parent
+ *
+ * @param element the element
+ * @param position a 0-based position relative to the model, or -1 to indicate
+ * the last position
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void insert(Object parentOrTreePath, Object element, int position);
- /**
- * Returns whether the candidate selection should override the current
- * selection.
- * @param current Current selection in viewer.
- * @param candidate Proposed new selection.
- * @return whether new selection should override the current
- */
- boolean overrideSelection(ISelection current, ISelection candidate);
+ /**
+ * Returns whether the candidate selection should override the current
+ * selection.
+ * @param current Current selection in viewer.
+ * @param candidate Proposed new selection.
+ * @return whether new selection should override the current
+ */
+ boolean overrideSelection(ISelection current, ISelection candidate);
- /**
- * Returns whether the node corresponding to the given element or tree path
- * is expanded or collapsed.
- *
- * @param elementOrTreePath
- * the element
- * @return <code>true</code> if the node is expanded, and
- * <code>false</code> if collapsed
- */
- boolean getExpandedState(Object elementOrTreePath);
+ /**
+ * Returns whether the node corresponding to the given element or tree path
+ * is expanded or collapsed.
+ *
+ * @param elementOrTreePath
+ * the element
+ * @return <code>true</code> if the node is expanded, and
+ * <code>false</code> if collapsed
+ */
+ boolean getExpandedState(Object elementOrTreePath);
- /**
- * Returns whether the node corresponding to the given element or tree path
- * has any child elements.
- *
- * @param elementOrTreePath Path to element
- * @return Returns whether the given element has children.
- */
- boolean getHasChildren(Object elementOrTreePath);
+ /**
+ * Returns whether the node corresponding to the given element or tree path
+ * has any child elements.
+ *
+ * @param elementOrTreePath Path to element
+ * @return Returns whether the given element has children.
+ */
+ boolean getHasChildren(Object elementOrTreePath);
- /**
- * Returns the child count of the element at the given path. <br>
- * Note: The child count may be incorrect if the element is not
- * expanded in the tree.
- *
- * @param path Path to get count for.
- * @return The child count.
- */
- int getChildCount(TreePath path);
+ /**
+ * Returns the child count of the element at the given path. <br>
+ * Note: The child count may be incorrect if the element is not
+ * expanded in the tree.
+ *
+ * @param path Path to get count for.
+ * @return The child count.
+ */
+ int getChildCount(TreePath path);
- /**
- * Returns the element which is a child of the element at the
- * given path, with the given index.
- *
- * @param path Path to parent element.
- * @param index Index of child element.
- * @return Child element.
- */
- Object getChildElement(TreePath path, int index);
+ /**
+ * Returns the element which is a child of the element at the
+ * given path, with the given index.
+ *
+ * @param path Path to parent element.
+ * @param index Index of child element.
+ * @return Child element.
+ */
+ Object getChildElement(TreePath path, int index);
- /**
- * Returns the tree path of the element that is at the top of the
- * viewer.
- *
- * @return the tree path of the element at the top of the
- * viewer.
- */
- TreePath getTopElementPath();
+ /**
+ * Returns the tree path of the element that is at the top of the
+ * viewer.
+ *
+ * @return the tree path of the element at the top of the
+ * viewer.
+ */
+ TreePath getTopElementPath();
- /**
- * Finds the index of the given element with a parent of given path.
- *
- * @param parentPath Path of parent element.
- * @param element Element to find.
- *
- * @return The element's index, or -1 if not found.
- */
- int findElementIndex(TreePath parentPath, Object element);
+ /**
+ * Finds the index of the given element with a parent of given path.
+ *
+ * @param parentPath Path of parent element.
+ * @param element Element to find.
+ *
+ * @return The element's index, or -1 if not found.
+ */
+ int findElementIndex(TreePath parentPath, Object element);
- /**
- * Returns a boolean indicating whether all the child elements of the
- * given parent have been realized already.
- *
- * @param parentPath Path of parent element.
- * @return true if all children realized
- */
- boolean getElementChildrenRealized(TreePath parentPath);
+ /**
+ * Returns a boolean indicating whether all the child elements of the
+ * given parent have been realized already.
+ *
+ * @param parentPath Path of parent element.
+ * @return true if all children realized
+ */
+ boolean getElementChildrenRealized(TreePath parentPath);
- /**
- * Clears the selection in the viewer, if any, without firing
- * selection change notification. This is only to be used by
- * the platform.
- */
- void clearSelectionQuiet();
+ /**
+ * Clears the selection in the viewer, if any, without firing
+ * selection change notification. This is only to be used by
+ * the platform.
+ */
+ void clearSelectionQuiet();
- /**
- * Sets the element's display information.
- * <p>
- * This method should only be called by the viewer framework.
- * </p>
- *
- * @param path Element path.
- * @param numColumns Number of columns in the data.
- * @param labels Array of labels. The array cannot to be
- * <code>null</code>, but values within the array may be.
- * @param images Array of image descriptors, may be <code>null</code>.
- * @param fontDatas Array of fond data objects, may be <code>null</code>.
- * @param foregrounds Array of RGB values for foreground colors, may be
- * <code>null</code>.
- * @param backgrounds Array of RGB values for background colors, may be
- * <code>null</code>.
- * @noreference This method is not intended to be referenced by clients.
- */
- void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images, FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds);
+ /**
+ * Sets the element's display information.
+ * <p>
+ * This method should only be called by the viewer framework.
+ * </p>
+ *
+ * @param path Element path.
+ * @param numColumns Number of columns in the data.
+ * @param labels Array of labels. The array cannot to be
+ * <code>null</code>, but values within the array may be.
+ * @param images Array of image descriptors, may be <code>null</code>.
+ * @param fontDatas Array of fond data objects, may be <code>null</code>.
+ * @param foregrounds Array of RGB values for foreground colors, may be
+ * <code>null</code>.
+ * @param backgrounds Array of RGB values for background colors, may be
+ * <code>null</code>.
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images, FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds);
- /**
- * Returns identifiers of the visible columns in this viewer, or <code>null</code>
- * if there is currently no column presentation.
- *
- * @return visible columns or <code>null</code>
- */
- String[] getVisibleColumns();
+ /**
+ * Returns identifiers of the visible columns in this viewer, or <code>null</code>
+ * if there is currently no column presentation.
+ *
+ * @return visible columns or <code>null</code>
+ */
+ String[] getVisibleColumns();
- /**
- * Sets the element check state data.
- *
- * @param path Path of element to check.
- * @param checked if true, item will be checked
- * @param grayed if true item will be grayed
- */
- void setElementChecked(TreePath path, boolean checked, boolean grayed);
+ /**
+ * Sets the element check state data.
+ *
+ * @param path Path of element to check.
+ * @param checked if true, item will be checked
+ * @param grayed if true item will be grayed
+ */
+ void setElementChecked(TreePath path, boolean checked, boolean grayed);
- /**
- * Retrieves the element check state.
- *
- * @param path Path of element to return check state for.
- * @return the element checked state
- */
- boolean getElementChecked(TreePath path);
+ /**
+ * Retrieves the element check state.
+ *
+ * @param path Path of element to return check state for.
+ * @return the element checked state
+ */
+ boolean getElementChecked(TreePath path);
- /**
- * Retrieves the element's check box grayed state.
- *
- * @param path Path of element to return grayed state for.
- * @return the element grayed state
- */
- boolean getElementGrayed(TreePath path);
+ /**
+ * Retrieves the element's check box grayed state.
+ *
+ * @param path Path of element to return grayed state for.
+ * @return the element grayed state
+ */
+ boolean getElementGrayed(TreePath path);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelContentProvider.java
index 04476f252..ee94069e4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelContentProvider.java
@@ -31,221 +31,221 @@ import org.eclipse.jface.viewers.Viewer;
*/
public interface ITreeModelContentProvider extends ILazyTreePathContentProvider {
- /**
- * Bit-mask which allows all possible model delta flags.
- *
- * @since 3.6
- * @see #setModelDeltaMask(int)
- */
- int ALL_MODEL_DELTA_FLAGS = ~0;
-
- /**
- * Bit-mask which allows only flags which control selection and expansion.
- *
- * @since 3.6
- * @see #setModelDeltaMask(int)
- */
- int CONTROL_MODEL_DELTA_FLAGS =
- IModelDelta.EXPAND | IModelDelta.COLLAPSE | IModelDelta.SELECT | IModelDelta.REVEAL | IModelDelta.FORCE;
-
- /**
- * Bit-mask which allows only flags which update viewer's information
- * about the model.
- *
- * @since 3.6
- * @see #setModelDeltaMask(int)
- */
- int UPDATE_MODEL_DELTA_FLAGS =
- IModelDelta.ADDED | IModelDelta.CONTENT | IModelDelta.INSERTED | IModelDelta.INSTALL | IModelDelta.REMOVED |
- IModelDelta.REPLACED | IModelDelta.STATE | IModelDelta.UNINSTALL;
-
- /**
- * Translates and returns the given child index from the viewer coordinate
- * space to the model coordinate space.
- *
- * @param parentPath path to parent element
- * @param index index of child element in viewer (filtered) space
- * @return index of child element in model (raw) space
- */
- int viewToModelIndex(TreePath parentPath, int index);
-
- /**
- * Translates and returns the given child count from the viewer coordinate
- * space to the model coordinate space.
- *
- * @param parentPath path to parent element
- * @param count number of child elements in viewer (filtered) space
- * @return number of child elements in model (raw) space
- */
- int viewToModelCount(TreePath parentPath, int count);
-
- /**
- * Translates and returns the given child index from the model coordinate
- * space to the viewer coordinate space.
- *
- * @param parentPath path to parent element
- * @param index index of child element in model (raw) space
- * @return index of child element in viewer (filtered) space or -1 if filtered
- */
- int modelToViewIndex(TreePath parentPath, int index);
-
- /**
- * Returns whether the children of given element should be filtered.
- * <p>This method is used to determine whether any of the registered filters
- * that extend {@link TreeModelViewerFilter} are applicable to the given
- * element. If so, then children of given element should be filtered
- * prior to populating them in the viewer.
- *
- * @param parentElement
- * the parent element
- * @return whether there are any {@link TreeModelViewerFilter} filters
- * applicable to given parent
- */
- boolean areTreeModelViewerFiltersApplicable(Object parentElement);
-
- /**
- * Returns whether the given element is filtered.
- *
- * @param parentElementOrTreePath
- * the parent element or path
- * @param element
- * the child element
- * @return whether to filter the element
- */
- boolean shouldFilter(Object parentElementOrTreePath, Object element);
-
- /**
- * Notification the given element is being unmapped.
- *
- * @param path Path to unmap
- */
- void unmapPath(TreePath path);
-
- /**
- * Sets the bit mask which will be used to filter the {@link IModelDelta}
- * coming from the model. Any delta flags which are hidden by the mask
- * will be ignored.
- *
- * @param mask for <code>IModelDelta</code> flags
- *
- * @since 3.6
- */
- void setModelDeltaMask(int mask);
-
- /**
- * Returns the current model delta mask.
- *
- * @return bit mask used to filter model delta events.
- *
- * @see #setModelDeltaMask(int)
- * @since 3.6
- */
- int getModelDeltaMask();
-
- /**
- * Translates and returns the given child count from the model coordinate
- * space to the viewer coordinate space.
- *
- * @param parentPath path to parent element
- * @param count child count element in model (raw) space
- * @return child count in viewer (filtered) space
- */
- int modelToViewChildCount(TreePath parentPath, int count);
-
- /**
- * Registers the specified listener for view update notifications.
- * @param listener Listener to add
- */
- void addViewerUpdateListener(IViewerUpdateListener listener);
-
- /**
- * Removes the specified listener from update notifications.
- * @param listener Listener to remove
- */
- void removeViewerUpdateListener(IViewerUpdateListener listener);
-
- /**
- * Registers the given listener for model delta notification.
- * This listener is called immediately after the viewer processes
- * the delta.
- * @param listener Listener to add
- */
- void addModelChangedListener(IModelChangedListener listener);
-
- /**
- * Removes the given listener from model delta notification.
- * @param listener Listener to remove
- */
- void removeModelChangedListener(IModelChangedListener listener);
-
- /**
- * Causes the content provider to save the expansion and selection state
- * of given element. The state is then restored as the tree is lazily
- * re-populated.
- * @param path Path of the element to save.
- */
- void preserveState(TreePath path);
-
- /**
- * Registers the specified listener for state update notifications.
- * @param listener Listener to add
- * @since 3.6
- */
- void addStateUpdateListener(IStateUpdateListener listener);
-
- /**
- * Removes the specified listener from state update notifications.
- * @param listener Listener to remove
- * @since 3.6
- */
- void removeStateUpdateListener(IStateUpdateListener listener);
-
- /**
- * Instructs the content provider to process the given model delta. This
- * mechanism can be used to control the view's layout (expanding, selecting
- * , etc.)
- *
- * @param delta The model delta to process.
- * @param mask Mask that can be used to suppress processing of some of the
- * delta flags
- *
- * @since 3.6
- */
- void updateModel(IModelDelta delta, int mask);
-
- /**
- * Instructs the content provider to cancel any pending state changes
- * (i.e. SELECT, REVEAL, EXPAND, COLLAPSE) for the given path. Pending
- * state changes are changes the the viewer plans to re-apply to the
- * viewer following a refresh. If the user changes viewer state while
- * the viewer is being refreshed, user's change should override the
- * previous state.
- *
- * @param path Path of the element for which to cancel pending changes.
- * @param flags Flags indicating the changes to cancel.
- */
- void cancelRestore(TreePath path, int flags);
-
- /**
- * Notifies the content provider that a client called {@link Viewer#setInput(Object)},
- * and the viewer input is changed.
- * This method is guaranteed to be called after {@link IContentProvider#inputChanged(Viewer, Object, Object)}
- *
- * @param viewer The viewer that uses this content provider.
- * @param oldInput Old input object.
- * @param newInput New input object.
- *
- * @since 3.8
- */
- void postInputChanged(IInternalTreeModelViewer viewer, Object oldInput, Object newInput);
-
- /**
- * Notifies the receiver that the given element has had its
- * checked state modified in the viewer.
- *
- * @param path Path of the element that had its checked state changed
- * @param checked The new checked state of the element
- * @return false if the check state should not change
- */
- boolean setChecked(TreePath path, boolean checked);
+ /**
+ * Bit-mask which allows all possible model delta flags.
+ *
+ * @since 3.6
+ * @see #setModelDeltaMask(int)
+ */
+ int ALL_MODEL_DELTA_FLAGS = ~0;
+
+ /**
+ * Bit-mask which allows only flags which control selection and expansion.
+ *
+ * @since 3.6
+ * @see #setModelDeltaMask(int)
+ */
+ int CONTROL_MODEL_DELTA_FLAGS =
+ IModelDelta.EXPAND | IModelDelta.COLLAPSE | IModelDelta.SELECT | IModelDelta.REVEAL | IModelDelta.FORCE;
+
+ /**
+ * Bit-mask which allows only flags which update viewer's information
+ * about the model.
+ *
+ * @since 3.6
+ * @see #setModelDeltaMask(int)
+ */
+ int UPDATE_MODEL_DELTA_FLAGS =
+ IModelDelta.ADDED | IModelDelta.CONTENT | IModelDelta.INSERTED | IModelDelta.INSTALL | IModelDelta.REMOVED |
+ IModelDelta.REPLACED | IModelDelta.STATE | IModelDelta.UNINSTALL;
+
+ /**
+ * Translates and returns the given child index from the viewer coordinate
+ * space to the model coordinate space.
+ *
+ * @param parentPath path to parent element
+ * @param index index of child element in viewer (filtered) space
+ * @return index of child element in model (raw) space
+ */
+ int viewToModelIndex(TreePath parentPath, int index);
+
+ /**
+ * Translates and returns the given child count from the viewer coordinate
+ * space to the model coordinate space.
+ *
+ * @param parentPath path to parent element
+ * @param count number of child elements in viewer (filtered) space
+ * @return number of child elements in model (raw) space
+ */
+ int viewToModelCount(TreePath parentPath, int count);
+
+ /**
+ * Translates and returns the given child index from the model coordinate
+ * space to the viewer coordinate space.
+ *
+ * @param parentPath path to parent element
+ * @param index index of child element in model (raw) space
+ * @return index of child element in viewer (filtered) space or -1 if filtered
+ */
+ int modelToViewIndex(TreePath parentPath, int index);
+
+ /**
+ * Returns whether the children of given element should be filtered.
+ * <p>This method is used to determine whether any of the registered filters
+ * that extend {@link TreeModelViewerFilter} are applicable to the given
+ * element. If so, then children of given element should be filtered
+ * prior to populating them in the viewer.
+ *
+ * @param parentElement
+ * the parent element
+ * @return whether there are any {@link TreeModelViewerFilter} filters
+ * applicable to given parent
+ */
+ boolean areTreeModelViewerFiltersApplicable(Object parentElement);
+
+ /**
+ * Returns whether the given element is filtered.
+ *
+ * @param parentElementOrTreePath
+ * the parent element or path
+ * @param element
+ * the child element
+ * @return whether to filter the element
+ */
+ boolean shouldFilter(Object parentElementOrTreePath, Object element);
+
+ /**
+ * Notification the given element is being unmapped.
+ *
+ * @param path Path to unmap
+ */
+ void unmapPath(TreePath path);
+
+ /**
+ * Sets the bit mask which will be used to filter the {@link IModelDelta}
+ * coming from the model. Any delta flags which are hidden by the mask
+ * will be ignored.
+ *
+ * @param mask for <code>IModelDelta</code> flags
+ *
+ * @since 3.6
+ */
+ void setModelDeltaMask(int mask);
+
+ /**
+ * Returns the current model delta mask.
+ *
+ * @return bit mask used to filter model delta events.
+ *
+ * @see #setModelDeltaMask(int)
+ * @since 3.6
+ */
+ int getModelDeltaMask();
+
+ /**
+ * Translates and returns the given child count from the model coordinate
+ * space to the viewer coordinate space.
+ *
+ * @param parentPath path to parent element
+ * @param count child count element in model (raw) space
+ * @return child count in viewer (filtered) space
+ */
+ int modelToViewChildCount(TreePath parentPath, int count);
+
+ /**
+ * Registers the specified listener for view update notifications.
+ * @param listener Listener to add
+ */
+ void addViewerUpdateListener(IViewerUpdateListener listener);
+
+ /**
+ * Removes the specified listener from update notifications.
+ * @param listener Listener to remove
+ */
+ void removeViewerUpdateListener(IViewerUpdateListener listener);
+
+ /**
+ * Registers the given listener for model delta notification.
+ * This listener is called immediately after the viewer processes
+ * the delta.
+ * @param listener Listener to add
+ */
+ void addModelChangedListener(IModelChangedListener listener);
+
+ /**
+ * Removes the given listener from model delta notification.
+ * @param listener Listener to remove
+ */
+ void removeModelChangedListener(IModelChangedListener listener);
+
+ /**
+ * Causes the content provider to save the expansion and selection state
+ * of given element. The state is then restored as the tree is lazily
+ * re-populated.
+ * @param path Path of the element to save.
+ */
+ void preserveState(TreePath path);
+
+ /**
+ * Registers the specified listener for state update notifications.
+ * @param listener Listener to add
+ * @since 3.6
+ */
+ void addStateUpdateListener(IStateUpdateListener listener);
+
+ /**
+ * Removes the specified listener from state update notifications.
+ * @param listener Listener to remove
+ * @since 3.6
+ */
+ void removeStateUpdateListener(IStateUpdateListener listener);
+
+ /**
+ * Instructs the content provider to process the given model delta. This
+ * mechanism can be used to control the view's layout (expanding, selecting
+ * , etc.)
+ *
+ * @param delta The model delta to process.
+ * @param mask Mask that can be used to suppress processing of some of the
+ * delta flags
+ *
+ * @since 3.6
+ */
+ void updateModel(IModelDelta delta, int mask);
+
+ /**
+ * Instructs the content provider to cancel any pending state changes
+ * (i.e. SELECT, REVEAL, EXPAND, COLLAPSE) for the given path. Pending
+ * state changes are changes the the viewer plans to re-apply to the
+ * viewer following a refresh. If the user changes viewer state while
+ * the viewer is being refreshed, user's change should override the
+ * previous state.
+ *
+ * @param path Path of the element for which to cancel pending changes.
+ * @param flags Flags indicating the changes to cancel.
+ */
+ void cancelRestore(TreePath path, int flags);
+
+ /**
+ * Notifies the content provider that a client called {@link Viewer#setInput(Object)},
+ * and the viewer input is changed.
+ * This method is guaranteed to be called after {@link IContentProvider#inputChanged(Viewer, Object, Object)}
+ *
+ * @param viewer The viewer that uses this content provider.
+ * @param oldInput Old input object.
+ * @param newInput New input object.
+ *
+ * @since 3.8
+ */
+ void postInputChanged(IInternalTreeModelViewer viewer, Object oldInput, Object newInput);
+
+ /**
+ * Notifies the receiver that the given element has had its
+ * checked state modified in the viewer.
+ *
+ * @param path Path of the element that had its checked state changed
+ * @param checked The new checked state of the element
+ * @return false if the check state should not change
+ */
+ boolean setChecked(TreePath path, boolean checked);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProvider.java
index da09cf204..f9e720e28 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProvider.java
@@ -31,50 +31,50 @@ import org.eclipse.swt.graphics.RGB;
*/
public interface ITreeModelLabelProvider extends IBaseLabelProvider {
- /**
- * Requests an label update label of the given element.
- * @param elementPath Element to update.
- * @return true if element label provider is found and update will
- * be requested.
- */
- boolean update(TreePath elementPath);
+ /**
+ * Requests an label update label of the given element.
+ * @param elementPath Element to update.
+ * @return true if element label provider is found and update will
+ * be requested.
+ */
+ boolean update(TreePath elementPath);
- /**
- * Registers the specified listener for view label update notifications.
- * @param listener Listener to add
- */
- void addLabelUpdateListener(ILabelUpdateListener listener);
+ /**
+ * Registers the specified listener for view label update notifications.
+ * @param listener Listener to add
+ */
+ void addLabelUpdateListener(ILabelUpdateListener listener);
- /**
- * Removes the specified listener from view label update notifications.
- * @param listener Listener to remove
- */
- void removeLabelUpdateListener(ILabelUpdateListener listener);
+ /**
+ * Removes the specified listener from view label update notifications.
+ * @param listener Listener to remove
+ */
+ void removeLabelUpdateListener(ILabelUpdateListener listener);
- /**
- * Returns an image for the given image descriptor or <code>null</code>. Adds the image
- * to a cache of images if it does not already exist.
- *
- * @param descriptor image descriptor or <code>null</code>
- * @return image or <code>null</code>
- */
- Image getImage(ImageDescriptor descriptor);
+ /**
+ * Returns an image for the given image descriptor or <code>null</code>. Adds the image
+ * to a cache of images if it does not already exist.
+ *
+ * @param descriptor image descriptor or <code>null</code>
+ * @return image or <code>null</code>
+ */
+ Image getImage(ImageDescriptor descriptor);
- /**
- * Returns a font for the given font data or <code>null</code>. Adds the font to the font
- * cache if not yet created.
- *
- * @param fontData font data or <code>null</code>
- * @return font font or <code>null</code>
- */
- Font getFont(FontData fontData);
+ /**
+ * Returns a font for the given font data or <code>null</code>. Adds the font to the font
+ * cache if not yet created.
+ *
+ * @param fontData font data or <code>null</code>
+ * @return font font or <code>null</code>
+ */
+ Font getFont(FontData fontData);
- /**
- * Returns a color for the given RGB or <code>null</code>. Adds the color to the color
- * cache if not yet created.
- *
- * @param rgb RGB or <code>null</code>
- * @return color or <code>null</code>
- */
- Color getColor(RGB rgb);
+ /**
+ * Returns a color for the given RGB or <code>null</code>. Adds the color to the color
+ * cache if not yet created.
+ *
+ * @param rgb RGB or <code>null</code>
+ * @return color or <code>null</code>
+ */
+ Color getColor(RGB rgb);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
index 20bfcc8e1..3bc99b786 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
@@ -82,41 +82,41 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
private final IPresentationContext fContext;
- /**
- * Current column presentation or <code>null</code>
- */
- private IColumnPresentation fColumnPresentation = null;
-
- /**
- * Map of columns presentation id to its visible columns id's (String[])
- * When a columns presentation is not in the map, default settings are used.
- */
+ /**
+ * Current column presentation or <code>null</code>
+ */
+ private IColumnPresentation fColumnPresentation = null;
+
+ /**
+ * Map of columns presentation id to its visible columns id's (String[])
+ * When a columns presentation is not in the map, default settings are used.
+ */
private final Map<String, String[]> fVisibleColumns = new HashMap<>();
- /**
- * Map of column id's to persisted sizes
- */
+ /**
+ * Map of column id's to persisted sizes
+ */
private final Map<Object, Integer> fColumnSizes = new HashMap<>();
- /**
- * Map of column presentation id's to an array of integers representing the column order
- * for that presentation, or <code>null</code> if default.
- */
+ /**
+ * Map of column presentation id's to an array of integers representing the column order
+ * for that presentation, or <code>null</code> if default.
+ */
private final Map<String, int[]> fColumnOrder = new HashMap<>();
- /**
- * Map of column presentation id to whether columns should be displayed
- * for that presentation (the user can toggle columns on/off when a
- * presentation is optional.
- */
+ /**
+ * Map of column presentation id to whether columns should be displayed
+ * for that presentation (the user can toggle columns on/off when a
+ * presentation is optional.
+ */
private final Map<String, Boolean> fShowColumns = new HashMap<>();
- /**
- * Item's tree path cache
- */
- private static final String TREE_PATH_KEY = "TREE_PATH_KEY"; //$NON-NLS-1$
+ /**
+ * Item's tree path cache
+ */
+ private static final String TREE_PATH_KEY = "TREE_PATH_KEY"; //$NON-NLS-1$
- /**
+ /**
* Memento type for column sizes. Sizes are keyed by column presentation id
*/
private static final String COLUMN_SIZES = "COLUMN_SIZES"; //$NON-NLS-1$
@@ -190,15 +190,15 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
if (fModifier.canModify(element, property)) {
// install cell editor
CellEditor cellEditor = editor.getCellEditor(getPresentationContext(), property, element, (Composite)getControl());
- if (cellEditor != null) {
- disposeCellEditors();
- CellEditor[] newEditors = new CellEditor[getVisibleColumns().length];
- for (int i = 0; i < newEditors.length; i++) {
+ if (cellEditor != null) {
+ disposeCellEditors();
+ CellEditor[] newEditors = new CellEditor[getVisibleColumns().length];
+ for (int i = 0; i < newEditors.length; i++) {
newEditors[i] = cellEditor;
}
- setCellEditors(newEditors);
- return true;
- }
+ setCellEditors(newEditors);
+ return true;
+ }
}
}
}
@@ -271,12 +271,12 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
// A pop-up viewer is transient and does not automatically expand
// and select elements up when requested by the model
if ((style & SWT.POP_UP) != 0) {
- ((ITreeModelContentProvider)getContentProvider()).setModelDeltaMask(
- ~ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS);
+ ((ITreeModelContentProvider)getContentProvider()).setModelDeltaMask(
+ ~ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS);
+ }
+ if ((style & SWT.CHECK) != 0) {
+ context.setProperty(ICheckUpdate.PROP_CHECK, Boolean.TRUE);
}
- if ((style & SWT.CHECK) != 0) {
- context.setProperty(ICheckUpdate.PROP_CHECK, Boolean.TRUE);
- }
}
/**
@@ -346,14 +346,14 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
item.setBackground(i, (Color) backgrounds[i]);
}
}
- Boolean checked = (Boolean) item.getData(PREV_CHECKED_KEY);
- if (checked != null) {
- item.setChecked(checked.booleanValue());
- }
- Boolean grayed = (Boolean) item.getData(PREV_GRAYED_KEY);
- if (grayed != null) {
- item.setGrayed(grayed.booleanValue());
- }
+ Boolean checked = (Boolean) item.getData(PREV_CHECKED_KEY);
+ if (checked != null) {
+ item.setChecked(checked.booleanValue());
+ }
+ Boolean grayed = (Boolean) item.getData(PREV_GRAYED_KEY);
+ if (grayed != null) {
+ item.setGrayed(grayed.booleanValue());
+ }
}
/*
@@ -362,23 +362,23 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
*/
@Override
protected void handleInvalidSelection(ISelection selection, ISelection newSelection) {
- IModelSelectionPolicy selectionPolicy = ViewerAdapterService.getSelectionPolicy(selection, getPresentationContext());
- if (selectionPolicy != null) {
- while (!selection.equals(newSelection)) {
- ISelection temp = newSelection;
- selection = selectionPolicy.replaceInvalidSelection(selection, newSelection);
- if (selection == null) {
- selection = TreeSelection.EMPTY;
- }
- if (!temp.equals(selection)) {
- setSelectionToWidget(selection, false);
- newSelection = getSelection();
- } else {
- break;
- }
- }
- }
- super.handleInvalidSelection(selection, newSelection);
+ IModelSelectionPolicy selectionPolicy = ViewerAdapterService.getSelectionPolicy(selection, getPresentationContext());
+ if (selectionPolicy != null) {
+ while (!selection.equals(newSelection)) {
+ ISelection temp = newSelection;
+ selection = selectionPolicy.replaceInvalidSelection(selection, newSelection);
+ if (selection == null) {
+ selection = TreeSelection.EMPTY;
+ }
+ if (!temp.equals(selection)) {
+ setSelectionToWidget(selection, false);
+ newSelection = getSelection();
+ } else {
+ break;
+ }
+ }
+ }
+ super.handleInvalidSelection(selection, newSelection);
}
@Override
@@ -405,7 +405,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
protected void unmapElement(Object element, Widget widget) {
if (fNotifyUnmap) {
// TODO: should we update the filter with the "new non-identical element"?
- ((ITreeModelContentProvider) getContentProvider()).unmapPath((TreePath) widget.getData(TREE_PATH_KEY));
+ ((ITreeModelContentProvider) getContentProvider()).unmapPath((TreePath) widget.getData(TREE_PATH_KEY));
}
super.unmapElement(element, widget);
}
@@ -468,20 +468,20 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
@Override
protected void unmapAllElements() {
- // Do nothing when called from StructuredViewer.setInput(), to avoid
- // clearing elements before viewer state is saved.
- // Bug 326917
- if (getControl().isDisposed()) {
- unmapAllElements();
- }
+ // Do nothing when called from StructuredViewer.setInput(), to avoid
+ // clearing elements before viewer state is saved.
+ // Bug 326917
+ if (getControl().isDisposed()) {
+ unmapAllElements();
+ }
}
@Override
protected void inputChanged(Object input, Object oldInput) {
- fCellModifier.clear();
- // Clear items map now that ITreeModelContentProvider.inputChanged() was already called.
- // Bug 326917
- super.unmapAllElements();
+ fCellModifier.clear();
+ // Clear items map now that ITreeModelContentProvider.inputChanged() was already called.
+ // Bug 326917
+ super.unmapAllElements();
((ITreeModelContentProvider)getContentProvider()).postInputChanged(this, oldInput, input);
super.inputChanged(input, oldInput);
@@ -489,19 +489,19 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
}
/**
- * Configures the columns for the given viewer input.
- *
- * @param input the viewer input
- */
- protected void resetColumns(Object input) {
- if (input != null) {
- // only change columns if the input is non-null (persist when empty)
- IColumnPresentationFactory factory = ViewerAdapterService.getColumnPresentationFactory(input);
- PresentationContext context = (PresentationContext) getPresentationContext();
- String type = null;
- if (factory != null) {
- type = factory.getColumnPresentationId(context, input);
- }
+ * Configures the columns for the given viewer input.
+ *
+ * @param input the viewer input
+ */
+ protected void resetColumns(Object input) {
+ if (input != null) {
+ // only change columns if the input is non-null (persist when empty)
+ IColumnPresentationFactory factory = ViewerAdapterService.getColumnPresentationFactory(input);
+ PresentationContext context = (PresentationContext) getPresentationContext();
+ String type = null;
+ if (factory != null) {
+ type = factory.getColumnPresentationId(context, input);
+ }
if (type != null && factory != null) {
if (fColumnPresentation != null) {
if (!fColumnPresentation.getId().equals(type)) {
@@ -524,14 +524,14 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
configureColumns();
}
}
- }
- }
-
- /**
- * Configures the columns based on the current settings.
- */
- protected void configureColumns() {
- if (fColumnPresentation != null) {
+ }
+ }
+
+ /**
+ * Configures the columns based on the current settings.
+ */
+ protected void configureColumns() {
+ if (fColumnPresentation != null) {
IColumnPresentation build = null;
if (isShowColumns(fColumnPresentation.getId())) {
build = fColumnPresentation;
@@ -541,7 +541,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
// get rid of columns
buildColumns(null);
}
- }
+ }
/**
* Toggles columns on/off for the current column presentation, if any.
@@ -608,33 +608,33 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
@Override
protected void internalRefresh(Object element, boolean updateLabels) {
- ITreeModelContentProvider contentProvider = (ITreeModelContentProvider)getContentProvider();
-
- if (element == null) {
- internalRefresh(getControl(), getRoot(), true, updateLabels);
- contentProvider.preserveState(TreePath.EMPTY);
- } else {
- Widget[] items = findItems(element);
- if (items.length != 0) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof TreeItem) {
- contentProvider.preserveState(getTreePathFromItem((TreeItem)items[i]));
- } else {
- contentProvider.preserveState(TreePath.EMPTY);
- }
- }
- }
- }
- super.internalRefresh(element, updateLabels);
- }
-
- /**
- * Refreshes the columns in the view, based on the viewer input.
- */
- protected void refreshColumns() {
- configureColumns();
- refresh();
- }
+ ITreeModelContentProvider contentProvider = (ITreeModelContentProvider)getContentProvider();
+
+ if (element == null) {
+ internalRefresh(getControl(), getRoot(), true, updateLabels);
+ contentProvider.preserveState(TreePath.EMPTY);
+ } else {
+ Widget[] items = findItems(element);
+ if (items.length != 0) {
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] instanceof TreeItem) {
+ contentProvider.preserveState(getTreePathFromItem((TreeItem)items[i]));
+ } else {
+ contentProvider.preserveState(TreePath.EMPTY);
+ }
+ }
+ }
+ }
+ super.internalRefresh(element, updateLabels);
+ }
+
+ /**
+ * Refreshes the columns in the view, based on the viewer input.
+ */
+ protected void refreshColumns() {
+ configureColumns();
+ refresh();
+ }
/**
* Returns whether columns are being displayed currently.
@@ -665,28 +665,28 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
return bool.booleanValue();
}
- /**
- * Creates new columns for the given presentation.
- *
- * TODO: does this need to be asynchronous?
- *
- * @param presentation the column presentation to build from
- */
- protected void buildColumns(IColumnPresentation presentation) {
- // dispose current columns, persisting their weights
- Tree tree = getTree();
+ /**
+ * Creates new columns for the given presentation.
+ *
+ * TODO: does this need to be asynchronous?
+ *
+ * @param presentation the column presentation to build from
+ */
+ protected void buildColumns(IColumnPresentation presentation) {
+ // dispose current columns, persisting their weights
+ Tree tree = getTree();
final TreeColumn[] columns = tree.getColumns();
String[] visibleColumnIds = getVisibleColumns();
// remove all listeners before disposing - see bug 223233
- for (int i = 0; i < columns.length; i++) {
- columns[i].removeControlListener(fListener);
- }
- for (int i = 0; i < columns.length; i++) {
+ for (int i = 0; i < columns.length; i++) {
+ columns[i].removeControlListener(fListener);
+ }
+ for (int i = 0; i < columns.length; i++) {
columns[i].dispose();
}
- PresentationContext presentationContext = (PresentationContext) getPresentationContext();
- if (presentation != null) {
- for (int i = 0; i < visibleColumnIds.length; i++) {
+ PresentationContext presentationContext = (PresentationContext) getPresentationContext();
+ if (presentation != null) {
+ for (int i = 0; i < visibleColumnIds.length; i++) {
String id = visibleColumnIds[i];
String header = presentation.getHeader(id);
// TODO: allow client to specify style
@@ -700,68 +700,68 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
}
column.setData(id);
}
- int[] order = fColumnOrder.get(presentation.getId());
- if (order != null) {
- tree.setColumnOrder(order);
- }
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- presentationContext.setColumns(visibleColumnIds);
- setColumnProperties(visibleColumnIds);
- setCellModifier(fCellModifier);
- } else {
- tree.setHeaderVisible(false);
- tree.setLinesVisible(false);
- presentationContext.setColumns(null);
- setCellModifier(null);
- setColumnProperties(null);
- }
-
- int treeWidgetWidth = tree.getSize().x;
- int avg = treeWidgetWidth;
- if (visibleColumnIds != null) {
+ int[] order = fColumnOrder.get(presentation.getId());
+ if (order != null) {
+ tree.setColumnOrder(order);
+ }
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ presentationContext.setColumns(visibleColumnIds);
+ setColumnProperties(visibleColumnIds);
+ setCellModifier(fCellModifier);
+ } else {
+ tree.setHeaderVisible(false);
+ tree.setLinesVisible(false);
+ presentationContext.setColumns(null);
+ setCellModifier(null);
+ setColumnProperties(null);
+ }
+
+ int treeWidgetWidth = tree.getSize().x;
+ int avg = treeWidgetWidth;
+ if (visibleColumnIds != null) {
avg /= visibleColumnIds.length;
}
- if (avg == 0) {
- tree.addPaintListener(new PaintListener() {
- @Override
+ if (avg == 0) {
+ tree.addPaintListener(new PaintListener() {
+ @Override
public void paintControl(PaintEvent e) {
- Tree tree2 = getTree();
- String[] visibleColumns = getVisibleColumns();
- if (visibleColumns != null) {
- int treeWidgetWidth1 = tree2.getSize().x;
+ Tree tree2 = getTree();
+ String[] visibleColumns = getVisibleColumns();
+ if (visibleColumns != null) {
+ int treeWidgetWidth1 = tree2.getSize().x;
int avg1 = treeWidgetWidth1 / visibleColumns.length;
- initColumns(avg1, treeWidgetWidth1, visibleColumns);
- }
- tree2.removePaintListener(this);
- }
- });
- } else {
- initColumns(avg, treeWidgetWidth, visibleColumnIds);
- }
- }
-
- private void initColumns(int widthHint, int treeWidgetWidth, String[] visibleColumnIds) {
- TreeColumn[] columns = getTree().getColumns();
- for (int i = 0; i < columns.length; i++) {
- TreeColumn treeColumn = columns[i];
- Object colData = treeColumn.getData();
- String columnId = colData instanceof String ? (String) colData : null;
- Integer width = fColumnSizes.get(colData);
- if (width == null) {
- int ans = getInitialColumnWidth(columnId, treeWidgetWidth, visibleColumnIds);
- if (ans == -1) {
- treeColumn.setWidth(widthHint);
- } else {
- treeColumn.setWidth(ans);
- }
- } else {
- treeColumn.setWidth(width.intValue());
- }
- treeColumn.addControlListener(fListener);
- }
- }
+ initColumns(avg1, treeWidgetWidth1, visibleColumns);
+ }
+ tree2.removePaintListener(this);
+ }
+ });
+ } else {
+ initColumns(avg, treeWidgetWidth, visibleColumnIds);
+ }
+ }
+
+ private void initColumns(int widthHint, int treeWidgetWidth, String[] visibleColumnIds) {
+ TreeColumn[] columns = getTree().getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ TreeColumn treeColumn = columns[i];
+ Object colData = treeColumn.getData();
+ String columnId = colData instanceof String ? (String) colData : null;
+ Integer width = fColumnSizes.get(colData);
+ if (width == null) {
+ int ans = getInitialColumnWidth(columnId, treeWidgetWidth, visibleColumnIds);
+ if (ans == -1) {
+ treeColumn.setWidth(widthHint);
+ } else {
+ treeColumn.setWidth(ans);
+ }
+ } else {
+ treeColumn.setWidth(width.intValue());
+ }
+ treeColumn.addControlListener(fListener);
+ }
+ }
/**
* Returns the current column presentation for this viewer, or <code>null</code>
@@ -788,25 +788,25 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
if (columns == null) {
return presentation.getInitialColumns();
} else {
- String[] available = presentation.getAvailableColumns();
- for (int i = 0; i < columns.length; i++) {
- boolean columnAvailable = false;
- for (int j = 0; j < available.length; j++) {
- if (columns[i].equals(available[j])) {
+ String[] available = presentation.getAvailableColumns();
+ for (int i = 0; i < columns.length; i++) {
+ boolean columnAvailable = false;
+ for (int j = 0; j < available.length; j++) {
+ if (columns[i].equals(available[j])) {
columnAvailable = true;
}
- }
-
- if (!columnAvailable || presentation.getHeader(columns[i]) == null) {
- // We found a column ID which is not in current list of available column IDs.
- // Or the presentation cannot return a header title for the given column.
- // Clear out saved column data for given column presentation.
- fVisibleColumns.remove(presentation.getId());
- fColumnOrder.remove(presentation.getId());
- fColumnSizes.remove(presentation.getId());
- return presentation.getInitialColumns();
- }
- }
+ }
+
+ if (!columnAvailable || presentation.getHeader(columns[i]) == null) {
+ // We found a column ID which is not in current list of available column IDs.
+ // Or the presentation cannot return a header title for the given column.
+ // Clear out saved column data for given column presentation.
+ fVisibleColumns.remove(presentation.getId());
+ fColumnOrder.remove(presentation.getId());
+ fColumnSizes.remove(presentation.getId());
+ return presentation.getInitialColumns();
+ }
+ }
}
return columns;
}
@@ -834,9 +834,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
}
/**
- * Persists column sizes in cache
- */
- protected void persistColumnSizes() {
+ * Persists column sizes in cache
+ */
+ protected void persistColumnSizes() {
Tree tree = getTree();
TreeColumn[] columns = tree.getColumns();
for (int i = 0; i < columns.length; i++) {
@@ -844,29 +844,29 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
Object id = treeColumn.getData();
fColumnSizes.put(id, Integer.valueOf(treeColumn.getWidth()));
}
- }
-
- /**
- * Persists column ordering
- */
- protected void persistColumnOrder() {
- IColumnPresentation presentation = getColumnPresentation();
- if (presentation != null) {
- Tree tree = getTree();
- int[] order = tree.getColumnOrder();
- if (order.length > 0) {
- for (int i = 0; i < order.length; i++) {
+ }
+
+ /**
+ * Persists column ordering
+ */
+ protected void persistColumnOrder() {
+ IColumnPresentation presentation = getColumnPresentation();
+ if (presentation != null) {
+ Tree tree = getTree();
+ int[] order = tree.getColumnOrder();
+ if (order.length > 0) {
+ for (int i = 0; i < order.length; i++) {
if (i != order[i]) {
// non default order
fColumnOrder.put(presentation.getId(), order);
return;
}
}
- }
- // default order
- fColumnOrder.remove(presentation.getId());
- }
- }
+ }
+ // default order
+ fColumnOrder.remove(presentation.getId());
+ }
+ }
/**
* Save viewer state into the given memento.
@@ -1022,7 +1022,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
return false;
}
/**
- * Registers the specified listener for view update notifications.
+ * Registers the specified listener for view update notifications.
*
* @param listener listener
*/
@@ -1038,7 +1038,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
*/
@Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {
- ITreeModelContentProvider cp = (ITreeModelContentProvider)getContentProvider();
+ ITreeModelContentProvider cp = (ITreeModelContentProvider)getContentProvider();
if (cp != null) {
cp.removeViewerUpdateListener(listener);
}
@@ -1061,24 +1061,24 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
*/
@Override
public void removeModelChangedListener(IModelChangedListener listener) {
- ITreeModelContentProvider cp = (ITreeModelContentProvider)getContentProvider();
+ ITreeModelContentProvider cp = (ITreeModelContentProvider)getContentProvider();
if (cp != null) {
cp.removeModelChangedListener(listener);
}
}
- @Override
+ @Override
public void addStateUpdateListener(IStateUpdateListener listener) {
- ((ITreeModelContentProvider)getContentProvider()).addStateUpdateListener(listener);
- }
+ ((ITreeModelContentProvider)getContentProvider()).addStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void removeStateUpdateListener(IStateUpdateListener listener) {
- ITreeModelContentProvider cp = (ITreeModelContentProvider)getContentProvider();
- if (cp != null) {
- cp.removeStateUpdateListener(listener);
- }
- }
+ ITreeModelContentProvider cp = (ITreeModelContentProvider)getContentProvider();
+ if (cp != null) {
+ cp.removeStateUpdateListener(listener);
+ }
+ }
@Override
protected void doUpdateItem(final Item item, Object element) {
@@ -1092,9 +1092,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
}
if ( !((ITreeModelLabelProvider)getLabelProvider()).update(getTreePathFromItem(item)) ) {
- if (element instanceof String) {
- item.setData(PREV_LABEL_KEY, new String[] { (String)element } );
- }
+ if (element instanceof String) {
+ item.setData(PREV_LABEL_KEY, new String[] { (String)element } );
+ }
}
@@ -1107,14 +1107,14 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
@Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {
- ((ITreeModelLabelProvider)getLabelProvider()).addLabelUpdateListener(listener);
+ ((ITreeModelLabelProvider)getLabelProvider()).addLabelUpdateListener(listener);
}
@Override
public void removeLabelUpdateListener(ILabelUpdateListener listener) {
- if (!getControl().isDisposed()) {
- ((ITreeModelLabelProvider)getLabelProvider()).removeLabelUpdateListener(listener);
- }
+ if (!getControl().isDisposed()) {
+ ((ITreeModelLabelProvider)getLabelProvider()).removeLabelUpdateListener(listener);
+ }
}
/**
@@ -1271,50 +1271,50 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
//**************************************************************************
// Another couple of methods copied from TreeViewer to workaround the UI bug 266189.
//
- @Override
+ @Override
protected void createChildren(Widget widget) {
- Object element = widget.getData();
- if (element == null && widget instanceof TreeItem) {
- // parent has not been materialized
- virtualMaterializeItem((TreeItem) widget);
- // try getting the element now that updateElement was called
- element = widget.getData();
- }
- if (element == null) {
- // give up because the parent is still not materialized
- return;
- }
- Item[] children = getChildren(widget);
- if (children.length == 1 && children[0].getData() == null) {
- // found a dummy node
- virtualLazyUpdateChildCount(widget, children.length);
- children = getChildren(widget);
- }
- // DO NOT touch all children
- return;
- }
-
- private void virtualMaterializeItem(TreeItem treeItem) {
- if (treeItem.getData() != null) {
- // already materialized
- return;
- }
-
- int index;
- Widget parent = treeItem.getParentItem();
- if (parent == null) {
- parent = treeItem.getParent();
- }
- Object parentElement = parent.getData();
- if (parentElement != null) {
- if (parent instanceof Tree) {
- index = ((Tree) parent).indexOf(treeItem);
- } else {
- index = ((TreeItem) parent).indexOf(treeItem);
- }
- virtualLazyUpdateWidget(parent, index);
- }
- }
+ Object element = widget.getData();
+ if (element == null && widget instanceof TreeItem) {
+ // parent has not been materialized
+ virtualMaterializeItem((TreeItem) widget);
+ // try getting the element now that updateElement was called
+ element = widget.getData();
+ }
+ if (element == null) {
+ // give up because the parent is still not materialized
+ return;
+ }
+ Item[] children = getChildren(widget);
+ if (children.length == 1 && children[0].getData() == null) {
+ // found a dummy node
+ virtualLazyUpdateChildCount(widget, children.length);
+ children = getChildren(widget);
+ }
+ // DO NOT touch all children
+ return;
+ }
+
+ private void virtualMaterializeItem(TreeItem treeItem) {
+ if (treeItem.getData() != null) {
+ // already materialized
+ return;
+ }
+
+ int index;
+ Widget parent = treeItem.getParentItem();
+ if (parent == null) {
+ parent = treeItem.getParent();
+ }
+ Object parentElement = parent.getData();
+ if (parentElement != null) {
+ if (parent instanceof Tree) {
+ index = ((Tree) parent).indexOf(treeItem);
+ } else {
+ index = ((TreeItem) parent).indexOf(treeItem);
+ }
+ virtualLazyUpdateWidget(parent, index);
+ }
+ }
/**
@@ -1333,470 +1333,470 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
}
}
- @Override
+ @Override
public int findElementIndex(TreePath parentPath, Object element) {
- Widget parentItem = findItem(parentPath);
- if (parentItem != null) {
- Item[] children = getChildren(parentItem);
- for (int i = 0; i < children.length; i++) {
- Item item = children[i];
- Object data = item.getData();
- if ( (element != null && element.equals(data)) || (element == null && data == null) ) {
- return i;
- }
- }
- }
- return -1;
- }
-
- @Override
+ Widget parentItem = findItem(parentPath);
+ if (parentItem != null) {
+ Item[] children = getChildren(parentItem);
+ for (int i = 0; i < children.length; i++) {
+ Item item = children[i];
+ Object data = item.getData();
+ if ( (element != null && element.equals(data)) || (element == null && data == null) ) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ @Override
public boolean getElementChildrenRealized(TreePath parentPath) {
- Widget parentItem = findItem(parentPath);
- if (parentItem != null) {
- Item[] children = getChildren(parentItem);
- for (int i = 0; i < children.length; i++) {
- if (children[i].getData() == null) {
- return false;
- }
- }
- }
- return true;
- }
-
- @Override
+ Widget parentItem = findItem(parentPath);
+ if (parentItem != null) {
+ Item[] children = getChildren(parentItem);
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].getData() == null) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
public Display getDisplay() {
- Control control = getControl();
+ Control control = getControl();
if (control != null && !control.isDisposed()) {
- return control.getDisplay();
- }
- return null;
- }
+ return control.getDisplay();
+ }
+ return null;
+ }
- protected static final String[] STATE_PROPERTIES = new String[]{ IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE };
+ protected static final String[] STATE_PROPERTIES = new String[]{ IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE };
- @Override
+ @Override
public void update(Object element) {
- update(element, STATE_PROPERTIES);
- }
-
- /**
- * Label data cache keys
- * TODO: workaround for bug 159461
- */
- static String PREV_LABEL_KEY = "PREV_LABEL_KEY"; //$NON-NLS-1$
- static String PREV_IMAGE_KEY = "PREV_IMAGE_KEY"; //$NON-NLS-1$
- static String PREV_FONT_KEY = "PREV_FONT_KEY"; //$NON-NLS-1$
- static String PREV_FOREGROUND_KEY = "PREV_FOREGROUND_KEY"; //$NON-NLS-1$
- static String PREV_BACKGROUND_KEY = "PREV_BACKGROUND_KEY"; //$NON-NLS-1$
- static String PREV_CHECKED_KEY = "PREV_CHECKED_KEY"; //$NON-NLS-1$
- static String PREV_GRAYED_KEY = "PREV_GRAYED_KEY"; //$NON-NLS-1$
-
- @Override
+ update(element, STATE_PROPERTIES);
+ }
+
+ /**
+ * Label data cache keys
+ * TODO: workaround for bug 159461
+ */
+ static String PREV_LABEL_KEY = "PREV_LABEL_KEY"; //$NON-NLS-1$
+ static String PREV_IMAGE_KEY = "PREV_IMAGE_KEY"; //$NON-NLS-1$
+ static String PREV_FONT_KEY = "PREV_FONT_KEY"; //$NON-NLS-1$
+ static String PREV_FOREGROUND_KEY = "PREV_FOREGROUND_KEY"; //$NON-NLS-1$
+ static String PREV_BACKGROUND_KEY = "PREV_BACKGROUND_KEY"; //$NON-NLS-1$
+ static String PREV_CHECKED_KEY = "PREV_CHECKED_KEY"; //$NON-NLS-1$
+ static String PREV_GRAYED_KEY = "PREV_GRAYED_KEY"; //$NON-NLS-1$
+
+ @Override
public void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] imageDescriptors,
- FontData[] fontDatas, RGB[] _foregrounds, RGB[] _backgrounds)
- {
- Widget widget = findItem(path);
- String[] columnIds = getVisibleColumns();
-
- if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
- TreeItem item = (TreeItem)widget;
- /*Object data = item.getData();
- int itemCount = item.getItemCount();
- item.clearAll(false);
- item.setData(data);
- item.setItemCount(itemCount);*/
-
- for (int i=0; i<numColumns; i++){
- // text might be null if the launch has been terminated
- item.setText(i,(labels[i] == null ? IInternalDebugCoreConstants.EMPTY_STRING : labels[i]));
- }
- item.setData(PREV_LABEL_KEY, labels);
-
- if (imageDescriptors == null) {
- for (int i=0; i<numColumns; i++){
- item.setImage(i,null);
- }
- item.setData(PREV_IMAGE_KEY, null);
- } else {
- Image[] images = new Image[imageDescriptors.length];
- for (int i = 0; i < imageDescriptors.length; i++) {
- images[i] = ((ITreeModelLabelProvider)getLabelProvider()).getImage(imageDescriptors[i]);
- }
- if (columnIds == null) {
- item.setImage(images[0]);
- } else {
- item.setImage(images);
- }
- item.setData(PREV_IMAGE_KEY, images);
- }
-
- if (_foregrounds == null) {
- for (int i=0; i<numColumns; i++){
- item.setForeground(i,null);
- }
- item.setData(PREV_FOREGROUND_KEY, null);
- } else {
- Color[] foregrounds = new Color[_foregrounds.length];
- for (int i = 0; i< foregrounds.length; i++) {
- foregrounds[i] = ((ITreeModelLabelProvider)getLabelProvider()).getColor(_foregrounds[i]);
- }
- if (columnIds == null) {
- item.setForeground(0,foregrounds[0]);
- } else {
- for (int i = 0; i< foregrounds.length; i++) {
- item.setForeground(i, foregrounds[i]);
- }
- }
- item.setData(PREV_FOREGROUND_KEY, foregrounds);
- }
-
- if (_backgrounds == null) {
- for (int i=0; i<numColumns; i++){
- item.setBackground(i,null);
- }
- item.setData(PREV_BACKGROUND_KEY, null);
- } else {
- Color[] backgrounds = new Color[_backgrounds.length];
- for (int i = 0; i< backgrounds.length; i++) {
- backgrounds[i] = ((ITreeModelLabelProvider)getLabelProvider()).getColor(_backgrounds[i]);
- }
- if (columnIds == null) {
- item.setBackground(0,backgrounds[0]);
- } else {
- for (int i = 0; i< backgrounds.length; i++) {
- item.setBackground(i, backgrounds[i]);
- }
- }
- item.setData(PREV_BACKGROUND_KEY, backgrounds);
- }
-
- if (fontDatas == null) {
- for (int i=0; i<numColumns; i++){
- item.setFont(i,null);
- }
- item.setData(PREV_FONT_KEY, null);
- } else {
- Font[] fonts = new Font[fontDatas.length];
- for (int i = 0; i < fontDatas.length; i++) {
- fonts[i] = ((ITreeModelLabelProvider)getLabelProvider()).getFont(fontDatas[i]);
- }
- if (columnIds == null) {
- item.setFont(0,fonts[0]);
- } else {
- for (int i = 0; i < fonts.length; i++) {
- item.setFont(i, fonts[i]);
- }
- }
- item.setData(PREV_FONT_KEY, fonts);
- }
- }
- }
-
- @Override
+ FontData[] fontDatas, RGB[] _foregrounds, RGB[] _backgrounds)
+ {
+ Widget widget = findItem(path);
+ String[] columnIds = getVisibleColumns();
+
+ if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
+ TreeItem item = (TreeItem)widget;
+ /*Object data = item.getData();
+ int itemCount = item.getItemCount();
+ item.clearAll(false);
+ item.setData(data);
+ item.setItemCount(itemCount);*/
+
+ for (int i=0; i<numColumns; i++){
+ // text might be null if the launch has been terminated
+ item.setText(i,(labels[i] == null ? IInternalDebugCoreConstants.EMPTY_STRING : labels[i]));
+ }
+ item.setData(PREV_LABEL_KEY, labels);
+
+ if (imageDescriptors == null) {
+ for (int i=0; i<numColumns; i++){
+ item.setImage(i,null);
+ }
+ item.setData(PREV_IMAGE_KEY, null);
+ } else {
+ Image[] images = new Image[imageDescriptors.length];
+ for (int i = 0; i < imageDescriptors.length; i++) {
+ images[i] = ((ITreeModelLabelProvider)getLabelProvider()).getImage(imageDescriptors[i]);
+ }
+ if (columnIds == null) {
+ item.setImage(images[0]);
+ } else {
+ item.setImage(images);
+ }
+ item.setData(PREV_IMAGE_KEY, images);
+ }
+
+ if (_foregrounds == null) {
+ for (int i=0; i<numColumns; i++){
+ item.setForeground(i,null);
+ }
+ item.setData(PREV_FOREGROUND_KEY, null);
+ } else {
+ Color[] foregrounds = new Color[_foregrounds.length];
+ for (int i = 0; i< foregrounds.length; i++) {
+ foregrounds[i] = ((ITreeModelLabelProvider)getLabelProvider()).getColor(_foregrounds[i]);
+ }
+ if (columnIds == null) {
+ item.setForeground(0,foregrounds[0]);
+ } else {
+ for (int i = 0; i< foregrounds.length; i++) {
+ item.setForeground(i, foregrounds[i]);
+ }
+ }
+ item.setData(PREV_FOREGROUND_KEY, foregrounds);
+ }
+
+ if (_backgrounds == null) {
+ for (int i=0; i<numColumns; i++){
+ item.setBackground(i,null);
+ }
+ item.setData(PREV_BACKGROUND_KEY, null);
+ } else {
+ Color[] backgrounds = new Color[_backgrounds.length];
+ for (int i = 0; i< backgrounds.length; i++) {
+ backgrounds[i] = ((ITreeModelLabelProvider)getLabelProvider()).getColor(_backgrounds[i]);
+ }
+ if (columnIds == null) {
+ item.setBackground(0,backgrounds[0]);
+ } else {
+ for (int i = 0; i< backgrounds.length; i++) {
+ item.setBackground(i, backgrounds[i]);
+ }
+ }
+ item.setData(PREV_BACKGROUND_KEY, backgrounds);
+ }
+
+ if (fontDatas == null) {
+ for (int i=0; i<numColumns; i++){
+ item.setFont(i,null);
+ }
+ item.setData(PREV_FONT_KEY, null);
+ } else {
+ Font[] fonts = new Font[fontDatas.length];
+ for (int i = 0; i < fontDatas.length; i++) {
+ fonts[i] = ((ITreeModelLabelProvider)getLabelProvider()).getFont(fontDatas[i]);
+ }
+ if (columnIds == null) {
+ item.setFont(0,fonts[0]);
+ } else {
+ for (int i = 0; i < fonts.length; i++) {
+ item.setFont(i, fonts[i]);
+ }
+ }
+ item.setData(PREV_FONT_KEY, fonts);
+ }
+ }
+ }
+
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
- if (path.getSegmentCount() == 0) {
- return null;
- }
-
- int columnIdx = -1;
- String[] visibleColumns = getVisibleColumns();
- if (columnId != null && visibleColumns != null) {
- int i = 0;
- for (i = 0; i < visibleColumns.length; i++) {
- if (columnId.equals(getVisibleColumns()[i])) {
- columnIdx = i;
- break;
- }
- }
- if (i == visibleColumns.length) {
- return null;
- }
- } else {
- columnIdx = 0;
- }
- TreeItem item = (TreeItem)findItem(path);
-
- if (item != null) {
- ViewerLabel label = new ViewerLabel(item.getText(columnIdx), item.getImage(columnIdx));
- label.setFont(item.getFont(columnIdx));
- label.setBackground(item.getBackground(columnIdx));
- label.setForeground(item.getForeground(columnIdx));
- return label;
- }
- return null;
- }
-
- @Override
+ if (path.getSegmentCount() == 0) {
+ return null;
+ }
+
+ int columnIdx = -1;
+ String[] visibleColumns = getVisibleColumns();
+ if (columnId != null && visibleColumns != null) {
+ int i = 0;
+ for (i = 0; i < visibleColumns.length; i++) {
+ if (columnId.equals(getVisibleColumns()[i])) {
+ columnIdx = i;
+ break;
+ }
+ }
+ if (i == visibleColumns.length) {
+ return null;
+ }
+ } else {
+ columnIdx = 0;
+ }
+ TreeItem item = (TreeItem)findItem(path);
+
+ if (item != null) {
+ ViewerLabel label = new ViewerLabel(item.getText(columnIdx), item.getImage(columnIdx));
+ label.setFont(item.getFont(columnIdx));
+ label.setBackground(item.getBackground(columnIdx));
+ label.setForeground(item.getForeground(columnIdx));
+ return label;
+ }
+ return null;
+ }
+
+ @Override
public void reveal(TreePath path, int index) {
- Widget item = findItem(path);
- TreeItem[] children = null;
- if (item instanceof TreeItem) {
- children = ((TreeItem)item).getItems();
- } else if (item instanceof Tree) {
- children = ((Tree)item).getItems();
- }
- if (children != null && index < children.length) {
- getTree().setTopItem(children[index]);
- }
- }
-
- @Override
+ Widget item = findItem(path);
+ TreeItem[] children = null;
+ if (item instanceof TreeItem) {
+ children = ((TreeItem)item).getItems();
+ } else if (item instanceof Tree) {
+ children = ((Tree)item).getItems();
+ }
+ if (children != null && index < children.length) {
+ getTree().setTopItem(children[index]);
+ }
+ }
+
+ @Override
public int getChildCount(TreePath path) {
- if (path.getSegmentCount() == 0) {
- return ((Tree)getControl()).getItemCount();
- } else {
- Widget[] items = internalFindItems(path);
- if (items.length > 0) {
- if (items[0] instanceof TreeItem) {
- return ((TreeItem)items[0]).getItemCount();
- }
- }
- }
- return -1;
- }
-
- @Override
+ if (path.getSegmentCount() == 0) {
+ return ((Tree)getControl()).getItemCount();
+ } else {
+ Widget[] items = internalFindItems(path);
+ if (items.length > 0) {
+ if (items[0] instanceof TreeItem) {
+ return ((TreeItem)items[0]).getItemCount();
+ }
+ }
+ }
+ return -1;
+ }
+
+ @Override
public Object getChildElement(TreePath path, int index) {
- TreeItem childItem = null;
- if (path.getSegmentCount() == 0) {
- Tree tree = (Tree)getControl();
- try {
- childItem = tree.getItem(index);
- } catch (IllegalArgumentException e) {}
- } else {
- try {
- Widget[] items = internalFindItems(path);
- if (items.length > 0) {
- if (items[0] instanceof TreeItem) {
- childItem = ((TreeItem)items[0]).getItem(index);
- }
- }
- } catch (IllegalArgumentException e) {}
- }
- if (childItem != null) {
- return childItem.getData();
- }
- return null;
- }
-
- @Override
+ TreeItem childItem = null;
+ if (path.getSegmentCount() == 0) {
+ Tree tree = (Tree)getControl();
+ try {
+ childItem = tree.getItem(index);
+ } catch (IllegalArgumentException e) {}
+ } else {
+ try {
+ Widget[] items = internalFindItems(path);
+ if (items.length > 0) {
+ if (items[0] instanceof TreeItem) {
+ childItem = ((TreeItem)items[0]).getItem(index);
+ }
+ }
+ } catch (IllegalArgumentException e) {}
+ }
+ if (childItem != null) {
+ return childItem.getData();
+ }
+ return null;
+ }
+
+ @Override
public TreePath getTopElementPath() {
- TreeItem topItem = ((Tree)getControl()).getTopItem();
+ TreeItem topItem = ((Tree)getControl()).getTopItem();
if (topItem != null && !topItem.isDisposed() && topItem.getData() != null) {
- return getTreePathFromItem(topItem);
- }
- return null;
- }
+ return getTreePathFromItem(topItem);
+ }
+ return null;
+ }
- @Override
+ @Override
public boolean saveElementState(TreePath path, ModelDelta delta, int flagsToSave) {
- Tree tree = (Tree) getControl();
- TreeItem[] selection = tree.getSelection();
+ Tree tree = (Tree) getControl();
+ TreeItem[] selection = tree.getSelection();
Set<TreeItem> set = new HashSet<>();
- for (int i = 0; i < selection.length; i++) {
- set.add(selection[i]);
- }
-
- TreeItem[] items = null;
- Widget w = internalGetWidgetToSelect(path);
- if (w instanceof Tree) {
- delta.setChildCount(
- ((ITreeModelContentProvider)getContentProvider()).viewToModelCount(path, tree.getItemCount()));
- if ((flagsToSave & IModelDelta.EXPAND) != 0) {
- delta.setFlags(delta.getFlags() | IModelDelta.EXPAND);
- }
- items = tree.getItems();
- } else if (w instanceof TreeItem) {
- TreeItem item = (TreeItem)w;
- if (item.getExpanded()) {
- int itemCount = item.getData() != null ? item.getItemCount() : -1;
- delta.setChildCount(((ITreeModelContentProvider)getContentProvider()).viewToModelCount(path, itemCount));
- if ((flagsToSave & IModelDelta.EXPAND) != 0) {
- delta.setFlags(delta.getFlags() | IModelDelta.EXPAND);
- }
- } else if ((flagsToSave & IModelDelta.COLLAPSE) != 0){
- delta.setFlags(delta.getFlags() | IModelDelta.COLLAPSE);
- }
-
- if (set.contains(item) && (flagsToSave & IModelDelta.SELECT) != 0) {
- delta.setFlags(delta.getFlags() | IModelDelta.SELECT);
- }
- items = ((TreeItem)w).getItems();
- }
- if (items != null && items.length != 0) {
- for (int i = 0; i < items.length; i++) {
- doSaveElementState(path, delta, items[i], set, i, flagsToSave);
- }
- return true;
- } else {
- return false;
- }
- }
+ for (int i = 0; i < selection.length; i++) {
+ set.add(selection[i]);
+ }
+
+ TreeItem[] items = null;
+ Widget w = internalGetWidgetToSelect(path);
+ if (w instanceof Tree) {
+ delta.setChildCount(
+ ((ITreeModelContentProvider)getContentProvider()).viewToModelCount(path, tree.getItemCount()));
+ if ((flagsToSave & IModelDelta.EXPAND) != 0) {
+ delta.setFlags(delta.getFlags() | IModelDelta.EXPAND);
+ }
+ items = tree.getItems();
+ } else if (w instanceof TreeItem) {
+ TreeItem item = (TreeItem)w;
+ if (item.getExpanded()) {
+ int itemCount = item.getData() != null ? item.getItemCount() : -1;
+ delta.setChildCount(((ITreeModelContentProvider)getContentProvider()).viewToModelCount(path, itemCount));
+ if ((flagsToSave & IModelDelta.EXPAND) != 0) {
+ delta.setFlags(delta.getFlags() | IModelDelta.EXPAND);
+ }
+ } else if ((flagsToSave & IModelDelta.COLLAPSE) != 0){
+ delta.setFlags(delta.getFlags() | IModelDelta.COLLAPSE);
+ }
+
+ if (set.contains(item) && (flagsToSave & IModelDelta.SELECT) != 0) {
+ delta.setFlags(delta.getFlags() | IModelDelta.SELECT);
+ }
+ items = ((TreeItem)w).getItems();
+ }
+ if (items != null && items.length != 0) {
+ for (int i = 0; i < items.length; i++) {
+ doSaveElementState(path, delta, items[i], set, i, flagsToSave);
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
private void doSaveElementState(TreePath parentPath, ModelDelta delta, TreeItem item, Collection<TreeItem> set, int index, int flagsToSave) {
- Object element = item.getData();
- if (element != null) {
- boolean expanded = item.getExpanded();
- boolean selected = set.contains(item);
- int flags = IModelDelta.NO_CHANGE;
- if (expanded && (flagsToSave & IModelDelta.EXPAND) != 0) {
- flags = flags | IModelDelta.EXPAND;
- }
- if (!expanded && (flagsToSave & IModelDelta.COLLAPSE) != 0) {
- flags = flags | IModelDelta.COLLAPSE;
- }
- if (selected && (flagsToSave & IModelDelta.SELECT) != 0) {
- flags = flags | IModelDelta.SELECT;
- }
- if (expanded || flags != IModelDelta.NO_CHANGE) {
- int modelIndex = ((ITreeModelContentProvider)getContentProvider()).viewToModelIndex(parentPath, index);
- TreePath elementPath = parentPath.createChildPath(element);
- ModelDelta childDelta = delta.addNode(element, modelIndex, flags, -1);
- if (expanded) {
- // Only get the item count if the item is expanded. Getting
- // item count triggers an update of the element (bug 335734).
- int itemCount = item.getItemCount();
- int numChildren = ((ITreeModelContentProvider)getContentProvider()).viewToModelCount(elementPath, itemCount);
- childDelta.setChildCount(numChildren);
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- doSaveElementState(elementPath, childDelta, items[i], set, i, flagsToSave);
- }
- }
- }
- }
- }
-
- @Override
+ Object element = item.getData();
+ if (element != null) {
+ boolean expanded = item.getExpanded();
+ boolean selected = set.contains(item);
+ int flags = IModelDelta.NO_CHANGE;
+ if (expanded && (flagsToSave & IModelDelta.EXPAND) != 0) {
+ flags = flags | IModelDelta.EXPAND;
+ }
+ if (!expanded && (flagsToSave & IModelDelta.COLLAPSE) != 0) {
+ flags = flags | IModelDelta.COLLAPSE;
+ }
+ if (selected && (flagsToSave & IModelDelta.SELECT) != 0) {
+ flags = flags | IModelDelta.SELECT;
+ }
+ if (expanded || flags != IModelDelta.NO_CHANGE) {
+ int modelIndex = ((ITreeModelContentProvider)getContentProvider()).viewToModelIndex(parentPath, index);
+ TreePath elementPath = parentPath.createChildPath(element);
+ ModelDelta childDelta = delta.addNode(element, modelIndex, flags, -1);
+ if (expanded) {
+ // Only get the item count if the item is expanded. Getting
+ // item count triggers an update of the element (bug 335734).
+ int itemCount = item.getItemCount();
+ int numChildren = ((ITreeModelContentProvider)getContentProvider()).viewToModelCount(elementPath, itemCount);
+ childDelta.setChildCount(numChildren);
+ TreeItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ doSaveElementState(elementPath, childDelta, items[i], set, i, flagsToSave);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
public void updateViewer(IModelDelta delta) {
- ((ITreeModelContentProvider)getContentProvider()).updateModel(delta, ITreeModelContentProvider.ALL_MODEL_DELTA_FLAGS);
- }
+ ((ITreeModelContentProvider)getContentProvider()).updateModel(delta, ITreeModelContentProvider.ALL_MODEL_DELTA_FLAGS);
+ }
@Override
public void setElementChecked(TreePath path, boolean checked, boolean grayed) {
- Widget widget = findItem(path);
+ Widget widget = findItem(path);
- if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
- TreeItem item = (TreeItem)widget;
+ if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
+ TreeItem item = (TreeItem)widget;
- item.setChecked(checked);
- item.setGrayed(grayed);
+ item.setChecked(checked);
+ item.setGrayed(grayed);
- item.setData(PREV_CHECKED_KEY, checked ? Boolean.TRUE : Boolean.FALSE);
- item.setData(PREV_GRAYED_KEY, grayed ? Boolean.TRUE : Boolean.FALSE);
- }
+ item.setData(PREV_CHECKED_KEY, checked ? Boolean.TRUE : Boolean.FALSE);
+ item.setData(PREV_GRAYED_KEY, grayed ? Boolean.TRUE : Boolean.FALSE);
+ }
}
- @Override
+ @Override
public boolean getElementChecked(TreePath path) {
- Widget widget = findItem(path);
-
- if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
- TreeItem item = (TreeItem)widget;
-
- return item.getChecked();
- }
- return false;
- }
-
- /**
- * Retrieves the element's check box grayed state.
- *
- * @param path the path of the element to set grayed
- * @return grayed
- */
- @Override
+ Widget widget = findItem(path);
+
+ if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
+ TreeItem item = (TreeItem)widget;
+
+ return item.getChecked();
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the element's check box grayed state.
+ *
+ * @param path the path of the element to set grayed
+ * @return grayed
+ */
+ @Override
public boolean getElementGrayed(TreePath path) {
- Widget widget = findItem(path);
+ Widget widget = findItem(path);
- if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
- TreeItem item = (TreeItem)widget;
+ if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) {
+ TreeItem item = (TreeItem)widget;
- return item.getGrayed();
- }
- return false;
- }
+ return item.getGrayed();
+ }
+ return false;
+ }
- @Override
+ @Override
public boolean getHasChildren(Object elementOrTreePath) {
- if (elementOrTreePath instanceof TreePath &&
- ((TreePath)elementOrTreePath).getSegmentCount() == 0)
- {
- return getTree().getItemCount() > 0;
- }
-
- Widget[] items = internalFindItems(elementOrTreePath);
- if (items != null && items.length > 0) {
- if (items[0] instanceof TreeItem) {
- return ((TreeItem)items[0]).getItemCount() > 0;
- } else {
- return ((Tree)items[0]).getItemCount() > 0;
- }
- }
-
- return false;
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath &&
+ ((TreePath)elementOrTreePath).getSegmentCount() == 0)
+ {
+ return getTree().getItemCount() > 0;
+ }
+
+ Widget[] items = internalFindItems(elementOrTreePath);
+ if (items != null && items.length > 0) {
+ if (items[0] instanceof TreeItem) {
+ return ((TreeItem)items[0]).getItemCount() > 0;
+ } else {
+ return ((Tree)items[0]).getItemCount() > 0;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
public TreePath[] getElementPaths(Object element) {
- Widget[] items = internalFindItems(element);
- TreePath[] paths = new TreePath[items.length];
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof Tree) {
- paths[i] = TreePath.EMPTY;
- } else {
- paths[i] = getTreePathFromItem((Item)items[i]);
- }
- }
- return paths;
- }
+ Widget[] items = internalFindItems(element);
+ TreePath[] paths = new TreePath[items.length];
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] instanceof Tree) {
+ paths[i] = TreePath.EMPTY;
+ } else {
+ paths[i] = getTreePathFromItem((Item)items[i]);
+ }
+ }
+ return paths;
+ }
@Override
protected void handleSelect(SelectionEvent event) {
- super.handleSelect(event);
-
- TreeItem item = (TreeItem) event.item;
- if (item != null) { // item can be null when de-selected (bug 296703)
- Object element = item.getData();
- IContentProvider contentProvider = getContentProvider();
- if (element != null && contentProvider instanceof TreeModelContentProvider) {
- TreePath path = getTreePathFromItem(item);
-
- if (event.detail == SWT.CHECK) {
- boolean checked = item.getChecked();
- boolean accepted = ((ITreeModelContentProvider) contentProvider).setChecked(path, checked);
-
- // if the listen rejects the change or there is not ICheckboxModelProxy, than revert the check state
- if (!accepted) {
- item.setChecked(!checked);
- } else {
- item.setData(PREV_CHECKED_KEY, Boolean.valueOf(checked));
- }
- } else {
- ((TreeModelContentProvider) contentProvider).cancelRestore(path, IModelDelta.SELECT|IModelDelta.REVEAL);
- }
- }
- }
+ super.handleSelect(event);
+
+ TreeItem item = (TreeItem) event.item;
+ if (item != null) { // item can be null when de-selected (bug 296703)
+ Object element = item.getData();
+ IContentProvider contentProvider = getContentProvider();
+ if (element != null && contentProvider instanceof TreeModelContentProvider) {
+ TreePath path = getTreePathFromItem(item);
+
+ if (event.detail == SWT.CHECK) {
+ boolean checked = item.getChecked();
+ boolean accepted = ((ITreeModelContentProvider) contentProvider).setChecked(path, checked);
+
+ // if the listen rejects the change or there is not ICheckboxModelProxy, than revert the check state
+ if (!accepted) {
+ item.setChecked(!checked);
+ } else {
+ item.setData(PREV_CHECKED_KEY, Boolean.valueOf(checked));
+ }
+ } else {
+ ((TreeModelContentProvider) contentProvider).cancelRestore(path, IModelDelta.SELECT|IModelDelta.REVEAL);
+ }
+ }
+ }
}
@Override
protected void handleTreeExpand(TreeEvent event) {
- super.handleTreeExpand(event);
- IContentProvider contentProvider = getContentProvider();
- if (contentProvider instanceof TreeModelContentProvider && event.item.getData() != null) {
- TreePath path = getTreePathFromItem((TreeItem)event.item);
- ((TreeModelContentProvider) contentProvider).cancelRestore(path, IModelDelta.COLLAPSE);
- }
+ super.handleTreeExpand(event);
+ IContentProvider contentProvider = getContentProvider();
+ if (contentProvider instanceof TreeModelContentProvider && event.item.getData() != null) {
+ TreePath path = getTreePathFromItem((TreeItem)event.item);
+ ((TreeModelContentProvider) contentProvider).cancelRestore(path, IModelDelta.COLLAPSE);
+ }
}
@Override
protected void handleTreeCollapse(TreeEvent event) {
- super.handleTreeCollapse(event);
- IContentProvider contentProvider = getContentProvider();
- if (contentProvider instanceof TreeModelContentProvider && event.item.getData() != null) {
- TreePath path = getTreePathFromItem((TreeItem)event.item);
- ((TreeModelContentProvider) contentProvider).cancelRestore(path, IModelDelta.EXPAND);
- }
+ super.handleTreeCollapse(event);
+ IContentProvider contentProvider = getContentProvider();
+ if (contentProvider instanceof TreeModelContentProvider && event.item.getData() != null) {
+ TreePath path = getTreePathFromItem((TreeItem)event.item);
+ ((TreeModelContentProvider) contentProvider).cancelRestore(path, IModelDelta.EXPAND);
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
index fba0d7806..830bdf862 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java
@@ -68,245 +68,245 @@ import org.eclipse.ui.IMemento;
*/
@SuppressWarnings("deprecation")
public class InternalVirtualTreeModelViewer extends Viewer
- implements IVirtualItemListener,
- org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer,
- IInternalTreeModelViewer
+ implements IVirtualItemListener,
+ org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer,
+ IInternalTreeModelViewer
{
- /**
- * Memento type for the visible columns for a presentation context.
- * A memento is created for each column presentation keyed by column number
- */
- private static final String VISIBLE_COLUMNS = "VISIBLE_COLUMNS"; //$NON-NLS-1$
-
- /**
- * Memento type for whether columns are visible for a presentation context.
- * Booleans are keyed by column presentation id
- */
- private static final String SHOW_COLUMNS = "SHOW_COLUMNS"; //$NON-NLS-1$
- /**
- * Memento key for the number of visible columns in a VISIBLE_COLUMNS memento
- * or for the width of a column
- */
- private static final String SIZE = "SIZE"; //$NON-NLS-1$
- /**
- * Memento key prefix a visible column
- */
- private static final String COLUMN = "COLUMN"; //$NON-NLS-1$
-
- /**
- * Item's tree path cache
- */
- private static final String TREE_PATH_KEY = "TREE_PATH_KEY"; //$NON-NLS-1$
-
- /**
- * Viewer filters currently configured for viewer.
- */
- private ViewerFilter[] fFilters = new ViewerFilter[0];
-
- /**
- * The display that this virtual tree viewer is associated with. It is used
- * for access to the UI thread.
- */
- private Display fDisplay;
-
- /**
- * The object that allows the model to identify what this view
- * is presenting.
- */
- private IPresentationContext fContext;
-
- /**
- * Input into the viewer.
- */
- private Object fInput;
-
- /**
- * The tree of items in this viewer.
- */
- private VirtualTree fTree;
-
- /**
- * Mapping of data elements in the tree to the items that hold them. The
- * tree may contain the same element in several places, so the map values
- * are lists.
- */
+ /**
+ * Memento type for the visible columns for a presentation context.
+ * A memento is created for each column presentation keyed by column number
+ */
+ private static final String VISIBLE_COLUMNS = "VISIBLE_COLUMNS"; //$NON-NLS-1$
+
+ /**
+ * Memento type for whether columns are visible for a presentation context.
+ * Booleans are keyed by column presentation id
+ */
+ private static final String SHOW_COLUMNS = "SHOW_COLUMNS"; //$NON-NLS-1$
+ /**
+ * Memento key for the number of visible columns in a VISIBLE_COLUMNS memento
+ * or for the width of a column
+ */
+ private static final String SIZE = "SIZE"; //$NON-NLS-1$
+ /**
+ * Memento key prefix a visible column
+ */
+ private static final String COLUMN = "COLUMN"; //$NON-NLS-1$
+
+ /**
+ * Item's tree path cache
+ */
+ private static final String TREE_PATH_KEY = "TREE_PATH_KEY"; //$NON-NLS-1$
+
+ /**
+ * Viewer filters currently configured for viewer.
+ */
+ private ViewerFilter[] fFilters = new ViewerFilter[0];
+
+ /**
+ * The display that this virtual tree viewer is associated with. It is used
+ * for access to the UI thread.
+ */
+ private Display fDisplay;
+
+ /**
+ * The object that allows the model to identify what this view
+ * is presenting.
+ */
+ private IPresentationContext fContext;
+
+ /**
+ * Input into the viewer.
+ */
+ private Object fInput;
+
+ /**
+ * The tree of items in this viewer.
+ */
+ private VirtualTree fTree;
+
+ /**
+ * Mapping of data elements in the tree to the items that hold them. The
+ * tree may contain the same element in several places, so the map values
+ * are lists.
+ */
private Map<Object, List<VirtualItem>> fItemsMap = new HashMap<>();
- /**
- * Whether to notify the content provider when an element is unmapped.
- * Used to suppress the notification during an associate operation.
- */
- private boolean fNotifyUnmap = true;
-
- /**
- * The label provider, must be the tree model provider.
- */
- private TreeModelLabelProvider fLabelProvider;
-
- /**
- * The content provider must be a tree model provider.
- */
- private TreeModelContentProvider fContentProvider;
-
- /**
- * Flag indicating whether the viewer is currently executing an operation
- * at the end of which the selection will be restored.
- */
- private boolean fPreservingSelecction;
-
- /**
- * Flag indicating that the selection should not be restored at the end
- * of a preserving-selection operation.
- */
- private boolean fRestoreSelection;
-
- /**
- * Level to which the tree should automatically expand elements.
- * <code>-1<code> indicates that all levels shoudl be expanded.
- */
- private int fAutoExpandToLevel = 0;
-
- /**
- * Current column presentation or <code>null</code>
- */
- private IColumnPresentation fColumnPresentation = null;
-
- /**
- * Map of columns presentation id to its visible columns id's (String[])
- * When a columns presentation is not in the map, default settings are used.
- */
+ /**
+ * Whether to notify the content provider when an element is unmapped.
+ * Used to suppress the notification during an associate operation.
+ */
+ private boolean fNotifyUnmap = true;
+
+ /**
+ * The label provider, must be the tree model provider.
+ */
+ private TreeModelLabelProvider fLabelProvider;
+
+ /**
+ * The content provider must be a tree model provider.
+ */
+ private TreeModelContentProvider fContentProvider;
+
+ /**
+ * Flag indicating whether the viewer is currently executing an operation
+ * at the end of which the selection will be restored.
+ */
+ private boolean fPreservingSelecction;
+
+ /**
+ * Flag indicating that the selection should not be restored at the end
+ * of a preserving-selection operation.
+ */
+ private boolean fRestoreSelection;
+
+ /**
+ * Level to which the tree should automatically expand elements.
+ * <code>-1<code> indicates that all levels shoudl be expanded.
+ */
+ private int fAutoExpandToLevel = 0;
+
+ /**
+ * Current column presentation or <code>null</code>
+ */
+ private IColumnPresentation fColumnPresentation = null;
+
+ /**
+ * Map of columns presentation id to its visible columns id's (String[])
+ * When a columns presentation is not in the map, default settings are used.
+ */
private Map<String, String[]> fVisibleColumns = new HashMap<>();
- /**
- * Map of column presentation id to whether columns should be displayed
- * for that presentation (the user can toggle columns on/off when a
- * presentation is optional.
- */
+ /**
+ * Map of column presentation id to whether columns should be displayed
+ * for that presentation (the user can toggle columns on/off when a
+ * presentation is optional.
+ */
private Map<String, Boolean> fShowColumns = new HashMap<>();
- /**
- * Runnable for validating the virtual tree. It is scheduled to run in the
- * UI thread whenever a tree validation is requested.
- */
- private Runnable fValidateRunnable;
+ /**
+ * Runnable for validating the virtual tree. It is scheduled to run in the
+ * UI thread whenever a tree validation is requested.
+ */
+ private Runnable fValidateRunnable;
- public InternalVirtualTreeModelViewer(Display display, int style, IPresentationContext context, IVirtualItemValidator itemValidator) {
- fDisplay = display;
- fContext = context;
- fTree = new VirtualTree(style, itemValidator);
- fTree.addItemListener(this);
+ public InternalVirtualTreeModelViewer(Display display, int style, IPresentationContext context, IVirtualItemValidator itemValidator) {
+ fDisplay = display;
+ fContext = context;
+ fTree = new VirtualTree(style, itemValidator);
+ fTree.addItemListener(this);
- fContentProvider = new TreeModelContentProvider();
- fLabelProvider = new TreeModelLabelProvider(this);
+ fContentProvider = new TreeModelContentProvider();
+ fLabelProvider = new TreeModelLabelProvider(this);
- if ((style & SWT.POP_UP) != 0) {
- getContentProvider().setModelDeltaMask(~ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS);
- }
- }
+ if ((style & SWT.POP_UP) != 0) {
+ getContentProvider().setModelDeltaMask(~ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS);
+ }
+ }
- @Override
+ @Override
public Object getInput() {
- return fInput;
- }
+ return fInput;
+ }
- @Override
+ @Override
public Control getControl() {
- // The virtual viewer does not have an SWT control associated with it.
- // Fortunately this method is not used by the base Viewer class.
- return null;
- }
+ // The virtual viewer does not have an SWT control associated with it.
+ // Fortunately this method is not used by the base Viewer class.
+ return null;
+ }
- @Override
+ @Override
public Display getDisplay() {
- return fDisplay;
- }
+ return fDisplay;
+ }
- @Override
+ @Override
public void setInput(Object input) {
- Object oldInput = fInput;
- getContentProvider().inputChanged(this, oldInput, input);
- fItemsMap.clear();
- fTree.clearAll();
- fInput = input;
- mapElement(fInput, getTree());
- getContentProvider().postInputChanged(this, oldInput , input);
- fTree.setData(fInput);
- fTree.setSelection(EMPTY_ITEMS_ARRAY);
- inputChanged(fInput, oldInput);
- refresh();
- }
-
- @Override
+ Object oldInput = fInput;
+ getContentProvider().inputChanged(this, oldInput, input);
+ fItemsMap.clear();
+ fTree.clearAll();
+ fInput = input;
+ mapElement(fInput, getTree());
+ getContentProvider().postInputChanged(this, oldInput , input);
+ fTree.setData(fInput);
+ fTree.setSelection(EMPTY_ITEMS_ARRAY);
+ inputChanged(fInput, oldInput);
+ refresh();
+ }
+
+ @Override
public void replace(Object parentElementOrTreePath, final int index, Object element) {
- VirtualItem[] selectedItems = fTree.getSelection();
- TreeSelection selection = (TreeSelection) getSelection();
- VirtualItem[] itemsToDisassociate;
- if (parentElementOrTreePath instanceof TreePath) {
- TreePath elementPath = ((TreePath) parentElementOrTreePath).createChildPath(element);
- itemsToDisassociate = findItems(elementPath);
- } else {
- itemsToDisassociate = findItems(element);
- }
-
- VirtualItem[] parentItems = findItems(parentElementOrTreePath);
- for (int i = 0; i < parentItems.length; i++) {
- VirtualItem parentItem = parentItems[i];
- if (index < parentItem.getItemCount()) {
- VirtualItem item = parentItem.getItem(new Index(index));
- selection = adjustSelectionForReplace(selectedItems, selection, item, element, parentItem.getData());
- // disassociate any different item that represents the
- // same element under the same parent (the tree)
- for (int j = 0; j < itemsToDisassociate.length; j++) {
- VirtualItem itemToDisassociate = itemsToDisassociate[j];
- if (itemToDisassociate != item && itemsToDisassociate[j].getParent() == parentItem) {
- disassociate(itemToDisassociate);
- itemToDisassociate.getParent().clear(itemToDisassociate.getIndex());
- }
- }
- //Object oldData = item.getData();
- associate(element, item);
- doUpdate(item);
- VirtualItem[] children = item.getItems();
- for (int j = 0; j < children.length; j++) {
- children[j].setNeedsDataUpdate();
- }
- }
- }
- // Restore the selection if we are not already in a nested
- // preservingSelection:
- if (!fPreservingSelecction) {
- internalSetSelection(selection, false);
- // send out notification if old and new differ
- ISelection newSelection = getSelection();
- if (!newSelection.equals(selection)) {
- handleInvalidSelection(selection, newSelection);
- }
- }
- validate();
- }
-
- public VirtualTree getTree() {
- return fTree;
- }
-
- @Override
+ VirtualItem[] selectedItems = fTree.getSelection();
+ TreeSelection selection = (TreeSelection) getSelection();
+ VirtualItem[] itemsToDisassociate;
+ if (parentElementOrTreePath instanceof TreePath) {
+ TreePath elementPath = ((TreePath) parentElementOrTreePath).createChildPath(element);
+ itemsToDisassociate = findItems(elementPath);
+ } else {
+ itemsToDisassociate = findItems(element);
+ }
+
+ VirtualItem[] parentItems = findItems(parentElementOrTreePath);
+ for (int i = 0; i < parentItems.length; i++) {
+ VirtualItem parentItem = parentItems[i];
+ if (index < parentItem.getItemCount()) {
+ VirtualItem item = parentItem.getItem(new Index(index));
+ selection = adjustSelectionForReplace(selectedItems, selection, item, element, parentItem.getData());
+ // disassociate any different item that represents the
+ // same element under the same parent (the tree)
+ for (int j = 0; j < itemsToDisassociate.length; j++) {
+ VirtualItem itemToDisassociate = itemsToDisassociate[j];
+ if (itemToDisassociate != item && itemsToDisassociate[j].getParent() == parentItem) {
+ disassociate(itemToDisassociate);
+ itemToDisassociate.getParent().clear(itemToDisassociate.getIndex());
+ }
+ }
+ //Object oldData = item.getData();
+ associate(element, item);
+ doUpdate(item);
+ VirtualItem[] children = item.getItems();
+ for (int j = 0; j < children.length; j++) {
+ children[j].setNeedsDataUpdate();
+ }
+ }
+ }
+ // Restore the selection if we are not already in a nested
+ // preservingSelection:
+ if (!fPreservingSelecction) {
+ internalSetSelection(selection, false);
+ // send out notification if old and new differ
+ ISelection newSelection = getSelection();
+ if (!newSelection.equals(selection)) {
+ handleInvalidSelection(selection, newSelection);
+ }
+ }
+ validate();
+ }
+
+ public VirtualTree getTree() {
+ return fTree;
+ }
+
+ @Override
public void insert(Object parentOrTreePath, Object element, int position) {
- if (parentOrTreePath instanceof TreePath) {
- VirtualItem parentItem = findItem((TreePath) parentOrTreePath);
- if (parentItem != null) {
- VirtualItem item = parentItem.addItem(position);
- item.setData(element);
- mapElement(element, item);
- doUpdate(item);
- }
- } else {
- // TODO: Implement insert() for element
- }
- validate();
- }
-
- @Override
+ if (parentOrTreePath instanceof TreePath) {
+ VirtualItem parentItem = findItem((TreePath) parentOrTreePath);
+ if (parentItem != null) {
+ VirtualItem item = parentItem.addItem(position);
+ item.setData(element);
+ mapElement(element, item);
+ doUpdate(item);
+ }
+ } else {
+ // TODO: Implement insert() for element
+ }
+ validate();
+ }
+
+ @Override
public void remove(final Object parentOrTreePath, final int index) {
final List<TreePath> oldSelection = new LinkedList<>(Arrays.asList(((TreeSelection) getSelection()).getPaths()));
preservingSelection(() -> {
@@ -351,50 +351,50 @@ public class InternalVirtualTreeModelViewer extends Viewer
}
}
});
- }
+ }
- @Override
+ @Override
public void remove(Object elementOrPath) {
- if (elementOrPath.equals(getInput()) || TreePath.EMPTY.equals(elementOrPath)) {
- setInput(null);
- return;
- }
-
- VirtualItem[] items = findItems(elementOrPath);
- if (items.length > 0) {
- for (int j = 0; j < items.length; j++) {
- disassociate(items[j]);
- items[j].getParent().remove(items[j].getIndex());
- }
- }
- }
-
- private TreeSelection adjustSelectionForReplace(VirtualItem[] selectedItems, TreeSelection selection,
- VirtualItem item, Object element, Object parentElement)
- {
- if (item.getData() != null || selectedItems.length == selection.size() || parentElement == null) {
- // Don't do anything - we are not seeing an instance of bug 185673
- return selection;
- }
- for (int i = 0; i < selectedItems.length; i++) {
- if (item == selectedItems[i]) {
- // The current item was selected, but its data is null.
- // The data will be replaced by the given element, so to keep
- // it selected, we have to add it to the selection.
- TreePath[] originalPaths = selection.getPaths();
- int length = originalPaths.length;
- TreePath[] paths = new TreePath[length + 1];
- System.arraycopy(originalPaths, 0, paths, 0, length);
- // set the element temporarily so that we can call getTreePathFromItem
- item.setData(element);
- paths[length] = getTreePathFromItem(item);
- item.setData(null);
- return new TreeSelection(paths, selection.getElementComparer());
- }
- }
- // The item was not selected, return the given selection
- return selection;
- }
+ if (elementOrPath.equals(getInput()) || TreePath.EMPTY.equals(elementOrPath)) {
+ setInput(null);
+ return;
+ }
+
+ VirtualItem[] items = findItems(elementOrPath);
+ if (items.length > 0) {
+ for (int j = 0; j < items.length; j++) {
+ disassociate(items[j]);
+ items[j].getParent().remove(items[j].getIndex());
+ }
+ }
+ }
+
+ private TreeSelection adjustSelectionForReplace(VirtualItem[] selectedItems, TreeSelection selection,
+ VirtualItem item, Object element, Object parentElement)
+ {
+ if (item.getData() != null || selectedItems.length == selection.size() || parentElement == null) {
+ // Don't do anything - we are not seeing an instance of bug 185673
+ return selection;
+ }
+ for (int i = 0; i < selectedItems.length; i++) {
+ if (item == selectedItems[i]) {
+ // The current item was selected, but its data is null.
+ // The data will be replaced by the given element, so to keep
+ // it selected, we have to add it to the selection.
+ TreePath[] originalPaths = selection.getPaths();
+ int length = originalPaths.length;
+ TreePath[] paths = new TreePath[length + 1];
+ System.arraycopy(originalPaths, 0, paths, 0, length);
+ // set the element temporarily so that we can call getTreePathFromItem
+ item.setData(element);
+ paths[length] = getTreePathFromItem(item);
+ item.setData(null);
+ return new TreeSelection(paths, selection.getElementComparer());
+ }
+ }
+ // The item was not selected, return the given selection
+ return selection;
+ }
// private VirtualTreeSelection adjustSelectionForReplace(VirtualTreeSelection selection, VirtualItem item,
// Object element, Object parentElement)
@@ -449,181 +449,181 @@ public class InternalVirtualTreeModelViewer extends Viewer
// }
- @Override
+ @Override
public void reveal(TreePath path, final int index) {
- VirtualItem parentItem = findItem(path);
- if (parentItem != null && parentItem.getItemCount() >= index) {
- VirtualItem revealItem = parentItem.getItem(new Index(index));
- getTree().showItem(revealItem);
- getTree().validate();
- }
- // TODO: implement reveal()
- }
-
- @Override
+ VirtualItem parentItem = findItem(path);
+ if (parentItem != null && parentItem.getItemCount() >= index) {
+ VirtualItem revealItem = parentItem.getItem(new Index(index));
+ getTree().showItem(revealItem);
+ getTree().validate();
+ }
+ // TODO: implement reveal()
+ }
+
+ @Override
public int findElementIndex(TreePath parentPath, Object element) {
- VirtualItem parentItem = findItem(parentPath);
- if (parentItem != null) {
- VirtualItem item = parentItem.findItem(element);
- if (item != null) {
- return item.getIndex().intValue();
- }
- }
- return -1;
- }
-
- @Override
+ VirtualItem parentItem = findItem(parentPath);
+ if (parentItem != null) {
+ VirtualItem item = parentItem.findItem(element);
+ if (item != null) {
+ return item.getIndex().intValue();
+ }
+ }
+ return -1;
+ }
+
+ @Override
public boolean getElementChildrenRealized(TreePath parentPath) {
- VirtualItem parentItem = findItem(parentPath);
- if (parentItem != null) {
- return !parentItem.childrenNeedDataUpdate();
- }
- return true;
- }
+ VirtualItem parentItem = findItem(parentPath);
+ if (parentItem != null) {
+ return !parentItem.childrenNeedDataUpdate();
+ }
+ return true;
+ }
- private ITreeModelLabelProvider getLabelProvider() {
- return fLabelProvider;
- }
+ private ITreeModelLabelProvider getLabelProvider() {
+ return fLabelProvider;
+ }
- private ITreeModelContentProvider getContentProvider() {
- return fContentProvider;
- }
+ private ITreeModelContentProvider getContentProvider() {
+ return fContentProvider;
+ }
- public static int ALL_LEVELS = -1;
+ public static int ALL_LEVELS = -1;
- @Override
+ @Override
public void refresh() {
- refresh(fTree);
- validate();
- }
+ refresh(fTree);
+ validate();
+ }
- @Override
+ @Override
public void refresh(Object element) {
- VirtualItem[] items = findItems(element);
- for (int i = 0; i < items.length; i++) {
- refresh(items[i]);
- validate();
- }
- }
-
- private void refresh(VirtualItem item) {
- getContentProvider().preserveState(getTreePathFromItem(item));
-
- if (!item.needsDataUpdate()) {
- if (item.getParent() != null) {
- item.setNeedsLabelUpdate();
- virtualLazyUpdateHasChildren(item);
- }
-
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].setNeedsDataUpdate();
- }
- }
- refreshStruct(item);
- }
-
- private void refreshStruct(VirtualItem item) {
- boolean expanded = false;
- if (item.getParent() == null) {
- // root item
- virtualLazyUpdateChildCount(item);
- expanded = true;
- } else {
- if (item.getExpanded()) {
- virtualLazyUpdateData(item);
- expanded = true;
- }
- }
-
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- if (expanded) {
- refreshStruct(items[i]);
- } else {
- item.clear(new VirtualItem.Index(i));
- }
- }
- }
-
- private void validate() {
- if (fValidateRunnable == null) {
+ VirtualItem[] items = findItems(element);
+ for (int i = 0; i < items.length; i++) {
+ refresh(items[i]);
+ validate();
+ }
+ }
+
+ private void refresh(VirtualItem item) {
+ getContentProvider().preserveState(getTreePathFromItem(item));
+
+ if (!item.needsDataUpdate()) {
+ if (item.getParent() != null) {
+ item.setNeedsLabelUpdate();
+ virtualLazyUpdateHasChildren(item);
+ }
+
+ VirtualItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ items[i].setNeedsDataUpdate();
+ }
+ }
+ refreshStruct(item);
+ }
+
+ private void refreshStruct(VirtualItem item) {
+ boolean expanded = false;
+ if (item.getParent() == null) {
+ // root item
+ virtualLazyUpdateChildCount(item);
+ expanded = true;
+ } else {
+ if (item.getExpanded()) {
+ virtualLazyUpdateData(item);
+ expanded = true;
+ }
+ }
+
+ VirtualItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ if (expanded) {
+ refreshStruct(items[i]);
+ } else {
+ item.clear(new VirtualItem.Index(i));
+ }
+ }
+ }
+
+ private void validate() {
+ if (fValidateRunnable == null) {
fValidateRunnable = () -> {
if (!fTree.isDisposed()) {
fValidateRunnable = null;
fTree.validate();
}
};
- getDisplay().asyncExec(fValidateRunnable);
- }
- }
+ getDisplay().asyncExec(fValidateRunnable);
+ }
+ }
- @Override
+ @Override
protected void inputChanged(Object input, Object oldInput) {
- resetColumns(input);
- }
+ resetColumns(input);
+ }
- @Override
+ @Override
public int getAutoExpandLevel() {
- return fAutoExpandToLevel;
- }
+ return fAutoExpandToLevel;
+ }
- @Override
+ @Override
public void setAutoExpandLevel(int level) {
- fAutoExpandToLevel = level;
- }
+ fAutoExpandToLevel = level;
+ }
- public VirtualItem findItem(TreePath path) {
- if (path.getSegmentCount() == 0) {
- return fTree;
- }
+ public VirtualItem findItem(TreePath path) {
+ if (path.getSegmentCount() == 0) {
+ return fTree;
+ }
List<VirtualItem> itemsList = fItemsMap.get(path.getLastSegment());
- if (itemsList != null) {
+ if (itemsList != null) {
for (VirtualItem item : itemsList) {
if (path.equals(getTreePathFromItem(item))) {
return item;
- }
- }
- }
-
- return null;
- }
-
- static private final VirtualItem[] EMPTY_ITEMS_ARRAY = new VirtualItem[0];
-
- public VirtualItem[] findItems(Object elementOrTreePath) {
- Object element = elementOrTreePath;
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.getSegmentCount() == 0) {
- return new VirtualItem[] { getTree() };
- }
- element = path.getLastSegment();
- }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ static private final VirtualItem[] EMPTY_ITEMS_ARRAY = new VirtualItem[0];
+
+ public VirtualItem[] findItems(Object elementOrTreePath) {
+ Object element = elementOrTreePath;
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.getSegmentCount() == 0) {
+ return new VirtualItem[] { getTree() };
+ }
+ element = path.getLastSegment();
+ }
List<VirtualItem> itemsList = fItemsMap.get(element);
- if (itemsList == null) {
- return EMPTY_ITEMS_ARRAY;
- } else {
- return itemsList.toArray(new VirtualItem[itemsList.size()]);
- }
- }
-
- @Override
+ if (itemsList == null) {
+ return EMPTY_ITEMS_ARRAY;
+ } else {
+ return itemsList.toArray(new VirtualItem[itemsList.size()]);
+ }
+ }
+
+ @Override
public void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
- FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds) {
- VirtualItem item = findItem(path);
- if (item != null) {
- item.setData(VirtualItem.LABEL_KEY, labels);
- item.setData(VirtualItem.IMAGE_KEY, images);
- item.setData(VirtualItem.FOREGROUND_KEY, foregrounds);
- item.setData(VirtualItem.BACKGROUND_KEY, backgrounds);
- item.setData(VirtualItem.FONT_KEY, fontDatas);
- }
- }
-
- @Override
+ FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds) {
+ VirtualItem item = findItem(path);
+ if (item != null) {
+ item.setData(VirtualItem.LABEL_KEY, labels);
+ item.setData(VirtualItem.IMAGE_KEY, images);
+ item.setData(VirtualItem.FOREGROUND_KEY, foregrounds);
+ item.setData(VirtualItem.BACKGROUND_KEY, backgrounds);
+ item.setData(VirtualItem.FONT_KEY, fontDatas);
+ }
+ }
+
+ @Override
public void setChildCount(final Object elementOrTreePath, final int count) {
preservingSelection(() -> {
VirtualItem[] items = findItems(elementOrTreePath);
@@ -638,10 +638,10 @@ public class InternalVirtualTreeModelViewer extends Viewer
items[i].setItemCount(count);
}
});
- validate();
- }
+ validate();
+ }
- @Override
+ @Override
public void setHasChildren(final Object elementOrTreePath, final boolean hasChildren) {
preservingSelection(() -> {
VirtualItem[] items = findItems(elementOrTreePath);
@@ -667,962 +667,962 @@ public class InternalVirtualTreeModelViewer extends Viewer
}
}
});
- }
+ }
- @Override
+ @Override
public boolean getHasChildren(Object elementOrTreePath) {
- VirtualItem[] items = findItems(elementOrTreePath);
- if (items.length > 0) {
- return items[0].hasItems();
- }
- return false;
- }
-
- private void virtualLazyUpdateHasChildren(VirtualItem item) {
- TreePath treePath;
- treePath = getTreePathFromItem(item);
- item.clearNeedsCountUpdate();
- getContentProvider().updateHasChildren(treePath);
- }
-
- private void virtualLazyUpdateChildCount(VirtualItem item) {
- item.clearNeedsCountUpdate();
- getContentProvider().updateChildCount(getTreePathFromItem(item), item.getItemCount());
- }
-
- private void virtualLazyUpdateData(VirtualItem item) {
- item.clearNeedsDataUpdate();
- getContentProvider().updateElement(getTreePathFromItem(item.getParent()), item.getIndex().intValue());
- }
-
- private void virtualLazyUpdateLabel(VirtualItem item) {
- item.clearNeedsLabelUpdate();
- if ( !getLabelProvider().update(getTreePathFromItem(item)) ) {
- if (item.getData() instanceof String) {
- item.setData(VirtualItem.LABEL_KEY, new String[] { (String)item.getData() } );
- }
- }
- }
-
- private TreePath getTreePathFromItem(VirtualItem item) {
+ VirtualItem[] items = findItems(elementOrTreePath);
+ if (items.length > 0) {
+ return items[0].hasItems();
+ }
+ return false;
+ }
+
+ private void virtualLazyUpdateHasChildren(VirtualItem item) {
+ TreePath treePath;
+ treePath = getTreePathFromItem(item);
+ item.clearNeedsCountUpdate();
+ getContentProvider().updateHasChildren(treePath);
+ }
+
+ private void virtualLazyUpdateChildCount(VirtualItem item) {
+ item.clearNeedsCountUpdate();
+ getContentProvider().updateChildCount(getTreePathFromItem(item), item.getItemCount());
+ }
+
+ private void virtualLazyUpdateData(VirtualItem item) {
+ item.clearNeedsDataUpdate();
+ getContentProvider().updateElement(getTreePathFromItem(item.getParent()), item.getIndex().intValue());
+ }
+
+ private void virtualLazyUpdateLabel(VirtualItem item) {
+ item.clearNeedsLabelUpdate();
+ if ( !getLabelProvider().update(getTreePathFromItem(item)) ) {
+ if (item.getData() instanceof String) {
+ item.setData(VirtualItem.LABEL_KEY, new String[] { (String)item.getData() } );
+ }
+ }
+ }
+
+ private TreePath getTreePathFromItem(VirtualItem item) {
List<Object> segments = new LinkedList<>();
- while (item.getParent() != null) {
- segments.add(0, item.getData());
- item = item.getParent();
- }
- return new TreePath(segments.toArray());
- }
-
- private void unmapElement(Object element, VirtualItem item) {
- if (fNotifyUnmap) {
- // TODO: should we update the filter with the "new non-identical element"?
- IContentProvider provider = getContentProvider();
- if (provider instanceof TreeModelContentProvider) {
- ((TreeModelContentProvider) provider).unmapPath((TreePath) item.getData(TREE_PATH_KEY));
- }
- }
+ while (item.getParent() != null) {
+ segments.add(0, item.getData());
+ item = item.getParent();
+ }
+ return new TreePath(segments.toArray());
+ }
+
+ private void unmapElement(Object element, VirtualItem item) {
+ if (fNotifyUnmap) {
+ // TODO: should we update the filter with the "new non-identical element"?
+ IContentProvider provider = getContentProvider();
+ if (provider instanceof TreeModelContentProvider) {
+ ((TreeModelContentProvider) provider).unmapPath((TreePath) item.getData(TREE_PATH_KEY));
+ }
+ }
List<VirtualItem> itemsList = fItemsMap.get(element);
- if (itemsList != null) {
- itemsList.remove(item);
- if (itemsList.isEmpty()) {
- fItemsMap.remove(element);
- }
- }
- }
-
- private void mapElement(Object element, VirtualItem item) {
- // Get the items set for given element, if it doesn't exist, create it.
- // When retrieving the set, also remove it from the map, it will be
- // re-inserted to make sure that the new instance of element is used
- // in case the element has changed but the elment is equal to the old
- // one.
+ if (itemsList != null) {
+ itemsList.remove(item);
+ if (itemsList.isEmpty()) {
+ fItemsMap.remove(element);
+ }
+ }
+ }
+
+ private void mapElement(Object element, VirtualItem item) {
+ // Get the items set for given element, if it doesn't exist, create it.
+ // When retrieving the set, also remove it from the map, it will be
+ // re-inserted to make sure that the new instance of element is used
+ // in case the element has changed but the elment is equal to the old
+ // one.
List<VirtualItem> itemsList = fItemsMap.remove(element);
- if (itemsList == null) {
+ if (itemsList == null) {
itemsList = new ArrayList<>(1);
- }
+ }
- if (!itemsList.contains(item)) {
- itemsList.add(item);
- }
+ if (!itemsList.contains(item)) {
+ itemsList.add(item);
+ }
- // Insert the set back into the map.
- fItemsMap.put(element, itemsList);
+ // Insert the set back into the map.
+ fItemsMap.put(element, itemsList);
- item.setData(TREE_PATH_KEY, getTreePathFromItem(item));
- }
+ item.setData(TREE_PATH_KEY, getTreePathFromItem(item));
+ }
- @Override
+ @Override
public void revealed(VirtualItem item) {
- if (item.needsDataUpdate()) {
- virtualLazyUpdateData(item);
- } else if (item.getData() != null) {
- if (item.needsLabelUpdate()) {
- virtualLazyUpdateLabel(item);
- }
- if (item.needsCountUpdate() && item.getExpanded()) {
- virtualLazyUpdateChildCount(item);
- }
- }
- }
-
- @Override
+ if (item.needsDataUpdate()) {
+ virtualLazyUpdateData(item);
+ } else if (item.getData() != null) {
+ if (item.needsLabelUpdate()) {
+ virtualLazyUpdateLabel(item);
+ }
+ if (item.needsCountUpdate() && item.getExpanded()) {
+ virtualLazyUpdateChildCount(item);
+ }
+ }
+ }
+
+ @Override
public void disposed(VirtualItem item) {
- if (!fTree.isDisposed()) {
- Object data = item.getData();
- if (data != null) {
- unmapElement(data, item);
- }
- }
- }
-
- private void associate(Object element, VirtualItem item) {
- Object data = item.getData();
- if (data != null && data != element && data.equals(element)) {
- // elements are equal but not identical
- // -> being removed from map, but should not change filters
- try {
- fNotifyUnmap = false;
- doAssociate(element, item);
- } finally {
- fNotifyUnmap = true;
- }
- } else {
- doAssociate(element, item);
- }
-
- }
-
- private void doAssociate(Object element, VirtualItem item) {
- Object data = item.getData();
- if (data != null && data != element && data.equals(element)) {
- // workaround for PR 1FV62BT
- // assumption: elements are equal but not identical
- // -> remove from map but don't touch children
- unmapElement(data, item);
- item.setData(element);
- mapElement(element, item);
- } else {
- // recursively disassociate all
- if (data != element) {
- if (data != null) {
- unmapElement(element, item);
- disassociate(item);
- }
- item.setData(element);
- }
- // Always map the element, even if data == element,
- // since unmapAllElements() can leave the map inconsistent
- // See bug 2741 for details.
- mapElement(element, item);
- }
- }
-
- private void disassociate(VirtualItem item) {
- unmapElement(item.getData(), item);
-
- // Clear the map before we clear the data
- item.setData(null);
-
- // Disassociate the children
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null) {
- disassociate(items[i]);
- }
- }
- }
-
- @Override
+ if (!fTree.isDisposed()) {
+ Object data = item.getData();
+ if (data != null) {
+ unmapElement(data, item);
+ }
+ }
+ }
+
+ private void associate(Object element, VirtualItem item) {
+ Object data = item.getData();
+ if (data != null && data != element && data.equals(element)) {
+ // elements are equal but not identical
+ // -> being removed from map, but should not change filters
+ try {
+ fNotifyUnmap = false;
+ doAssociate(element, item);
+ } finally {
+ fNotifyUnmap = true;
+ }
+ } else {
+ doAssociate(element, item);
+ }
+
+ }
+
+ private void doAssociate(Object element, VirtualItem item) {
+ Object data = item.getData();
+ if (data != null && data != element && data.equals(element)) {
+ // workaround for PR 1FV62BT
+ // assumption: elements are equal but not identical
+ // -> remove from map but don't touch children
+ unmapElement(data, item);
+ item.setData(element);
+ mapElement(element, item);
+ } else {
+ // recursively disassociate all
+ if (data != element) {
+ if (data != null) {
+ unmapElement(element, item);
+ disassociate(item);
+ }
+ item.setData(element);
+ }
+ // Always map the element, even if data == element,
+ // since unmapAllElements() can leave the map inconsistent
+ // See bug 2741 for details.
+ mapElement(element, item);
+ }
+ }
+
+ private void disassociate(VirtualItem item) {
+ unmapElement(item.getData(), item);
+
+ // Clear the map before we clear the data
+ item.setData(null);
+
+ // Disassociate the children
+ VirtualItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ if (items[i].getData() != null) {
+ disassociate(items[i]);
+ }
+ }
+ }
+
+ @Override
public void setSelection(ISelection selection, boolean reveal) {
- setSelection(selection, reveal, false);
- }
+ setSelection(selection, reveal, false);
+ }
- @Override
+ @Override
public void setSelection(ISelection selection, boolean reveal, boolean force) {
- trySelection(selection, reveal, force);
- }
+ trySelection(selection, reveal, force);
+ }
- @Override
+ @Override
public boolean trySelection(ISelection selection, boolean reveal, boolean force) {
- if (!force && !overrideSelection(getSelection(), selection)) {
- return false;
- }
-
- if (!fPreservingSelecction) {
- internalSetSelection(selection, reveal);
- fireSelectionChanged(new SelectionChangedEvent(this, selection));
- } else {
- fRestoreSelection = false;
- internalSetSelection(selection, reveal);
- }
- return true;
- }
-
- private void internalSetSelection(ISelection selection, boolean reveal) {
- if (selection instanceof ITreeSelection) {
- TreePath[] paths = ((ITreeSelection) selection).getPaths();
+ if (!force && !overrideSelection(getSelection(), selection)) {
+ return false;
+ }
+
+ if (!fPreservingSelecction) {
+ internalSetSelection(selection, reveal);
+ fireSelectionChanged(new SelectionChangedEvent(this, selection));
+ } else {
+ fRestoreSelection = false;
+ internalSetSelection(selection, reveal);
+ }
+ return true;
+ }
+
+ private void internalSetSelection(ISelection selection, boolean reveal) {
+ if (selection instanceof ITreeSelection) {
+ TreePath[] paths = ((ITreeSelection) selection).getPaths();
List<VirtualItem> newSelection = new ArrayList<>(paths.length);
- for (int i = 0; i < paths.length; ++i) {
- // Use internalExpand since item may not yet be created. See
- // 1G6B1AR.
- VirtualItem item = findItem(paths[i]);
- if (item != null) {
- newSelection.add(item);
- }
- }
- fTree.setSelection(newSelection.toArray(new VirtualItem[newSelection.size()]));
-
- // Although setting the selection in the control should reveal it,
- // setSelection may be a no-op if the selection is unchanged,
- // so explicitly reveal items in the selection here.
- // See bug 100565 for more details.
- if (reveal && newSelection.size() > 0) {
- // Iterate backwards so the first item in the list
- // is the one guaranteed to be visible
- for (int i = (newSelection.size() - 1); i >= 0; i--) {
- fTree.showItem(newSelection.get(i));
- }
- }
- } else {
- fTree.setSelection(EMPTY_ITEMS_ARRAY);
- }
-
- // Make sure that the new selection is properly revealed.
- validate();
- }
-
- @Override
+ for (int i = 0; i < paths.length; ++i) {
+ // Use internalExpand since item may not yet be created. See
+ // 1G6B1AR.
+ VirtualItem item = findItem(paths[i]);
+ if (item != null) {
+ newSelection.add(item);
+ }
+ }
+ fTree.setSelection(newSelection.toArray(new VirtualItem[newSelection.size()]));
+
+ // Although setting the selection in the control should reveal it,
+ // setSelection may be a no-op if the selection is unchanged,
+ // so explicitly reveal items in the selection here.
+ // See bug 100565 for more details.
+ if (reveal && newSelection.size() > 0) {
+ // Iterate backwards so the first item in the list
+ // is the one guaranteed to be visible
+ for (int i = (newSelection.size() - 1); i >= 0; i--) {
+ fTree.showItem(newSelection.get(i));
+ }
+ }
+ } else {
+ fTree.setSelection(EMPTY_ITEMS_ARRAY);
+ }
+
+ // Make sure that the new selection is properly revealed.
+ validate();
+ }
+
+ @Override
public void update(Object element) {
- VirtualItem[] items = findItems(element);
- for (int i = 0; i < items.length; i++) {
- doUpdate(items[i]);
- }
- }
-
- public void doUpdate(VirtualItem item) {
- item.setNeedsLabelUpdate();
- validate();
- }
-
- @Override
+ VirtualItem[] items = findItems(element);
+ for (int i = 0; i < items.length; i++) {
+ doUpdate(items[i]);
+ }
+ }
+
+ public void doUpdate(VirtualItem item) {
+ item.setNeedsLabelUpdate();
+ validate();
+ }
+
+ @Override
public ISelection getSelection() {
- if (fTree.isDisposed()) {
- return TreeSelection.EMPTY;
- }
- VirtualItem[] items = fTree.getSelection();
+ if (fTree.isDisposed()) {
+ return TreeSelection.EMPTY;
+ }
+ VirtualItem[] items = fTree.getSelection();
ArrayList<TreePath> list = new ArrayList<>(items.length);
Map<VirtualItem, TreePath> map = new LinkedHashMap<>(items.length * 4 / 3);
- for (int i = 0; i < items.length; i++) {
- TreePath path = null;
- if (items[i].getData() != null) {
- path = getTreePathFromItem(items[i]);
- list.add(path);
- }
- map.put(items[i], path);
- }
- return new TreeSelection(list.toArray(new TreePath[list.size()]));
- }
-
- private void preservingSelection(Runnable updateCode) {
-
- ISelection oldSelection = null;
- try {
- // preserve selection
- oldSelection = getSelection();
- fPreservingSelecction = fRestoreSelection = true;
-
- // perform the update
- updateCode.run();
-
- } finally {
- fPreservingSelecction = false;
-
- // restore selection
- if (fRestoreSelection) {
- internalSetSelection(oldSelection, false);
- }
-
- // send out notification if old and new differ
- ISelection newSelection = getSelection();
- if (!newSelection.equals(oldSelection)) {
- handleInvalidSelection(oldSelection, newSelection);
- }
- }
- }
-
- @Override
+ for (int i = 0; i < items.length; i++) {
+ TreePath path = null;
+ if (items[i].getData() != null) {
+ path = getTreePathFromItem(items[i]);
+ list.add(path);
+ }
+ map.put(items[i], path);
+ }
+ return new TreeSelection(list.toArray(new TreePath[list.size()]));
+ }
+
+ private void preservingSelection(Runnable updateCode) {
+
+ ISelection oldSelection = null;
+ try {
+ // preserve selection
+ oldSelection = getSelection();
+ fPreservingSelecction = fRestoreSelection = true;
+
+ // perform the update
+ updateCode.run();
+
+ } finally {
+ fPreservingSelecction = false;
+
+ // restore selection
+ if (fRestoreSelection) {
+ internalSetSelection(oldSelection, false);
+ }
+
+ // send out notification if old and new differ
+ ISelection newSelection = getSelection();
+ if (!newSelection.equals(oldSelection)) {
+ handleInvalidSelection(oldSelection, newSelection);
+ }
+ }
+ }
+
+ @Override
public void expandToLevel(Object elementOrTreePath, int level) {
- VirtualItem[] items = findItems(elementOrTreePath);
- if (items.length > 0) {
- expandToLevel(items[0], level);
- }
- validate();
- }
-
- @Override
+ VirtualItem[] items = findItems(elementOrTreePath);
+ if (items.length > 0) {
+ expandToLevel(items[0], level);
+ }
+ validate();
+ }
+
+ @Override
public void setExpandedState(Object elementOrTreePath, boolean expanded) {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- items[i].setExpanded(expanded);
- }
- validate();
- }
-
- @Override
+ VirtualItem[] items = findItems(elementOrTreePath);
+ for (int i = 0; i < items.length; i++) {
+ items[i].setExpanded(expanded);
+ }
+ validate();
+ }
+
+ @Override
public boolean getExpandedState(Object elementOrTreePath) {
- VirtualItem[] items = findItems(elementOrTreePath);
- if (items.length > 0) {
- return items[0].getExpanded();
- }
- return false;
- }
-
- private void expandToLevel(VirtualItem item, int level) {
- if (level == ALL_LEVELS || level > 0) {
- if (!item.hasItems()) {
- return;
- }
-
- item.setExpanded(true);
-
- if (item.getData() == null) {
- virtualLazyUpdateData(item);
- // Cannot expand children if data is null.
- return;
- }
-
- if (level == ALL_LEVELS || level > 1) {
- VirtualItem[] children = item.getItems();
- int newLevel = (level == ALL_LEVELS ? ALL_LEVELS
- : level - 1);
- for (int i = 0; i < children.length; i++) {
- expandToLevel(children[i], newLevel);
- }
- }
- }
- }
-
- private void handleInvalidSelection(ISelection selection, ISelection newSelection) {
- IModelSelectionPolicy selectionPolicy = ViewerAdapterService.getSelectionPolicy(selection, getPresentationContext());
- if (selectionPolicy != null) {
- while (!selection.equals(newSelection)) {
- ISelection temp = newSelection;
- selection = selectionPolicy.replaceInvalidSelection(selection, newSelection);
- if (selection == null) {
- selection = TreeSelection.EMPTY;
- }
- if (!temp.equals(selection)) {
- internalSetSelection(selection, false);
- newSelection = getSelection();
- } else {
- break;
- }
- }
- }
-
- fireSelectionChanged(new SelectionChangedEvent(this, newSelection));
- }
-
- /**
- * Returns whether the candidate selection should override the current
- * selection.
- *
- * @param current Current selection in viewer
- * @param candidate New potential selection requested by model.
- * @return true if candidate selection should be set to viewer.
- */
- @Override
+ VirtualItem[] items = findItems(elementOrTreePath);
+ if (items.length > 0) {
+ return items[0].getExpanded();
+ }
+ return false;
+ }
+
+ private void expandToLevel(VirtualItem item, int level) {
+ if (level == ALL_LEVELS || level > 0) {
+ if (!item.hasItems()) {
+ return;
+ }
+
+ item.setExpanded(true);
+
+ if (item.getData() == null) {
+ virtualLazyUpdateData(item);
+ // Cannot expand children if data is null.
+ return;
+ }
+
+ if (level == ALL_LEVELS || level > 1) {
+ VirtualItem[] children = item.getItems();
+ int newLevel = (level == ALL_LEVELS ? ALL_LEVELS
+ : level - 1);
+ for (int i = 0; i < children.length; i++) {
+ expandToLevel(children[i], newLevel);
+ }
+ }
+ }
+ }
+
+ private void handleInvalidSelection(ISelection selection, ISelection newSelection) {
+ IModelSelectionPolicy selectionPolicy = ViewerAdapterService.getSelectionPolicy(selection, getPresentationContext());
+ if (selectionPolicy != null) {
+ while (!selection.equals(newSelection)) {
+ ISelection temp = newSelection;
+ selection = selectionPolicy.replaceInvalidSelection(selection, newSelection);
+ if (selection == null) {
+ selection = TreeSelection.EMPTY;
+ }
+ if (!temp.equals(selection)) {
+ internalSetSelection(selection, false);
+ newSelection = getSelection();
+ } else {
+ break;
+ }
+ }
+ }
+
+ fireSelectionChanged(new SelectionChangedEvent(this, newSelection));
+ }
+
+ /**
+ * Returns whether the candidate selection should override the current
+ * selection.
+ *
+ * @param current Current selection in viewer
+ * @param candidate New potential selection requested by model.
+ * @return true if candidate selection should be set to viewer.
+ */
+ @Override
public boolean overrideSelection(ISelection current, ISelection candidate) {
- IModelSelectionPolicy selectionPolicy = ViewerAdapterService.getSelectionPolicy(current, getPresentationContext());
- if (selectionPolicy == null) {
- return true;
- }
- if (selectionPolicy.contains(candidate, getPresentationContext())) {
- return selectionPolicy.overrides(current, candidate, getPresentationContext());
- }
- return !selectionPolicy.isSticky(current, getPresentationContext());
- }
-
- @Override
+ IModelSelectionPolicy selectionPolicy = ViewerAdapterService.getSelectionPolicy(current, getPresentationContext());
+ if (selectionPolicy == null) {
+ return true;
+ }
+ if (selectionPolicy.contains(candidate, getPresentationContext())) {
+ return selectionPolicy.overrides(current, candidate, getPresentationContext());
+ }
+ return !selectionPolicy.isSticky(current, getPresentationContext());
+ }
+
+ @Override
public ViewerFilter[] getFilters() {
- return fFilters;
- }
+ return fFilters;
+ }
- @Override
+ @Override
public void addFilter(ViewerFilter filter) {
- ViewerFilter[] newFilters = new ViewerFilter[fFilters.length + 1];
- System.arraycopy(fFilters, 0, newFilters, 0, fFilters.length);
- newFilters[fFilters.length] = filter;
- fFilters = newFilters;
- }
+ ViewerFilter[] newFilters = new ViewerFilter[fFilters.length + 1];
+ System.arraycopy(fFilters, 0, newFilters, 0, fFilters.length);
+ newFilters[fFilters.length] = filter;
+ fFilters = newFilters;
+ }
- @Override
+ @Override
public void setFilters(ViewerFilter... filters) {
- fFilters = filters;
- }
-
- public void dispose() {
- if (fColumnPresentation != null) {
- fColumnPresentation.dispose();
- }
-
- if (fContentProvider != null) {
- fContentProvider.dispose();
- fContentProvider = null;
- }
- if (fLabelProvider != null) {
- fLabelProvider.dispose();
- fLabelProvider = null;
- }
-
- fTree.removeItemListener(this);
- fTree.dispose();
- }
-
- /**
- * Returns this viewer's presentation context.
- *
- * @return presentation context
- */
- @Override
+ fFilters = filters;
+ }
+
+ public void dispose() {
+ if (fColumnPresentation != null) {
+ fColumnPresentation.dispose();
+ }
+
+ if (fContentProvider != null) {
+ fContentProvider.dispose();
+ fContentProvider = null;
+ }
+ if (fLabelProvider != null) {
+ fLabelProvider.dispose();
+ fLabelProvider = null;
+ }
+
+ fTree.removeItemListener(this);
+ fTree.dispose();
+ }
+
+ /**
+ * Returns this viewer's presentation context.
+ *
+ * @return presentation context
+ */
+ @Override
public IPresentationContext getPresentationContext() {
- return fContext;
- }
-
- /**
- * Configures the columns for the given viewer input.
- *
- * @param input new viewer input
- */
- private void resetColumns(Object input) {
- if (input != null) {
- // only change columns if the input is non-null (persist when empty)
- IColumnPresentationFactory factory = ViewerAdapterService.getColumnPresentationFactory(input);
- PresentationContext context = (PresentationContext) getPresentationContext();
- String type = null;
- if (factory != null) {
- type = factory.getColumnPresentationId(context, input);
- }
- if (type != null && factory != null) {
- if (fColumnPresentation != null) {
- if (!fColumnPresentation.getId().equals(type)) {
- // dispose old, create new
- fColumnPresentation.dispose();
- fColumnPresentation = null;
- }
- }
- if (fColumnPresentation == null) {
- fColumnPresentation = factory.createColumnPresentation(context, input);
- if (fColumnPresentation != null) {
- fColumnPresentation.init(context);
- configureColumns();
- }
- }
- } else {
- if (fColumnPresentation != null) {
- fColumnPresentation.dispose();
- fColumnPresentation = null;
- configureColumns();
- }
- }
- }
- }
-
- /**
- * Configures the columns based on the current settings.
- */
- protected void configureColumns() {
- if (fColumnPresentation != null) {
- IColumnPresentation build = null;
- if (isShowColumns(fColumnPresentation.getId())) {
- build = fColumnPresentation;
- }
- buildColumns(build);
- } else {
- // get rid of columns
- buildColumns(null);
- }
- }
-
- /**
- * Toggles columns on/off for the current column presentation, if any.
- *
- * @param show whether to show columns if the current input supports
- * columns
- */
- public void setShowColumns(boolean show) {
- if (show) {
- if (!isShowColumns()) {
- fShowColumns.remove(fColumnPresentation.getId());
- }
- } else {
- if (isShowColumns()){
- fShowColumns.put(fColumnPresentation.getId(), Boolean.FALSE);
- }
- }
- refreshColumns();
- }
-
- /**
- * Refreshes the columns in the view, based on the viewer input.
- */
- protected void refreshColumns() {
- configureColumns();
- refresh();
- }
-
- /**
- * @return Returns true if columns are being displayed currently.
- */
- public boolean isShowColumns() {
- if (fColumnPresentation != null) {
- return isShowColumns(fColumnPresentation.getId());
- }
- return false;
- }
-
- /**
- * Returns whether columns can be toggled on/off for the current input.
- *
- * @return whether columns can be toggled on/off for the current input
- */
- public boolean canToggleColumns() {
- return fColumnPresentation != null && fColumnPresentation.isOptional();
- }
-
- protected boolean isShowColumns(String columnPresentationId) {
- Boolean bool = fShowColumns.get(columnPresentationId);
- if (bool == null) {
- return true;
- }
- return bool.booleanValue();
- }
-
- /**
- * Creates new columns for the given presentation.
- *
- * @param presentation presentation context to build columns for.
- */
- protected void buildColumns(IColumnPresentation presentation) {
- PresentationContext presentationContext = (PresentationContext) getPresentationContext();
- if (presentation != null) {
- presentationContext.setColumns(getVisibleColumns());
- } else {
- presentationContext.setColumns(null);
- }
- }
-
- /**
- * Returns identifiers of the visible columns in this viewer, or <code>null</code>
- * if there is currently no column presentation.
- *
- * @return visible columns or <code>null</code>
- */
- @Override
+ return fContext;
+ }
+
+ /**
+ * Configures the columns for the given viewer input.
+ *
+ * @param input new viewer input
+ */
+ private void resetColumns(Object input) {
+ if (input != null) {
+ // only change columns if the input is non-null (persist when empty)
+ IColumnPresentationFactory factory = ViewerAdapterService.getColumnPresentationFactory(input);
+ PresentationContext context = (PresentationContext) getPresentationContext();
+ String type = null;
+ if (factory != null) {
+ type = factory.getColumnPresentationId(context, input);
+ }
+ if (type != null && factory != null) {
+ if (fColumnPresentation != null) {
+ if (!fColumnPresentation.getId().equals(type)) {
+ // dispose old, create new
+ fColumnPresentation.dispose();
+ fColumnPresentation = null;
+ }
+ }
+ if (fColumnPresentation == null) {
+ fColumnPresentation = factory.createColumnPresentation(context, input);
+ if (fColumnPresentation != null) {
+ fColumnPresentation.init(context);
+ configureColumns();
+ }
+ }
+ } else {
+ if (fColumnPresentation != null) {
+ fColumnPresentation.dispose();
+ fColumnPresentation = null;
+ configureColumns();
+ }
+ }
+ }
+ }
+
+ /**
+ * Configures the columns based on the current settings.
+ */
+ protected void configureColumns() {
+ if (fColumnPresentation != null) {
+ IColumnPresentation build = null;
+ if (isShowColumns(fColumnPresentation.getId())) {
+ build = fColumnPresentation;
+ }
+ buildColumns(build);
+ } else {
+ // get rid of columns
+ buildColumns(null);
+ }
+ }
+
+ /**
+ * Toggles columns on/off for the current column presentation, if any.
+ *
+ * @param show whether to show columns if the current input supports
+ * columns
+ */
+ public void setShowColumns(boolean show) {
+ if (show) {
+ if (!isShowColumns()) {
+ fShowColumns.remove(fColumnPresentation.getId());
+ }
+ } else {
+ if (isShowColumns()){
+ fShowColumns.put(fColumnPresentation.getId(), Boolean.FALSE);
+ }
+ }
+ refreshColumns();
+ }
+
+ /**
+ * Refreshes the columns in the view, based on the viewer input.
+ */
+ protected void refreshColumns() {
+ configureColumns();
+ refresh();
+ }
+
+ /**
+ * @return Returns true if columns are being displayed currently.
+ */
+ public boolean isShowColumns() {
+ if (fColumnPresentation != null) {
+ return isShowColumns(fColumnPresentation.getId());
+ }
+ return false;
+ }
+
+ /**
+ * Returns whether columns can be toggled on/off for the current input.
+ *
+ * @return whether columns can be toggled on/off for the current input
+ */
+ public boolean canToggleColumns() {
+ return fColumnPresentation != null && fColumnPresentation.isOptional();
+ }
+
+ protected boolean isShowColumns(String columnPresentationId) {
+ Boolean bool = fShowColumns.get(columnPresentationId);
+ if (bool == null) {
+ return true;
+ }
+ return bool.booleanValue();
+ }
+
+ /**
+ * Creates new columns for the given presentation.
+ *
+ * @param presentation presentation context to build columns for.
+ */
+ protected void buildColumns(IColumnPresentation presentation) {
+ PresentationContext presentationContext = (PresentationContext) getPresentationContext();
+ if (presentation != null) {
+ presentationContext.setColumns(getVisibleColumns());
+ } else {
+ presentationContext.setColumns(null);
+ }
+ }
+
+ /**
+ * Returns identifiers of the visible columns in this viewer, or <code>null</code>
+ * if there is currently no column presentation.
+ *
+ * @return visible columns or <code>null</code>
+ */
+ @Override
public String[] getVisibleColumns() {
- if (isShowColumns()) {
- IColumnPresentation presentation = getColumnPresentation();
- if (presentation != null) {
- String[] columns = fVisibleColumns.get(presentation.getId());
- if (columns == null) {
- return presentation.getInitialColumns();
- }
- return columns;
- }
- }
- return null;
- }
-
- /**
- * Sets the id's of visible columns, or <code>null</code> to set default columns.
- * Only affects the current column presentation.
- *
- * @param ids visible columns
- */
- public void setVisibleColumns(String[] ids) {
- if (ids != null && ids.length == 0) {
- ids = null;
- }
- IColumnPresentation presentation = getColumnPresentation();
- if (presentation != null) {
- fVisibleColumns.remove(presentation.getId());
- if (ids != null) {
- // put back in table if not default
- String[] columns = presentation.getInitialColumns();
- if (columns.length == ids.length) {
- for (int i = 0; i < columns.length; i++) {
- if (!ids[i].equals(columns[i])) {
- fVisibleColumns.put(presentation.getId(), ids);
- break;
- }
- }
- } else {
- fVisibleColumns.put(presentation.getId(), ids);
- }
- }
- PresentationContext presentationContext = (PresentationContext) getPresentationContext();
- presentationContext.setColumns(getVisibleColumns());
- refreshColumns();
- }
- }
-
- /**
- * Returns the current column presentation for this viewer, or <code>null</code>
- * if none.
- *
- * @return column presentation or <code>null</code>
- */
- public IColumnPresentation getColumnPresentation() {
- return fColumnPresentation;
- }
-
- /**
- * Save viewer state into the given memento.
- *
- * @param memento Memento to write state to.
- */
- public void saveState(IMemento memento) {
- if (!fShowColumns.isEmpty()) {
+ if (isShowColumns()) {
+ IColumnPresentation presentation = getColumnPresentation();
+ if (presentation != null) {
+ String[] columns = fVisibleColumns.get(presentation.getId());
+ if (columns == null) {
+ return presentation.getInitialColumns();
+ }
+ return columns;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Sets the id's of visible columns, or <code>null</code> to set default columns.
+ * Only affects the current column presentation.
+ *
+ * @param ids visible columns
+ */
+ public void setVisibleColumns(String[] ids) {
+ if (ids != null && ids.length == 0) {
+ ids = null;
+ }
+ IColumnPresentation presentation = getColumnPresentation();
+ if (presentation != null) {
+ fVisibleColumns.remove(presentation.getId());
+ if (ids != null) {
+ // put back in table if not default
+ String[] columns = presentation.getInitialColumns();
+ if (columns.length == ids.length) {
+ for (int i = 0; i < columns.length; i++) {
+ if (!ids[i].equals(columns[i])) {
+ fVisibleColumns.put(presentation.getId(), ids);
+ break;
+ }
+ }
+ } else {
+ fVisibleColumns.put(presentation.getId(), ids);
+ }
+ }
+ PresentationContext presentationContext = (PresentationContext) getPresentationContext();
+ presentationContext.setColumns(getVisibleColumns());
+ refreshColumns();
+ }
+ }
+
+ /**
+ * Returns the current column presentation for this viewer, or <code>null</code>
+ * if none.
+ *
+ * @return column presentation or <code>null</code>
+ */
+ public IColumnPresentation getColumnPresentation() {
+ return fColumnPresentation;
+ }
+
+ /**
+ * Save viewer state into the given memento.
+ *
+ * @param memento Memento to write state to.
+ */
+ public void saveState(IMemento memento) {
+ if (!fShowColumns.isEmpty()) {
for (Entry<String, Boolean> entry : fShowColumns.entrySet()) {
- IMemento sizes = memento.createChild(SHOW_COLUMNS, entry.getKey());
- sizes.putString(SHOW_COLUMNS, entry.getValue().toString());
- }
- }
- if (!fVisibleColumns.isEmpty()) {
+ IMemento sizes = memento.createChild(SHOW_COLUMNS, entry.getKey());
+ sizes.putString(SHOW_COLUMNS, entry.getValue().toString());
+ }
+ }
+ if (!fVisibleColumns.isEmpty()) {
for (Entry<String, String[]> entry : fVisibleColumns.entrySet()) {
IMemento visible = memento.createChild(VISIBLE_COLUMNS, entry.getKey());
- String[] columns = entry.getValue();
- visible.putInteger(SIZE, columns.length);
- for (int i = 0; i < columns.length; i++) {
- visible.putString(COLUMN+Integer.toString(i), columns[i]);
- }
- }
- }
- // save presentation context properties
- IPresentationContext context = getPresentationContext();
- if (context instanceof PresentationContext) {
- PresentationContext pc = (PresentationContext) context;
- pc.saveProperites(memento);
-
- }
- }
-
- /**
- * Initializes viewer state from the memento
- *
- * @param memento Memento to read state from.
- */
- public void initState(IMemento memento) {
- IMemento[] mementos = memento.getChildren(SHOW_COLUMNS);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
- String id = child.getID();
- Boolean bool = Boolean.valueOf(child.getString(SHOW_COLUMNS));
- if (!bool.booleanValue()) {
- fShowColumns.put(id, bool);
- }
- }
- mementos = memento.getChildren(VISIBLE_COLUMNS);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
- String id = child.getID();
- Integer integer = child.getInteger(SIZE);
- if (integer != null) {
- int length = integer.intValue();
- String[] columns = new String[length];
- for (int j = 0; j < length; j++) {
- columns[j] = child.getString(COLUMN+Integer.toString(j));
- }
- fVisibleColumns.put(id, columns);
- }
- }
- // restore presentation context properties
- // save presentation context properties
- IPresentationContext context = getPresentationContext();
- if (context instanceof PresentationContext) {
- PresentationContext pc = (PresentationContext) context;
- pc.initProperties(memento);
- }
- }
-
- @Override
+ String[] columns = entry.getValue();
+ visible.putInteger(SIZE, columns.length);
+ for (int i = 0; i < columns.length; i++) {
+ visible.putString(COLUMN+Integer.toString(i), columns[i]);
+ }
+ }
+ }
+ // save presentation context properties
+ IPresentationContext context = getPresentationContext();
+ if (context instanceof PresentationContext) {
+ PresentationContext pc = (PresentationContext) context;
+ pc.saveProperites(memento);
+
+ }
+ }
+
+ /**
+ * Initializes viewer state from the memento
+ *
+ * @param memento Memento to read state from.
+ */
+ public void initState(IMemento memento) {
+ IMemento[] mementos = memento.getChildren(SHOW_COLUMNS);
+ for (int i = 0; i < mementos.length; i++) {
+ IMemento child = mementos[i];
+ String id = child.getID();
+ Boolean bool = Boolean.valueOf(child.getString(SHOW_COLUMNS));
+ if (!bool.booleanValue()) {
+ fShowColumns.put(id, bool);
+ }
+ }
+ mementos = memento.getChildren(VISIBLE_COLUMNS);
+ for (int i = 0; i < mementos.length; i++) {
+ IMemento child = mementos[i];
+ String id = child.getID();
+ Integer integer = child.getInteger(SIZE);
+ if (integer != null) {
+ int length = integer.intValue();
+ String[] columns = new String[length];
+ for (int j = 0; j < length; j++) {
+ columns[j] = child.getString(COLUMN+Integer.toString(j));
+ }
+ fVisibleColumns.put(id, columns);
+ }
+ }
+ // restore presentation context properties
+ // save presentation context properties
+ IPresentationContext context = getPresentationContext();
+ if (context instanceof PresentationContext) {
+ PresentationContext pc = (PresentationContext) context;
+ pc.initProperties(memento);
+ }
+ }
+
+ @Override
public void addViewerUpdateListener(IViewerUpdateListener listener) {
- getContentProvider().addViewerUpdateListener(listener);
- }
+ getContentProvider().addViewerUpdateListener(listener);
+ }
- @Override
+ @Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {
- ITreeModelContentProvider cp = getContentProvider();
- if (cp != null) {
- cp.removeViewerUpdateListener(listener);
- }
- }
+ ITreeModelContentProvider cp = getContentProvider();
+ if (cp != null) {
+ cp.removeViewerUpdateListener(listener);
+ }
+ }
- @Override
+ @Override
public void addModelChangedListener(IModelChangedListener listener) {
- getContentProvider().addModelChangedListener(listener);
- }
+ getContentProvider().addModelChangedListener(listener);
+ }
- @Override
+ @Override
public void removeModelChangedListener(IModelChangedListener listener) {
- ITreeModelContentProvider cp = getContentProvider();
- if (cp != null) {
- cp.removeModelChangedListener(listener);
- }
- }
+ ITreeModelContentProvider cp = getContentProvider();
+ if (cp != null) {
+ cp.removeModelChangedListener(listener);
+ }
+ }
- @Override
+ @Override
public void addStateUpdateListener(IStateUpdateListener listener) {
- getContentProvider().addStateUpdateListener(listener);
- }
+ getContentProvider().addStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void removeStateUpdateListener(IStateUpdateListener listener) {
- ITreeModelContentProvider cp = getContentProvider();
- if (cp != null) {
- cp.removeStateUpdateListener(listener);
- }
- }
+ ITreeModelContentProvider cp = getContentProvider();
+ if (cp != null) {
+ cp.removeStateUpdateListener(listener);
+ }
+ }
@Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {
- getLabelProvider().addLabelUpdateListener(listener);
- }
+ getLabelProvider().addLabelUpdateListener(listener);
+ }
- @Override
+ @Override
public void removeLabelUpdateListener(ILabelUpdateListener listener) {
- getLabelProvider().removeLabelUpdateListener(listener);
- }
-
- /**
- * Performs auto expand on an element at the specified path if the auto expand
- * level dictates the element should be expanded.
- *
- * @param elementPath tree path to element to consider for expansion
- */
- @Override
+ getLabelProvider().removeLabelUpdateListener(listener);
+ }
+
+ /**
+ * Performs auto expand on an element at the specified path if the auto expand
+ * level dictates the element should be expanded.
+ *
+ * @param elementPath tree path to element to consider for expansion
+ */
+ @Override
public void autoExpand(TreePath elementPath) {
- int level = getAutoExpandLevel();
- if (level > 0 || level == org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer.ALL_LEVELS) {
- if (level == org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer.ALL_LEVELS || level > elementPath.getSegmentCount()) {
- expandToLevel(elementPath, 1);
- }
- }
- }
-
- @Override
+ int level = getAutoExpandLevel();
+ if (level > 0 || level == org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer.ALL_LEVELS) {
+ if (level == org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer.ALL_LEVELS || level > elementPath.getSegmentCount()) {
+ expandToLevel(elementPath, 1);
+ }
+ }
+ }
+
+ @Override
public int getChildCount(TreePath path) {
- int childCount = -1;
- VirtualItem[] items = findItems(path);
- if (items.length > 0) {
- childCount = items[0].getItemCount();
- // Mimic the jface viewer behavior which returns 1 for child count
- // for an item that has children but is not yet expanded.
- // Return 0, if we do not know if the item has children.
- if (childCount == -1) {
- childCount = items[0].hasItems() ? 1 : 0;
- }
- }
- return childCount;
- }
-
- @Override
+ int childCount = -1;
+ VirtualItem[] items = findItems(path);
+ if (items.length > 0) {
+ childCount = items[0].getItemCount();
+ // Mimic the jface viewer behavior which returns 1 for child count
+ // for an item that has children but is not yet expanded.
+ // Return 0, if we do not know if the item has children.
+ if (childCount == -1) {
+ childCount = items[0].hasItems() ? 1 : 0;
+ }
+ }
+ return childCount;
+ }
+
+ @Override
public Object getChildElement(TreePath path, int index) {
- VirtualItem[] items = findItems(path);
- if (items.length > 0) {
- if (index < items[0].getItemCount()) {
- return items[0].getItem(new VirtualItem.Index(index)).getData();
- }
- }
- return null;
- }
-
- @Override
+ VirtualItem[] items = findItems(path);
+ if (items.length > 0) {
+ if (index < items[0].getItemCount()) {
+ return items[0].getItem(new VirtualItem.Index(index)).getData();
+ }
+ }
+ return null;
+ }
+
+ @Override
public TreePath getTopElementPath() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean saveElementState(TreePath path, ModelDelta delta, int flagsToSave) {
- VirtualTree tree = getTree();
- VirtualItem[] selection = tree.getSelection();
+ VirtualTree tree = getTree();
+ VirtualItem[] selection = tree.getSelection();
Set<VirtualItem> set = new HashSet<>();
- for (int i = 0; i < selection.length; i++) {
- set.add(selection[i]);
- }
-
- VirtualItem[] items = null;
- VirtualItem parent = findItem(path);
-
- if (parent != null) {
- delta.setChildCount(((TreeModelContentProvider)getContentProvider()).viewToModelCount(path, parent.getItemCount()));
- if (parent.getExpanded()) {
- if ((flagsToSave & IModelDelta.EXPAND) != 0) {
- delta.setFlags(delta.getFlags() | IModelDelta.EXPAND);
- }
- } else if ((flagsToSave & IModelDelta.COLLAPSE) != 0 && parent.hasItems()){
- delta.setFlags(delta.getFlags() | IModelDelta.COLLAPSE);
- }
-
- if (set.contains(parent) && (flagsToSave & IModelDelta.SELECT) != 0) {
- delta.setFlags(delta.getFlags() | IModelDelta.SELECT);
- }
-
- items = parent.getItems();
- for (int i = 0; i < items.length; i++) {
- doSaveElementState(path, delta, items[i], set, flagsToSave);
- }
- return true;
- } else {
- return false;
- }
- }
+ for (int i = 0; i < selection.length; i++) {
+ set.add(selection[i]);
+ }
+
+ VirtualItem[] items = null;
+ VirtualItem parent = findItem(path);
+
+ if (parent != null) {
+ delta.setChildCount(((TreeModelContentProvider)getContentProvider()).viewToModelCount(path, parent.getItemCount()));
+ if (parent.getExpanded()) {
+ if ((flagsToSave & IModelDelta.EXPAND) != 0) {
+ delta.setFlags(delta.getFlags() | IModelDelta.EXPAND);
+ }
+ } else if ((flagsToSave & IModelDelta.COLLAPSE) != 0 && parent.hasItems()){
+ delta.setFlags(delta.getFlags() | IModelDelta.COLLAPSE);
+ }
+
+ if (set.contains(parent) && (flagsToSave & IModelDelta.SELECT) != 0) {
+ delta.setFlags(delta.getFlags() | IModelDelta.SELECT);
+ }
+
+ items = parent.getItems();
+ for (int i = 0; i < items.length; i++) {
+ doSaveElementState(path, delta, items[i], set, flagsToSave);
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
private void doSaveElementState(TreePath parentPath, ModelDelta delta, VirtualItem item, Collection<VirtualItem> set, int flagsToSave) {
- Object element = item.getData();
- if (element != null) {
- boolean expanded = item.getExpanded();
- boolean selected = set.contains(item);
- int flags = IModelDelta.NO_CHANGE;
- if (expanded && (flagsToSave & IModelDelta.EXPAND) != 0) {
- flags = flags | IModelDelta.EXPAND;
- }
- if (!expanded && (flagsToSave & IModelDelta.COLLAPSE) != 0 && item.hasItems()){
- flags = flags | IModelDelta.COLLAPSE;
- }
- if (selected && (flagsToSave & IModelDelta.SELECT) != 0) {
- flags = flags | IModelDelta.SELECT;
- }
- if (expanded || flags != IModelDelta.NO_CHANGE) {
- int modelIndex = ((TreeModelContentProvider)getContentProvider()).viewToModelIndex(parentPath, item.getIndex().intValue());
- TreePath elementPath = parentPath.createChildPath(element);
- int numChildren = ((TreeModelContentProvider)getContentProvider()).viewToModelCount(elementPath, item.getItemCount());
- ModelDelta childDelta = delta.addNode(element, modelIndex, flags, numChildren);
- if (expanded) {
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- doSaveElementState(elementPath, childDelta, items[i], set, flagsToSave);
- }
- }
- }
- }
- }
-
- @Override
+ Object element = item.getData();
+ if (element != null) {
+ boolean expanded = item.getExpanded();
+ boolean selected = set.contains(item);
+ int flags = IModelDelta.NO_CHANGE;
+ if (expanded && (flagsToSave & IModelDelta.EXPAND) != 0) {
+ flags = flags | IModelDelta.EXPAND;
+ }
+ if (!expanded && (flagsToSave & IModelDelta.COLLAPSE) != 0 && item.hasItems()){
+ flags = flags | IModelDelta.COLLAPSE;
+ }
+ if (selected && (flagsToSave & IModelDelta.SELECT) != 0) {
+ flags = flags | IModelDelta.SELECT;
+ }
+ if (expanded || flags != IModelDelta.NO_CHANGE) {
+ int modelIndex = ((TreeModelContentProvider)getContentProvider()).viewToModelIndex(parentPath, item.getIndex().intValue());
+ TreePath elementPath = parentPath.createChildPath(element);
+ int numChildren = ((TreeModelContentProvider)getContentProvider()).viewToModelCount(elementPath, item.getItemCount());
+ ModelDelta childDelta = delta.addNode(element, modelIndex, flags, numChildren);
+ if (expanded) {
+ VirtualItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ doSaveElementState(elementPath, childDelta, items[i], set, flagsToSave);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
public void updateViewer(IModelDelta delta) {
- getContentProvider().updateModel(delta, ITreeModelContentProvider.ALL_MODEL_DELTA_FLAGS);
- }
+ getContentProvider().updateModel(delta, ITreeModelContentProvider.ALL_MODEL_DELTA_FLAGS);
+ }
- @Override
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
- if (path.getSegmentCount() == 0) {
- return null;
- }
-
- int columnIdx = -1;
- String[] visibleColumns = getVisibleColumns();
- if (columnId != null && visibleColumns != null) {
- int i = 0;
- for (i = 0; i < visibleColumns.length; i++) {
- if (columnId.equals(getVisibleColumns()[i])) {
- columnIdx = i;
- break;
- }
- }
- if (i == visibleColumns.length) {
- return null;
- }
- } else {
- columnIdx = 0;
- }
- VirtualItem item = findItem(path);
-
- if (item != null) {
- ViewerLabel label = new ViewerLabel(getText(item, columnIdx), getImage(item, columnIdx));
- label.setFont(getFont(item, columnIdx));
- label.setBackground(getBackground(item, columnIdx));
- label.setForeground(getForeground(item, columnIdx));
- return label;
- }
- return null;
- }
-
- @Override
+ if (path.getSegmentCount() == 0) {
+ return null;
+ }
+
+ int columnIdx = -1;
+ String[] visibleColumns = getVisibleColumns();
+ if (columnId != null && visibleColumns != null) {
+ int i = 0;
+ for (i = 0; i < visibleColumns.length; i++) {
+ if (columnId.equals(getVisibleColumns()[i])) {
+ columnIdx = i;
+ break;
+ }
+ }
+ if (i == visibleColumns.length) {
+ return null;
+ }
+ } else {
+ columnIdx = 0;
+ }
+ VirtualItem item = findItem(path);
+
+ if (item != null) {
+ ViewerLabel label = new ViewerLabel(getText(item, columnIdx), getImage(item, columnIdx));
+ label.setFont(getFont(item, columnIdx));
+ label.setBackground(getBackground(item, columnIdx));
+ label.setForeground(getForeground(item, columnIdx));
+ return label;
+ }
+ return null;
+ }
+
+ @Override
public TreePath[] getElementPaths(Object element) {
- VirtualItem[] items = findItems(element);
- TreePath[] paths = new TreePath[items.length];
- for (int i = 0; i < items.length; i++) {
- paths[i] = getTreePathFromItem(items[i]);
- }
- return paths;
- }
-
-
- public String getText(VirtualItem item, int columnIdx) {
- String[] texts = (String[])item.getData(VirtualItem.LABEL_KEY);
- if (texts != null && texts.length > columnIdx) {
- return texts[columnIdx];
- }
- return null;
- }
-
- public Image getImage(VirtualItem item, int columnIdx) {
- ImageDescriptor[] imageDescriptors = (ImageDescriptor[]) item.getData(VirtualItem.IMAGE_KEY);
- if (imageDescriptors != null && imageDescriptors.length > columnIdx) {
- return getLabelProvider().getImage(imageDescriptors[columnIdx]);
- }
- return null;
- }
-
- public Font getFont(VirtualItem item, int columnIdx) {
- FontData[] fontDatas = (FontData[]) item.getData(VirtualItem.FONT_KEY);
- if (fontDatas != null) {
- return getLabelProvider().getFont(fontDatas[columnIdx]);
- }
- return null;
- }
-
- public Color getForeground(VirtualItem item, int columnIdx) {
- RGB[] rgbs = (RGB[]) item.getData(VirtualItem.FOREGROUND_KEY);
- if (rgbs != null) {
- return getLabelProvider().getColor(rgbs[columnIdx]);
- }
- return null;
- }
-
- public Color getBackground(VirtualItem item, int columnIdx) {
- RGB[] rgbs = (RGB[]) item.getData(VirtualItem.BACKGROUND_KEY);
- if (rgbs != null) {
- return getLabelProvider().getColor(rgbs[columnIdx]);
- }
- return null;
- }
-
- @Override
+ VirtualItem[] items = findItems(element);
+ TreePath[] paths = new TreePath[items.length];
+ for (int i = 0; i < items.length; i++) {
+ paths[i] = getTreePathFromItem(items[i]);
+ }
+ return paths;
+ }
+
+
+ public String getText(VirtualItem item, int columnIdx) {
+ String[] texts = (String[])item.getData(VirtualItem.LABEL_KEY);
+ if (texts != null && texts.length > columnIdx) {
+ return texts[columnIdx];
+ }
+ return null;
+ }
+
+ public Image getImage(VirtualItem item, int columnIdx) {
+ ImageDescriptor[] imageDescriptors = (ImageDescriptor[]) item.getData(VirtualItem.IMAGE_KEY);
+ if (imageDescriptors != null && imageDescriptors.length > columnIdx) {
+ return getLabelProvider().getImage(imageDescriptors[columnIdx]);
+ }
+ return null;
+ }
+
+ public Font getFont(VirtualItem item, int columnIdx) {
+ FontData[] fontDatas = (FontData[]) item.getData(VirtualItem.FONT_KEY);
+ if (fontDatas != null) {
+ return getLabelProvider().getFont(fontDatas[columnIdx]);
+ }
+ return null;
+ }
+
+ public Color getForeground(VirtualItem item, int columnIdx) {
+ RGB[] rgbs = (RGB[]) item.getData(VirtualItem.FOREGROUND_KEY);
+ if (rgbs != null) {
+ return getLabelProvider().getColor(rgbs[columnIdx]);
+ }
+ return null;
+ }
+
+ public Color getBackground(VirtualItem item, int columnIdx) {
+ RGB[] rgbs = (RGB[]) item.getData(VirtualItem.BACKGROUND_KEY);
+ if (rgbs != null) {
+ return getLabelProvider().getColor(rgbs[columnIdx]);
+ }
+ return null;
+ }
+
+ @Override
public void clearSelectionQuiet() {
- getTree().setSelection(EMPTY_ITEMS_ARRAY);
- }
+ getTree().setSelection(EMPTY_ITEMS_ARRAY);
+ }
- @Override
+ @Override
public boolean getElementChecked(TreePath path) {
- // Not supported
- return false;
- }
+ // Not supported
+ return false;
+ }
- @Override
+ @Override
public boolean getElementGrayed(TreePath path) {
- // Not supported
- return false;
- }
+ // Not supported
+ return false;
+ }
- @Override
+ @Override
public void setElementChecked(TreePath path, boolean checked, boolean grayed) {
- // Not supported
- }
+ // Not supported
+ }
- @Override
+ @Override
public String toString() {
- return getTree().toString();
- }
+ return getTree().toString();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
index 4ece51019..984ca2e6e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
@@ -137,7 +137,7 @@ class LabelUpdate extends Request implements ILabelUpdate, ICheckUpdate {
* Applies settings to viewer cell
*/
public void performUpdate() {
- fProvider.setElementData(fElementPath, fNumColumns, fLabels, fImageDescriptors, fFontDatas, fForegrounds, fBackgrounds, fChecked, fGrayed);
+ fProvider.setElementData(fElementPath, fNumColumns, fLabels, fImageDescriptors, fFontDatas, fForegrounds, fBackgrounds, fChecked, fGrayed);
fProvider.updateComplete(this);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java
index 329cac20b..0e718ba2e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/MementoUpdate.java
@@ -33,12 +33,12 @@ abstract class MementoUpdate extends Request implements IViewerUpdate {
/**
* Constructs a viewer state request.
- * @param provider the content provider to use for the update
- * @param viewerInput the current input
- * @param elementPath the path of the element to update
- * @param element the element to update
- * @param memento Memento to update
- * @param context the presentation context
+ * @param provider the content provider to use for the update
+ * @param viewerInput the current input
+ * @param elementPath the path of the element to update
+ * @param element the element to update
+ * @param memento Memento to update
+ * @param context the presentation context
*
*/
public MementoUpdate(TreeModelContentProvider provider, Object viewerInput, IPresentationContext context, Object element, TreePath elementPath, IMemento memento) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/SubTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/SubTreeModelViewer.java
index 8886c18d8..00a70d498 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/SubTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/SubTreeModelViewer.java
@@ -45,545 +45,545 @@ import org.eclipse.swt.widgets.Display;
*/
public class SubTreeModelViewer extends TreeModelViewer {
- /**
- * The tree path in the model to the root element of this viewer.
- */
- private TreePath fRootPath = TreePath.EMPTY;
-
- /**
- * Viewer delegate that content and label providers refer to for viewer data.
- */
- private DelegatingTreeModelViewer fDelegatingViewer;
-
- /**
- * @return Returns the root element's model tree path.
- */
- public TreePath getRootPath() {
- return fRootPath;
- }
-
- public SubTreeModelViewer(Composite parent, int style, IPresentationContext context) {
- super(parent, style, context);
- }
-
- /**
- * Sets the viewer's input and root element's path
- *
- * @param input New viewer input.
- * @param rootPath New root element path.
- */
- public void setInput(Object input, TreePath rootPath) {
- fRootPath = rootPath;
- super.setInput(input);
- }
-
- /**
- * A proxy for the sub tree viewer which is given to the content and
- * label providers. It translates the sub-tree paths in the viewer to the
- * full model paths that the providers expect.
- */
- public class DelegatingTreeModelViewer extends Viewer
- implements IInternalTreeModelViewer
- {
- @Override
+ /**
+ * The tree path in the model to the root element of this viewer.
+ */
+ private TreePath fRootPath = TreePath.EMPTY;
+
+ /**
+ * Viewer delegate that content and label providers refer to for viewer data.
+ */
+ private DelegatingTreeModelViewer fDelegatingViewer;
+
+ /**
+ * @return Returns the root element's model tree path.
+ */
+ public TreePath getRootPath() {
+ return fRootPath;
+ }
+
+ public SubTreeModelViewer(Composite parent, int style, IPresentationContext context) {
+ super(parent, style, context);
+ }
+
+ /**
+ * Sets the viewer's input and root element's path
+ *
+ * @param input New viewer input.
+ * @param rootPath New root element path.
+ */
+ public void setInput(Object input, TreePath rootPath) {
+ fRootPath = rootPath;
+ super.setInput(input);
+ }
+
+ /**
+ * A proxy for the sub tree viewer which is given to the content and
+ * label providers. It translates the sub-tree paths in the viewer to the
+ * full model paths that the providers expect.
+ */
+ public class DelegatingTreeModelViewer extends Viewer
+ implements IInternalTreeModelViewer
+ {
+ @Override
public void reveal(TreePath path, int index) {
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.reveal(createSubPath(path), index);
- }
- }
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.reveal(createSubPath(path), index);
+ }
+ }
- @Override
+ @Override
public void replace(Object parentOrTreePath, int index, Object element) {
- if (parentOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)parentOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.replace(createSubPath(path), index, element);
- }
- } else {
- SubTreeModelViewer.this.replace(parentOrTreePath, index, element);
- }
- }
-
- @Override
+ if (parentOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)parentOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.replace(createSubPath(path), index, element);
+ }
+ } else {
+ SubTreeModelViewer.this.replace(parentOrTreePath, index, element);
+ }
+ }
+
+ @Override
public void setChildCount(Object elementOrTreePath, int count) {
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.setChildCount(createSubPath(path), count);
- }
- } else {
- SubTreeModelViewer.this.setChildCount(elementOrTreePath, count);
- }
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.setChildCount(createSubPath(path), count);
+ }
+ } else {
+ SubTreeModelViewer.this.setChildCount(elementOrTreePath, count);
+ }
+ }
+
+ @Override
public void setHasChildren(Object elementOrTreePath, boolean hasChildren) {
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.setHasChildren(createSubPath(path), hasChildren);
- }
- } else {
- SubTreeModelViewer.this.setHasChildren(elementOrTreePath, hasChildren);
- }
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.setHasChildren(createSubPath(path), hasChildren);
+ }
+ } else {
+ SubTreeModelViewer.this.setHasChildren(elementOrTreePath, hasChildren);
+ }
+ }
+
+ @Override
public void autoExpand(TreePath elementPath) {
- // not supported
- }
+ // not supported
+ }
- @Override
+ @Override
public void setExpandedState(Object elementOrTreePath, boolean expanded) {
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.setExpandedState(createSubPath(path), expanded);
- }
- } else {
- SubTreeModelViewer.this.setExpandedState(elementOrTreePath, expanded);
- }
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.setExpandedState(createSubPath(path), expanded);
+ }
+ } else {
+ SubTreeModelViewer.this.setExpandedState(elementOrTreePath, expanded);
+ }
+ }
+
+ @Override
public void expandToLevel(Object elementOrTreePath, int level) {
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.expandToLevel(createSubPath(path), level);
- }
- } else {
- SubTreeModelViewer.this.expandToLevel(elementOrTreePath, level);
- }
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.expandToLevel(createSubPath(path), level);
+ }
+ } else {
+ SubTreeModelViewer.this.expandToLevel(elementOrTreePath, level);
+ }
+ }
+
+ @Override
public void remove(Object elementOrTreePath) {
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.remove(createSubPath(path));
- }
- } else {
- SubTreeModelViewer.this.remove(elementOrTreePath);
- }
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.remove(createSubPath(path));
+ }
+ } else {
+ SubTreeModelViewer.this.remove(elementOrTreePath);
+ }
+ }
+
+ @Override
public void remove(Object parentOrTreePath, final int index) {
- if (parentOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)parentOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.remove(createSubPath(path), index);
- }
- } else {
- SubTreeModelViewer.this.remove(parentOrTreePath, index);
- }
- }
-
- @Override
+ if (parentOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)parentOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.remove(createSubPath(path), index);
+ }
+ } else {
+ SubTreeModelViewer.this.remove(parentOrTreePath, index);
+ }
+ }
+
+ @Override
public void insert(Object parentOrTreePath, Object element, int position) {
- if (parentOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)parentOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.insert(createSubPath(path), element, position);
- }
- } else {
- SubTreeModelViewer.this.insert(parentOrTreePath, element, position);
- }
- }
-
- @Override
+ if (parentOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)parentOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.insert(createSubPath(path), element, position);
+ }
+ } else {
+ SubTreeModelViewer.this.insert(parentOrTreePath, element, position);
+ }
+ }
+
+ @Override
public boolean getExpandedState(Object elementOrTreePath) {
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- return SubTreeModelViewer.this.getExpandedState(createSubPath(path));
- }
- } else {
- return SubTreeModelViewer.this.getExpandedState(elementOrTreePath);
- }
- return false;
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ return SubTreeModelViewer.this.getExpandedState(createSubPath(path));
+ }
+ } else {
+ return SubTreeModelViewer.this.getExpandedState(elementOrTreePath);
+ }
+ return false;
+ }
+
+ @Override
public int getChildCount(TreePath path) {
- if (path.startsWith(fRootPath, null)) {
- return SubTreeModelViewer.this.getChildCount(createSubPath(path));
- }
- return -1;
- }
+ if (path.startsWith(fRootPath, null)) {
+ return SubTreeModelViewer.this.getChildCount(createSubPath(path));
+ }
+ return -1;
+ }
- @Override
+ @Override
public boolean getHasChildren(Object elementOrTreePath) {
- if (elementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)elementOrTreePath;
- if (path.startsWith(fRootPath, null)) {
- return SubTreeModelViewer.this.getHasChildren(createSubPath(path));
- }
- } else {
- return SubTreeModelViewer.this.getHasChildren(elementOrTreePath);
- }
- return false;
- }
-
- @Override
+ if (elementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)elementOrTreePath;
+ if (path.startsWith(fRootPath, null)) {
+ return SubTreeModelViewer.this.getHasChildren(createSubPath(path));
+ }
+ } else {
+ return SubTreeModelViewer.this.getHasChildren(elementOrTreePath);
+ }
+ return false;
+ }
+
+ @Override
public Object getChildElement(TreePath path, int index) {
- if (path.startsWith(fRootPath, null)) {
- return SubTreeModelViewer.this.getChildElement(createSubPath(path), index);
- }
- return null;
- }
+ if (path.startsWith(fRootPath, null)) {
+ return SubTreeModelViewer.this.getChildElement(createSubPath(path), index);
+ }
+ return null;
+ }
- @Override
+ @Override
public TreePath getTopElementPath() {
- return createFullPath(SubTreeModelViewer.this.getTopElementPath());
- }
+ return createFullPath(SubTreeModelViewer.this.getTopElementPath());
+ }
- @Override
+ @Override
public int findElementIndex(TreePath parentPath, Object element) {
- if (parentPath.startsWith(fRootPath, null)) {
- return SubTreeModelViewer.this.findElementIndex(createSubPath(parentPath), element);
- }
- return -1;
- }
+ if (parentPath.startsWith(fRootPath, null)) {
+ return SubTreeModelViewer.this.findElementIndex(createSubPath(parentPath), element);
+ }
+ return -1;
+ }
- @Override
+ @Override
public boolean getElementChildrenRealized(TreePath parentPath) {
- if (parentPath.startsWith(fRootPath, null)) {
- return SubTreeModelViewer.this.getElementChildrenRealized(createSubPath(parentPath));
- }
- return true;
- }
+ if (parentPath.startsWith(fRootPath, null)) {
+ return SubTreeModelViewer.this.getElementChildrenRealized(createSubPath(parentPath));
+ }
+ return true;
+ }
- @Override
+ @Override
public void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images, FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds) {
- if (path.startsWith(fRootPath, null)) {
- SubTreeModelViewer.this.setElementData(createSubPath(path), numColumns, labels, images, fontDatas, foregrounds, backgrounds);
- }
- }
+ if (path.startsWith(fRootPath, null)) {
+ SubTreeModelViewer.this.setElementData(createSubPath(path), numColumns, labels, images, fontDatas, foregrounds, backgrounds);
+ }
+ }
- @Override
+ @Override
public Control getControl() {
- return SubTreeModelViewer.this.getControl();
- }
+ return SubTreeModelViewer.this.getControl();
+ }
- @Override
+ @Override
public Object getInput() {
- return SubTreeModelViewer.this.getInput();
- }
+ return SubTreeModelViewer.this.getInput();
+ }
- @Override
+ @Override
public ISelection getSelection() {
- return SubTreeModelViewer.this.getSelection();
- }
+ return SubTreeModelViewer.this.getSelection();
+ }
- @Override
+ @Override
public void refresh() {
- SubTreeModelViewer.this.refresh();
- }
+ SubTreeModelViewer.this.refresh();
+ }
- @Override
+ @Override
public void setInput(Object input) {
- SubTreeModelViewer.this.setInput(input);
- }
+ SubTreeModelViewer.this.setInput(input);
+ }
- @Override
+ @Override
public void setSelection(ISelection selection, boolean reveal) {
- SubTreeModelViewer.this.setSelection(selection, reveal);
- }
+ SubTreeModelViewer.this.setSelection(selection, reveal);
+ }
- @Override
+ @Override
public String[] getVisibleColumns() {
- return SubTreeModelViewer.this.getVisibleColumns();
- }
+ return SubTreeModelViewer.this.getVisibleColumns();
+ }
- @Override
+ @Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {
- SubTreeModelViewer.this.addLabelUpdateListener(listener);
- }
+ SubTreeModelViewer.this.addLabelUpdateListener(listener);
+ }
- @Override
+ @Override
public void addModelChangedListener(IModelChangedListener listener) {
- SubTreeModelViewer.this.addModelChangedListener(listener);
- }
+ SubTreeModelViewer.this.addModelChangedListener(listener);
+ }
- @Override
+ @Override
public void addStateUpdateListener(IStateUpdateListener listener) {
- SubTreeModelViewer.this.addStateUpdateListener(listener);
- }
+ SubTreeModelViewer.this.addStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void addViewerUpdateListener(IViewerUpdateListener listener) {
- SubTreeModelViewer.this.addViewerUpdateListener(listener);
- }
+ SubTreeModelViewer.this.addViewerUpdateListener(listener);
+ }
- @Override
+ @Override
public int getAutoExpandLevel() {
- return SubTreeModelViewer.this.getAutoExpandLevel();
- }
+ return SubTreeModelViewer.this.getAutoExpandLevel();
+ }
- @Override
+ @Override
public Display getDisplay() {
- return SubTreeModelViewer.this.getDisplay();
- }
+ return SubTreeModelViewer.this.getDisplay();
+ }
- @Override
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
- return SubTreeModelViewer.this.getElementLabel(path, columnId);
- }
+ return SubTreeModelViewer.this.getElementLabel(path, columnId);
+ }
- @Override
+ @Override
public IPresentationContext getPresentationContext() {
- return SubTreeModelViewer.this.getPresentationContext();
- }
+ return SubTreeModelViewer.this.getPresentationContext();
+ }
- @Override
+ @Override
public void removeLabelUpdateListener(ILabelUpdateListener listener) {
- SubTreeModelViewer.this.removeLabelUpdateListener(listener);
- }
+ SubTreeModelViewer.this.removeLabelUpdateListener(listener);
+ }
- @Override
+ @Override
public void removeModelChangedListener(IModelChangedListener listener) {
- SubTreeModelViewer.this.removeModelChangedListener(listener);
- }
+ SubTreeModelViewer.this.removeModelChangedListener(listener);
+ }
- @Override
+ @Override
public void removeStateUpdateListener(IStateUpdateListener listener) {
- SubTreeModelViewer.this.removeStateUpdateListener(listener);
- }
+ SubTreeModelViewer.this.removeStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {
- SubTreeModelViewer.this.removeViewerUpdateListener(listener);
- }
+ SubTreeModelViewer.this.removeViewerUpdateListener(listener);
+ }
- @Override
+ @Override
public boolean saveElementState(TreePath path, ModelDelta delta, int deltaFlags) {
- return SubTreeModelViewer.this.saveElementState(path, delta, deltaFlags);
- }
+ return SubTreeModelViewer.this.saveElementState(path, delta, deltaFlags);
+ }
- @Override
+ @Override
public void setAutoExpandLevel(int level) {
- SubTreeModelViewer.this.setAutoExpandLevel(level);
- }
+ SubTreeModelViewer.this.setAutoExpandLevel(level);
+ }
- @Override
+ @Override
public void setSelection(ISelection selection, boolean reveal, boolean force) {
- SubTreeModelViewer.this.setSelection(selection, reveal, force);
- }
+ SubTreeModelViewer.this.setSelection(selection, reveal, force);
+ }
- @Override
+ @Override
public boolean trySelection(ISelection selection, boolean reveal, boolean force) {
- return SubTreeModelViewer.this.trySelection(selection, reveal, force);
- }
+ return SubTreeModelViewer.this.trySelection(selection, reveal, force);
+ }
- @Override
+ @Override
public void updateViewer(IModelDelta delta) {
- SubTreeModelViewer.this.updateViewer(delta);
- }
+ SubTreeModelViewer.this.updateViewer(delta);
+ }
- @Override
+ @Override
public ViewerFilter[] getFilters() {
- return SubTreeModelViewer.this.getFilters();
- }
+ return SubTreeModelViewer.this.getFilters();
+ }
- @Override
+ @Override
public void addFilter(ViewerFilter filter) {
- SubTreeModelViewer.this.addFilter(filter);
- }
+ SubTreeModelViewer.this.addFilter(filter);
+ }
- @Override
+ @Override
public void setFilters(ViewerFilter... filters) {
- SubTreeModelViewer.this.setFilters(filters);
- }
+ SubTreeModelViewer.this.setFilters(filters);
+ }
- @Override
+ @Override
public boolean overrideSelection(ISelection current, ISelection candidate) {
- return SubTreeModelViewer.this.overrideSelection(current, candidate);
- }
+ return SubTreeModelViewer.this.overrideSelection(current, candidate);
+ }
- @Override
+ @Override
public void refresh(Object element) {
- SubTreeModelViewer.this.refresh(element);
- }
+ SubTreeModelViewer.this.refresh(element);
+ }
- @Override
+ @Override
public void update(Object element) {
- SubTreeModelViewer.this.update(element);
- }
+ SubTreeModelViewer.this.update(element);
+ }
- @Override
+ @Override
public void clearSelectionQuiet() {
- SubTreeModelViewer.this.clearSelectionQuiet();
- }
+ SubTreeModelViewer.this.clearSelectionQuiet();
+ }
- @Override
+ @Override
public TreePath[] getElementPaths(Object element) {
- TreePath[] subViewerPaths = SubTreeModelViewer.this.getElementPaths(element);
- TreePath[] retVal = new TreePath[subViewerPaths.length];
- for (int i = 0; i < subViewerPaths.length; i++) {
- retVal[i] = createFullPath(subViewerPaths[i]);
- }
- return retVal;
- }
-
- @Override
+ TreePath[] subViewerPaths = SubTreeModelViewer.this.getElementPaths(element);
+ TreePath[] retVal = new TreePath[subViewerPaths.length];
+ for (int i = 0; i < subViewerPaths.length; i++) {
+ retVal[i] = createFullPath(subViewerPaths[i]);
+ }
+ return retVal;
+ }
+
+ @Override
public boolean getElementChecked(TreePath path) {
- return SubTreeModelViewer.this.getElementChecked(createSubPath(path));
- }
+ return SubTreeModelViewer.this.getElementChecked(createSubPath(path));
+ }
- @Override
+ @Override
public boolean getElementGrayed(TreePath path) {
- return SubTreeModelViewer.this.getElementGrayed(createSubPath(path));
- }
+ return SubTreeModelViewer.this.getElementGrayed(createSubPath(path));
+ }
- @Override
+ @Override
public void setElementChecked(TreePath path, boolean checked, boolean grayed) {
- SubTreeModelViewer.this.setElementChecked(createSubPath(path), checked, grayed);
- }
- }
+ SubTreeModelViewer.this.setElementChecked(createSubPath(path), checked, grayed);
+ }
+ }
- /**
- * Delegating content provider. It translates all the calls to the
- * underlying content provider to use full model tree paths.
- */
- private class SubTreeModelContentProvider implements ITreeModelContentProvider {
+ /**
+ * Delegating content provider. It translates all the calls to the
+ * underlying content provider to use full model tree paths.
+ */
+ private class SubTreeModelContentProvider implements ITreeModelContentProvider {
- private TreeModelContentProvider fBaseProvider;
+ private TreeModelContentProvider fBaseProvider;
- public SubTreeModelContentProvider() {
- fBaseProvider = new TreeModelContentProvider();
- }
+ public SubTreeModelContentProvider() {
+ fBaseProvider = new TreeModelContentProvider();
+ }
- @Override
+ @Override
public void updateHasChildren(TreePath path) {
- fBaseProvider.updateHasChildren(createFullPath(path));
- }
+ fBaseProvider.updateHasChildren(createFullPath(path));
+ }
- @Override
+ @Override
public void updateChildCount(TreePath path, int currentChildCount) {
- fBaseProvider.updateChildCount(createFullPath(path), currentChildCount);
- }
+ fBaseProvider.updateChildCount(createFullPath(path), currentChildCount);
+ }
- @Override
+ @Override
public void updateElement(TreePath parentPath, int viewIndex) {
- fBaseProvider.updateElement(createFullPath(parentPath), viewIndex);
- }
+ fBaseProvider.updateElement(createFullPath(parentPath), viewIndex);
+ }
- @Override
+ @Override
public int viewToModelCount(TreePath parentPath, int count) {
- return fBaseProvider.viewToModelCount(createFullPath(parentPath), count);
- }
+ return fBaseProvider.viewToModelCount(createFullPath(parentPath), count);
+ }
- @Override
+ @Override
public int viewToModelIndex(TreePath parentPath, int index) {
- return fBaseProvider.viewToModelIndex(createFullPath(parentPath), index);
- }
+ return fBaseProvider.viewToModelIndex(createFullPath(parentPath), index);
+ }
- @Override
+ @Override
public void addModelChangedListener(IModelChangedListener listener) {
- fBaseProvider.addModelChangedListener(listener);
- }
+ fBaseProvider.addModelChangedListener(listener);
+ }
- @Override
+ @Override
public void preserveState(TreePath subPath) {
- fBaseProvider.preserveState(createFullPath(subPath));
- }
+ fBaseProvider.preserveState(createFullPath(subPath));
+ }
- @Override
+ @Override
public void addStateUpdateListener(IStateUpdateListener listener) {
- fBaseProvider.addStateUpdateListener(listener);
- }
+ fBaseProvider.addStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void addViewerUpdateListener(IViewerUpdateListener listener) {
- fBaseProvider.addViewerUpdateListener(listener);
- }
+ fBaseProvider.addViewerUpdateListener(listener);
+ }
- @Override
+ @Override
public int getModelDeltaMask() {
- return fBaseProvider.getModelDeltaMask();
- }
+ return fBaseProvider.getModelDeltaMask();
+ }
- @Override
+ @Override
public int modelToViewChildCount(TreePath parentPath, int count) {
- return fBaseProvider.modelToViewChildCount(createFullPath(parentPath), count);
- }
+ return fBaseProvider.modelToViewChildCount(createFullPath(parentPath), count);
+ }
- @Override
+ @Override
public int modelToViewIndex(TreePath parentPath, int index) {
- return fBaseProvider.modelToViewIndex(createFullPath(parentPath), index);
- }
+ return fBaseProvider.modelToViewIndex(createFullPath(parentPath), index);
+ }
- @Override
+ @Override
public void removeModelChangedListener(IModelChangedListener listener) {
- fBaseProvider.removeModelChangedListener(listener);
- }
+ fBaseProvider.removeModelChangedListener(listener);
+ }
- @Override
+ @Override
public void removeStateUpdateListener(IStateUpdateListener listener) {
- fBaseProvider.removeStateUpdateListener(listener);
- }
+ fBaseProvider.removeStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {
- fBaseProvider.removeViewerUpdateListener(listener);
- }
+ fBaseProvider.removeViewerUpdateListener(listener);
+ }
- @Override
+ @Override
public void setModelDeltaMask(int mask) {
- fBaseProvider.setModelDeltaMask(mask);
- }
+ fBaseProvider.setModelDeltaMask(mask);
+ }
- @Override
+ @Override
public boolean areTreeModelViewerFiltersApplicable(Object parentElement) {
- return fBaseProvider.areTreeModelViewerFiltersApplicable(parentElement);
- }
+ return fBaseProvider.areTreeModelViewerFiltersApplicable(parentElement);
+ }
- @Override
+ @Override
public boolean shouldFilter(Object parentElementOrTreePath, Object element) {
- if (parentElementOrTreePath instanceof TreePath) {
- TreePath path = (TreePath)parentElementOrTreePath;
- return fBaseProvider.shouldFilter(createFullPath(path), element);
- } else {
- return fBaseProvider.shouldFilter(parentElementOrTreePath, element);
- }
+ if (parentElementOrTreePath instanceof TreePath) {
+ TreePath path = (TreePath)parentElementOrTreePath;
+ return fBaseProvider.shouldFilter(createFullPath(path), element);
+ } else {
+ return fBaseProvider.shouldFilter(parentElementOrTreePath, element);
+ }
- }
+ }
- @Override
+ @Override
public void unmapPath(TreePath path) {
- fBaseProvider.unmapPath(createFullPath(path));
- }
+ fBaseProvider.unmapPath(createFullPath(path));
+ }
- @Override
+ @Override
public void updateModel(IModelDelta delta, int mask) {
- fBaseProvider.updateModel(delta, mask);
- }
+ fBaseProvider.updateModel(delta, mask);
+ }
- @Override
+ @Override
public TreePath[] getParents(Object element) {
- // Not used
- return null;
- }
+ // Not used
+ return null;
+ }
- @Override
+ @Override
public void cancelRestore(TreePath path, int flags) {
- fBaseProvider.cancelRestore(createFullPath(path), flags);
- }
+ fBaseProvider.cancelRestore(createFullPath(path), flags);
+ }
- @Override
+ @Override
public void dispose() {
- fBaseProvider.dispose();
- }
+ fBaseProvider.dispose();
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- fBaseProvider.inputChanged(fDelegatingViewer, oldInput, newInput);
- }
+ fBaseProvider.inputChanged(fDelegatingViewer, oldInput, newInput);
+ }
@Override
public void postInputChanged(IInternalTreeModelViewer viewer,
@@ -591,125 +591,125 @@ public class SubTreeModelViewer extends TreeModelViewer {
fBaseProvider.postInputChanged(viewer, oldInput, newInput);
}
- @Override
+ @Override
public boolean setChecked(TreePath path, boolean checked) {
- return fBaseProvider.setChecked(createFullPath(path), checked);
- }
+ return fBaseProvider.setChecked(createFullPath(path), checked);
+ }
- }
+ }
- /**
- * Delegating label provider. It translates all the calls to the
- * underlying label provider to use full model tree paths.
- */
- private class SubTreeModelLabelProvider extends ColumnLabelProvider
- implements ITreeModelLabelProvider
- {
+ /**
+ * Delegating label provider. It translates all the calls to the
+ * underlying label provider to use full model tree paths.
+ */
+ private class SubTreeModelLabelProvider extends ColumnLabelProvider
+ implements ITreeModelLabelProvider
+ {
- private TreeModelLabelProvider fBaseProvider;
+ private TreeModelLabelProvider fBaseProvider;
- public SubTreeModelLabelProvider(IInternalTreeModelViewer viewer) {
- fBaseProvider = new TreeModelLabelProvider(viewer);
- }
+ public SubTreeModelLabelProvider(IInternalTreeModelViewer viewer) {
+ fBaseProvider = new TreeModelLabelProvider(viewer);
+ }
- @Override
+ @Override
public boolean update(TreePath elementPath) {
- return fBaseProvider.update( createFullPath(elementPath) );
- }
+ return fBaseProvider.update( createFullPath(elementPath) );
+ }
- @Override
+ @Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {
- fBaseProvider.addLabelUpdateListener(listener);
- }
+ fBaseProvider.addLabelUpdateListener(listener);
+ }
- @Override
+ @Override
public Color getColor(RGB rgb) {
- return fBaseProvider.getColor(rgb);
- }
+ return fBaseProvider.getColor(rgb);
+ }
- @Override
+ @Override
public Font getFont(FontData fontData) {
- return fBaseProvider.getFont(fontData);
- }
+ return fBaseProvider.getFont(fontData);
+ }
- @Override
+ @Override
public Image getImage(ImageDescriptor descriptor) {
- return fBaseProvider.getImage(descriptor);
- }
+ return fBaseProvider.getImage(descriptor);
+ }
- @Override
+ @Override
public void removeLabelUpdateListener(ILabelUpdateListener listener) {
- fBaseProvider.removeLabelUpdateListener(listener);
- }
+ fBaseProvider.removeLabelUpdateListener(listener);
+ }
- @Override
+ @Override
public void addListener(ILabelProviderListener listener) {
- fBaseProvider.addListener(listener);
- }
+ fBaseProvider.addListener(listener);
+ }
- @Override
+ @Override
public void dispose() {
- fBaseProvider.dispose();
- super.dispose();
- }
+ fBaseProvider.dispose();
+ super.dispose();
+ }
- @Override
+ @Override
public boolean isLabelProperty(Object element, String property) {
- return fBaseProvider.isLabelProperty(element, property);
- }
+ return fBaseProvider.isLabelProperty(element, property);
+ }
- @Override
+ @Override
public void removeListener(ILabelProviderListener listener) {
- fBaseProvider.removeListener(listener);
- }
- }
-
- private TreePath createFullPath(TreePath subPath) {
- if (fRootPath == null) {
- return TreePath.EMPTY;
- }
-
- Object[] segments = new Object[fRootPath.getSegmentCount() + subPath.getSegmentCount()];
- for (int i = 0; i < fRootPath.getSegmentCount(); i++) {
- segments[i] = fRootPath.getSegment(i);
- }
- for (int i = 0; i < subPath.getSegmentCount(); i++) {
- segments[i + fRootPath.getSegmentCount()] = subPath.getSegment(i);
- }
- return new TreePath(segments);
- }
-
- private TreePath createSubPath(TreePath fullPath) {
- if (fRootPath == null) {
- return TreePath.EMPTY;
- }
-
- if (fullPath.getSegmentCount() <= fRootPath.getSegmentCount()) {
- return TreePath.EMPTY;
- }
- Object[] segments = new Object[fullPath.getSegmentCount() - fRootPath.getSegmentCount()];
- for (int i = 0; i < segments.length; i++) {
- segments[i] = fullPath.getSegment(i + fRootPath.getSegmentCount());
- }
- return new TreePath(segments);
- }
-
- private DelegatingTreeModelViewer getDelegatingViewer() {
- if (fDelegatingViewer == null) {
- fDelegatingViewer = new DelegatingTreeModelViewer();
- }
- return fDelegatingViewer;
- }
-
- @Override
+ fBaseProvider.removeListener(listener);
+ }
+ }
+
+ private TreePath createFullPath(TreePath subPath) {
+ if (fRootPath == null) {
+ return TreePath.EMPTY;
+ }
+
+ Object[] segments = new Object[fRootPath.getSegmentCount() + subPath.getSegmentCount()];
+ for (int i = 0; i < fRootPath.getSegmentCount(); i++) {
+ segments[i] = fRootPath.getSegment(i);
+ }
+ for (int i = 0; i < subPath.getSegmentCount(); i++) {
+ segments[i + fRootPath.getSegmentCount()] = subPath.getSegment(i);
+ }
+ return new TreePath(segments);
+ }
+
+ private TreePath createSubPath(TreePath fullPath) {
+ if (fRootPath == null) {
+ return TreePath.EMPTY;
+ }
+
+ if (fullPath.getSegmentCount() <= fRootPath.getSegmentCount()) {
+ return TreePath.EMPTY;
+ }
+ Object[] segments = new Object[fullPath.getSegmentCount() - fRootPath.getSegmentCount()];
+ for (int i = 0; i < segments.length; i++) {
+ segments[i] = fullPath.getSegment(i + fRootPath.getSegmentCount());
+ }
+ return new TreePath(segments);
+ }
+
+ private DelegatingTreeModelViewer getDelegatingViewer() {
+ if (fDelegatingViewer == null) {
+ fDelegatingViewer = new DelegatingTreeModelViewer();
+ }
+ return fDelegatingViewer;
+ }
+
+ @Override
protected ITreeModelContentProvider createContentProvider() {
- return new SubTreeModelContentProvider();
- }
+ return new SubTreeModelContentProvider();
+ }
- @Override
+ @Override
protected ITreeModelLabelProvider createLabelProvider() {
- return new SubTreeModelLabelProvider(getDelegatingViewer());
- }
+ return new SubTreeModelLabelProvider(getDelegatingViewer());
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java
index 22bc2da8e..38b2c2903 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TimeTriggeredProgressMonitorDialog.java
@@ -69,94 +69,94 @@ public class TimeTriggeredProgressMonitorDialog extends ProgressMonitorDialog {
this.longOperationTime = longOperationTime;
}
- /**
+ /**
* Create a monitor for the receiver that wrappers the superclasses monitor.
*
*/
- public void createWrapperedMonitor() {
- wrapperedMonitor = new IProgressMonitor() {
+ public void createWrapperedMonitor() {
+ wrapperedMonitor = new IProgressMonitor() {
- IProgressMonitor superMonitor = TimeTriggeredProgressMonitorDialog.super
- .getProgressMonitor();
+ IProgressMonitor superMonitor = TimeTriggeredProgressMonitorDialog.super
+ .getProgressMonitor();
- @Override
+ @Override
public void beginTask(String name, int totalWork) {
- superMonitor.beginTask(name, totalWork);
- checkTicking();
- }
+ superMonitor.beginTask(name, totalWork);
+ checkTicking();
+ }
- /**
+ /**
* Check if we have ticked in the last 800ms.
*/
- private void checkTicking() {
- if (triggerTime < 0) {
+ private void checkTicking() {
+ if (triggerTime < 0) {
triggerTime = System.currentTimeMillis() + longOperationTime;
}
- if (!dialogOpened && System.currentTimeMillis() > triggerTime) {
- open();
- dialogOpened = true;
- }
- }
+ if (!dialogOpened && System.currentTimeMillis() > triggerTime) {
+ open();
+ dialogOpened = true;
+ }
+ }
- @Override
+ @Override
public void done() {
- superMonitor.done();
- checkTicking();
- }
+ superMonitor.done();
+ checkTicking();
+ }
- @Override
+ @Override
public void internalWorked(double work) {
- superMonitor.internalWorked(work);
- checkTicking();
- }
+ superMonitor.internalWorked(work);
+ checkTicking();
+ }
- @Override
+ @Override
public boolean isCanceled() {
- return superMonitor.isCanceled();
- }
+ return superMonitor.isCanceled();
+ }
- @Override
+ @Override
public void setCanceled(boolean value) {
- superMonitor.setCanceled(value);
+ superMonitor.setCanceled(value);
- }
+ }
- @Override
+ @Override
public void setTaskName(String name) {
- superMonitor.setTaskName(name);
- checkTicking();
+ superMonitor.setTaskName(name);
+ checkTicking();
- }
+ }
- @Override
+ @Override
public void subTask(String name) {
- superMonitor.subTask(name);
- checkTicking();
- }
+ superMonitor.subTask(name);
+ checkTicking();
+ }
- @Override
+ @Override
public void worked(int work) {
- superMonitor.worked(work);
- checkTicking();
+ superMonitor.worked(work);
+ checkTicking();
- }
- };
- }
+ }
+ };
+ }
- @Override
+ @Override
public IProgressMonitor getProgressMonitor() {
- if (wrapperedMonitor == null) {
+ if (wrapperedMonitor == null) {
createWrapperedMonitor();
}
- return wrapperedMonitor;
- }
+ return wrapperedMonitor;
+ }
- @Override
+ @Override
public void run(final boolean fork, final boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
- final InvocationTargetException[] invokes = new InvocationTargetException[1];
- final InterruptedException[] interrupt = new InterruptedException[1];
+ final IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+ final InvocationTargetException[] invokes = new InvocationTargetException[1];
+ final InterruptedException[] interrupt = new InterruptedException[1];
Runnable dialogWaitRunnable = () -> {
try {
TimeTriggeredProgressMonitorDialog.super.run(fork, cancelable, runnable);
@@ -166,17 +166,17 @@ public class TimeTriggeredProgressMonitorDialog extends ProgressMonitorDialog {
interrupt[0] = e2;
}
};
- final Display display = PlatformUI.getWorkbench().getDisplay();
- if (display == null) {
+ final Display display = PlatformUI.getWorkbench().getDisplay();
+ if (display == null) {
return;
}
- //show a busy cursor until the dialog opens
- BusyIndicator.showWhile(display, dialogWaitRunnable);
- if (invokes[0] != null) {
- throw invokes[0];
- }
- if (interrupt[0] != null) {
- throw interrupt[0];
- }
- }
+ //show a busy cursor until the dialog opens
+ BusyIndicator.showWhile(display, dialogWaitRunnable);
+ if (invokes[0] != null) {
+ throw invokes[0];
+ }
+ if (interrupt[0] != null) {
+ throw interrupt[0];
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
index 4608c48b0..80c487b76 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
@@ -67,327 +67,327 @@ import org.eclipse.ui.progress.WorkbenchJob;
*/
public class TreeModelContentProvider implements ITreeModelContentProvider, IContentProvider, IModelChangedListener {
- /**
- * Tree model viewer that this content provider is used with.
- */
- private IInternalTreeModelViewer fViewer;
-
- /**
- * Mask used to filter delta updates coming from the model.
- */
- private int fModelDeltaMask = ~0;
-
- /**
- * Map tree paths to model proxy responsible for element
- *
- * Used to install different model proxy instances for one element depending
- * on the tree path.
- */
+ /**
+ * Tree model viewer that this content provider is used with.
+ */
+ private IInternalTreeModelViewer fViewer;
+
+ /**
+ * Mask used to filter delta updates coming from the model.
+ */
+ private int fModelDeltaMask = ~0;
+
+ /**
+ * Map tree paths to model proxy responsible for element
+ *
+ * Used to install different model proxy instances for one element depending
+ * on the tree path.
+ */
private Map<TreePath, IModelProxy> fTreeModelProxies = new HashMap<>(); // tree
// model
// proxy
// by
// element tree path
- /**
- * Map element to model proxy responsible for it.
- *
- * Used to install a single model proxy which is responsible for all
- * instances of an element in the model tree.
- */
+ /**
+ * Map element to model proxy responsible for it.
+ *
+ * Used to install a single model proxy which is responsible for all
+ * instances of an element in the model tree.
+ */
private Map<Object, IModelProxy> fModelProxies = new HashMap<>(); // model
// proxy
// by
// element
- /**
- * Map of nodes that have been filtered from the viewer.
- */
- private FilterTransform fTransform = new FilterTransform();
+ /**
+ * Map of nodes that have been filtered from the viewer.
+ */
+ private FilterTransform fTransform = new FilterTransform();
- /**
- * Model listeners
- */
+ /**
+ * Model listeners
+ */
private ListenerList<IModelChangedListener> fModelListeners = new ListenerList<>();
- /**
- * Viewer update listeners
- */
+ /**
+ * Viewer update listeners
+ */
private ListenerList<IViewerUpdateListener> fUpdateListeners = new ListenerList<>();
- /**
- * Flag indicating whether we are currently in a model sequence.
- * @see IViewerUpdateListener
- */
- private boolean fModelSequenceRunning = false;
+ /**
+ * Flag indicating whether we are currently in a model sequence.
+ * @see IViewerUpdateListener
+ */
+ private boolean fModelSequenceRunning = false;
- /**
- * Map of updates in progress: element path -> list of requests
- */
+ /**
+ * Map of updates in progress: element path -> list of requests
+ */
private Map<TreePath, List<ViewerUpdateMonitor>> fRequestsInProgress = new HashMap<>();
- /**
- * Map of dependent requests waiting for parent requests to complete:
- * element path -> list of requests
- */
+ /**
+ * Map of dependent requests waiting for parent requests to complete:
+ * element path -> list of requests
+ */
private Map<TreePath, List<ViewerUpdateMonitor>> fWaitingRequests = new HashMap<>();
private List<ViewerUpdateMonitor> fCompletedUpdates = new ArrayList<>();
- private Runnable fCompletedUpdatesRunnable;
+ private Runnable fCompletedUpdatesRunnable;
- private ViewerStateTracker fStateTracker = new ViewerStateTracker(this);
+ private ViewerStateTracker fStateTracker = new ViewerStateTracker(this);
private TreePath fRevealPath;
private int fRevealIndex;
- /**
- * Update type constants
- */
- static final int UPDATE_SEQUENCE_BEGINS = 0;
+ /**
+ * Update type constants
+ */
+ static final int UPDATE_SEQUENCE_BEGINS = 0;
- static final int UPDATE_SEQUENCE_COMPLETE = 1;
+ static final int UPDATE_SEQUENCE_COMPLETE = 1;
- static final int UPDATE_BEGINS = 2;
+ static final int UPDATE_BEGINS = 2;
- static final int UPDATE_COMPLETE = 3;
+ static final int UPDATE_COMPLETE = 3;
- /**
- * Constant for an empty tree path.
- */
- static final TreePath EMPTY_TREE_PATH = new TreePath(new Object[] {});
+ /**
+ * Constant for an empty tree path.
+ */
+ static final TreePath EMPTY_TREE_PATH = new TreePath(new Object[] {});
- @Override
+ @Override
public void dispose() {
- if (fViewer == null) {
+ if (fViewer == null) {
return;
}
fDelayedDoModelChangeJob.shutdown();
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- // cancel pending updates
+ // cancel pending updates
for (List<ViewerUpdateMonitor> requests : fRequestsInProgress.values()) {
for (ViewerUpdateMonitor vu : requests) {
vu.cancel();
- }
- }
- fWaitingRequests.clear();
-
- fStateTracker.dispose();
- fModelListeners.clear();
- fUpdateListeners.clear();
- disposeAllModelProxies();
-
- synchronized(this) {
- fViewer = null;
- }
- }
-
- /**
- * @return Returns whether the content provider is disposed.
- */
- boolean isDisposed() {
- synchronized(this) {
- return fViewer == null;
- }
- }
-
- @Override
+ }
+ }
+ fWaitingRequests.clear();
+
+ fStateTracker.dispose();
+ fModelListeners.clear();
+ fUpdateListeners.clear();
+ disposeAllModelProxies();
+
+ synchronized(this) {
+ fViewer = null;
+ }
+ }
+
+ /**
+ * @return Returns whether the content provider is disposed.
+ */
+ boolean isDisposed() {
+ synchronized(this) {
+ return fViewer == null;
+ }
+ }
+
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- synchronized(this) {
- fViewer = (IInternalTreeModelViewer) viewer;
- }
+ synchronized(this) {
+ fViewer = (IInternalTreeModelViewer) viewer;
+ }
- Assert.isTrue( fViewer.getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( fViewer.getDisplay().getThread() == Thread.currentThread() );
- if (oldInput != null) {
- fStateTracker.saveViewerState(oldInput);
- }
- }
+ if (oldInput != null) {
+ fStateTracker.saveViewerState(oldInput);
+ }
+ }
- @Override
+ @Override
public void postInputChanged(IInternalTreeModelViewer viewer, Object oldInput, Object newInput) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- cancelSubtreeUpdates(TreePath.EMPTY);
- disposeAllModelProxies();
- cancelSubtreeUpdates(TreePath.EMPTY);
- fTransform.clear();
- if (newInput != null) {
- installModelProxy(newInput, TreePath.EMPTY);
- fStateTracker.restoreViewerState(newInput);
- }
- }
-
- @Override
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ cancelSubtreeUpdates(TreePath.EMPTY);
+ disposeAllModelProxies();
+ cancelSubtreeUpdates(TreePath.EMPTY);
+ fTransform.clear();
+ if (newInput != null) {
+ installModelProxy(newInput, TreePath.EMPTY);
+ fStateTracker.restoreViewerState(newInput);
+ }
+ }
+
+ @Override
public void addViewerUpdateListener(IViewerUpdateListener listener) {
- fUpdateListeners.add(listener);
- }
+ fUpdateListeners.add(listener);
+ }
- @Override
+ @Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {
- fUpdateListeners.remove(listener);
- }
+ fUpdateListeners.remove(listener);
+ }
- @Override
+ @Override
public void addStateUpdateListener(IStateUpdateListener listener) {
- fStateTracker.addStateUpdateListener(listener);
- }
+ fStateTracker.addStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void preserveState(TreePath path) {
- fStateTracker.appendToPendingStateDelta(path);
- }
+ fStateTracker.appendToPendingStateDelta(path);
+ }
- @Override
+ @Override
public void removeStateUpdateListener(IStateUpdateListener listener) {
- fStateTracker.removeStateUpdateListener(listener);
- }
+ fStateTracker.removeStateUpdateListener(listener);
+ }
- @Override
+ @Override
public void addModelChangedListener(IModelChangedListener listener) {
- fModelListeners.add(listener);
- }
+ fModelListeners.add(listener);
+ }
- @Override
+ @Override
public void removeModelChangedListener(IModelChangedListener listener) {
- fModelListeners.remove(listener);
- }
+ fModelListeners.remove(listener);
+ }
- @Override
+ @Override
public void cancelRestore(final TreePath path, final int flags) {
- fStateTracker.cancelRestore(path, flags);
- }
+ fStateTracker.cancelRestore(path, flags);
+ }
- @Override
+ @Override
public boolean setChecked(TreePath path, boolean checked) {
- IModelProxy elementProxy = getElementProxy(path);
- if (elementProxy instanceof ICheckboxModelProxy) {
- return ((ICheckboxModelProxy) elementProxy).setChecked(getPresentationContext(), getViewer().getInput(), path, checked);
- }
- return false;
- }
-
- /**
- * Installs the model proxy for the given element into this content provider
- * if not already installed.
- * @param input the input to install the model proxy on
- * @param path the {@link TreePath} to install the proxy for
- */
- private void installModelProxy(Object input, TreePath path) {
-
- if (!fTreeModelProxies.containsKey(path) && !fModelProxies.containsKey(path.getLastSegment())) {
- Object element = path.getSegmentCount() != 0 ? path.getLastSegment() : input;
- IModelProxy proxy = null;
- IModelProxyFactory2 modelProxyFactory2 = ViewerAdapterService.getModelProxyFactory2(element);
- if (modelProxyFactory2 != null) {
- proxy = modelProxyFactory2.createTreeModelProxy(input, path, getPresentationContext());
- if (proxy != null) {
- fTreeModelProxies.put(path, proxy);
- }
- }
- if (proxy == null) {
- IModelProxyFactory modelProxyFactory = ViewerAdapterService.getModelProxyFactory(element);
- if (modelProxyFactory != null) {
- proxy = modelProxyFactory.createModelProxy(element, getPresentationContext());
- if (proxy != null) {
- fModelProxies.put(element, proxy);
- }
- }
- }
-
- if (proxy instanceof IModelProxy2) {
- proxy.addModelChangedListener(this);
- ((IModelProxy2)proxy).initialize(getViewer());
- } else if (proxy != null) {
- final IModelProxy finalProxy = proxy;
- Job job = new Job("Model Proxy installed notification job") {//$NON-NLS-1$
- @Override
+ IModelProxy elementProxy = getElementProxy(path);
+ if (elementProxy instanceof ICheckboxModelProxy) {
+ return ((ICheckboxModelProxy) elementProxy).setChecked(getPresentationContext(), getViewer().getInput(), path, checked);
+ }
+ return false;
+ }
+
+ /**
+ * Installs the model proxy for the given element into this content provider
+ * if not already installed.
+ * @param input the input to install the model proxy on
+ * @param path the {@link TreePath} to install the proxy for
+ */
+ private void installModelProxy(Object input, TreePath path) {
+
+ if (!fTreeModelProxies.containsKey(path) && !fModelProxies.containsKey(path.getLastSegment())) {
+ Object element = path.getSegmentCount() != 0 ? path.getLastSegment() : input;
+ IModelProxy proxy = null;
+ IModelProxyFactory2 modelProxyFactory2 = ViewerAdapterService.getModelProxyFactory2(element);
+ if (modelProxyFactory2 != null) {
+ proxy = modelProxyFactory2.createTreeModelProxy(input, path, getPresentationContext());
+ if (proxy != null) {
+ fTreeModelProxies.put(path, proxy);
+ }
+ }
+ if (proxy == null) {
+ IModelProxyFactory modelProxyFactory = ViewerAdapterService.getModelProxyFactory(element);
+ if (modelProxyFactory != null) {
+ proxy = modelProxyFactory.createModelProxy(element, getPresentationContext());
+ if (proxy != null) {
+ fModelProxies.put(element, proxy);
+ }
+ }
+ }
+
+ if (proxy instanceof IModelProxy2) {
+ proxy.addModelChangedListener(this);
+ ((IModelProxy2)proxy).initialize(getViewer());
+ } else if (proxy != null) {
+ final IModelProxy finalProxy = proxy;
+ Job job = new Job("Model Proxy installed notification job") {//$NON-NLS-1$
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- if (!monitor.isCanceled()) {
- IPresentationContext context = null;
- Viewer viewer = null;
- synchronized (TreeModelContentProvider.this) {
- if (!isDisposed()) {
- context = getPresentationContext();
- viewer = (Viewer) getViewer();
- }
- }
- if (viewer != null && context != null && !finalProxy.isDisposed()) {
- finalProxy.init(context);
- finalProxy.addModelChangedListener(TreeModelContentProvider.this);
- finalProxy.installed(viewer);
- }
- }
- return Status.OK_STATUS;
- }
-
- @Override
+ if (!monitor.isCanceled()) {
+ IPresentationContext context = null;
+ Viewer viewer = null;
+ synchronized (TreeModelContentProvider.this) {
+ if (!isDisposed()) {
+ context = getPresentationContext();
+ viewer = (Viewer) getViewer();
+ }
+ }
+ if (viewer != null && context != null && !finalProxy.isDisposed()) {
+ finalProxy.init(context);
+ finalProxy.addModelChangedListener(TreeModelContentProvider.this);
+ finalProxy.installed(viewer);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
public boolean shouldRun() {
- return !isDisposed();
- }
- };
- job.setSystem(true);
- job.schedule();
- }
- }
- }
-
- /**
- * Finds the model proxy that an element with a given path is associated with.
- * @param path Path of the element.
- * @return Element's model proxy.
- */
- private IModelProxy getElementProxy(TreePath path) {
- while (path != null) {
- IModelProxy proxy = fTreeModelProxies.get(path);
- if (proxy != null) {
- return proxy;
- }
-
- Object element = path.getSegmentCount() == 0 ? getViewer().getInput() : path.getLastSegment();
- proxy = fModelProxies.get(element);
- if (proxy != null) {
- return proxy;
- }
-
- path = path.getParentPath();
- }
- return null;
- }
-
- /**
- * Removes all model proxies
- */
- private void disposeAllModelProxies() {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ return !isDisposed();
+ }
+ };
+ job.setSystem(true);
+ job.schedule();
+ }
+ }
+ }
+
+ /**
+ * Finds the model proxy that an element with a given path is associated with.
+ * @param path Path of the element.
+ * @return Element's model proxy.
+ */
+ private IModelProxy getElementProxy(TreePath path) {
+ while (path != null) {
+ IModelProxy proxy = fTreeModelProxies.get(path);
+ if (proxy != null) {
+ return proxy;
+ }
+
+ Object element = path.getSegmentCount() == 0 ? getViewer().getInput() : path.getLastSegment();
+ proxy = fModelProxies.get(element);
+ if (proxy != null) {
+ return proxy;
+ }
+
+ path = path.getParentPath();
+ }
+ return null;
+ }
+
+ /**
+ * Removes all model proxies
+ */
+ private void disposeAllModelProxies() {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
for (IModelProxy proxy : fModelProxies.values()) {
- proxy.dispose();
- }
- fModelProxies.clear();
+ proxy.dispose();
+ }
+ fModelProxies.clear();
for (IModelProxy proxy : fTreeModelProxies.values()) {
- proxy.dispose();
- }
- fTreeModelProxies.clear();
- }
-
- /**
- * Removes the model proxy installed for the given element, if any.
- * @param path the {@link TreePath} to dispose the model proxy for
- */
- private void disposeModelProxy(TreePath path) {
- IModelProxy proxy = fTreeModelProxies.remove(path);
- if (proxy != null) {
- proxy.dispose();
- }
- proxy = fModelProxies.remove(path.getLastSegment());
- if (proxy != null) {
- proxy.dispose();
- }
- }
+ proxy.dispose();
+ }
+ fTreeModelProxies.clear();
+ }
+
+ /**
+ * Removes the model proxy installed for the given element, if any.
+ * @param path the {@link TreePath} to dispose the model proxy for
+ */
+ private void disposeModelProxy(TreePath path) {
+ IModelProxy proxy = fTreeModelProxies.remove(path);
+ if (proxy != null) {
+ proxy.dispose();
+ }
+ proxy = fModelProxies.remove(path.getLastSegment());
+ if (proxy != null) {
+ proxy.dispose();
+ }
+ }
private static class DelayedDoModelChange {
public final IModelDelta delta;
@@ -488,280 +488,280 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
private final DelayedDoModelChangedJob fDelayedDoModelChangeJob = new DelayedDoModelChangedJob();
- @Override
+ @Override
public void modelChanged(final IModelDelta delta, final IModelProxy proxy) {
- Display display = null;
-
- // Check if the viewer is still available, i.e. if the content provider
- // is not disposed.
- synchronized(this) {
- if (fViewer != null && !proxy.isDisposed()) {
- display = fViewer.getDisplay();
- }
- }
- if (display != null) {
- // If we're in display thread, process the delta immediately to
- // avoid "skid" in processing events.
- if (Thread.currentThread().equals(display.getThread())) {
- doModelChanged(delta, proxy);
- }
- else {
+ Display display = null;
+
+ // Check if the viewer is still available, i.e. if the content provider
+ // is not disposed.
+ synchronized(this) {
+ if (fViewer != null && !proxy.isDisposed()) {
+ display = fViewer.getDisplay();
+ }
+ }
+ if (display != null) {
+ // If we're in display thread, process the delta immediately to
+ // avoid "skid" in processing events.
+ if (Thread.currentThread().equals(display.getThread())) {
+ doModelChanged(delta, proxy);
+ }
+ else {
try {
Job.getJobManager().join(ElementContentProvider.class, null);
} catch (OperationCanceledException | InterruptedException e) {
DebugUIPlugin.log(new Status(IStatus.WARNING, DebugUIPlugin.getUniqueIdentifier(), "Interrupted while waiting on ElementContentProvider jobs", e)); //$NON-NLS-1$
}
fDelayedDoModelChangeJob.runDelayed(delta, proxy);
- }
- }
- }
-
- /**
- * Executes the model proxy in UI thread.
- * @param delta Delta to process
- * @param proxy Proxy that fired the delta.
- */
- private void doModelChanged(IModelDelta delta, IModelProxy proxy) {
- if (!proxy.isDisposed()) {
- if (DebugUIPlugin.DEBUG_DELTAS && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("RECEIVED DELTA: " + delta.toString()); //$NON-NLS-1$
- }
-
- updateModel(delta, getModelDeltaMask());
-
- // Initiate model update sequence before notifying of the model changed.
- trigger(null);
-
- // Call model listeners after updating the viewer model.
+ }
+ }
+ }
+
+ /**
+ * Executes the model proxy in UI thread.
+ * @param delta Delta to process
+ * @param proxy Proxy that fired the delta.
+ */
+ private void doModelChanged(IModelDelta delta, IModelProxy proxy) {
+ if (!proxy.isDisposed()) {
+ if (DebugUIPlugin.DEBUG_DELTAS && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("RECEIVED DELTA: " + delta.toString()); //$NON-NLS-1$
+ }
+
+ updateModel(delta, getModelDeltaMask());
+
+ // Initiate model update sequence before notifying of the model changed.
+ trigger(null);
+
+ // Call model listeners after updating the viewer model.
for (IModelChangedListener iModelChangedListener : fModelListeners) {
iModelChangedListener.modelChanged(delta, proxy);
}
- }
- }
+ }
+ }
- @Override
+ @Override
public void setModelDeltaMask(int mask) {
- fModelDeltaMask = mask;
- }
+ fModelDeltaMask = mask;
+ }
- @Override
+ @Override
public int getModelDeltaMask() {
- return fModelDeltaMask;
- }
+ return fModelDeltaMask;
+ }
- @Override
+ @Override
public void updateModel(IModelDelta delta, int mask) {
- // Processing deltas with null input leads to NPEs
- // (Bug 380288 - NPE switching to the Breakpoints View)
- if (getViewer() == null || getViewer().getInput() == null) {
+ // Processing deltas with null input leads to NPEs
+ // (Bug 380288 - NPE switching to the Breakpoints View)
+ if (getViewer() == null || getViewer().getInput() == null) {
return;
}
fRevealPath = null;
- IModelDelta[] deltaArray = new IModelDelta[] { delta };
- updateNodes(deltaArray, mask & (IModelDelta.REMOVED | IModelDelta.UNINSTALL));
- updateNodes(deltaArray, mask & ITreeModelContentProvider.UPDATE_MODEL_DELTA_FLAGS
- & ~(IModelDelta.REMOVED | IModelDelta.UNINSTALL));
- updateNodes(deltaArray, mask & ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS);
-
- fStateTracker.checkIfRestoreComplete();
- }
-
- /**
- * Returns a tree path for the node including the root element.
- *
- * @param node
- * model delta
- * @return corresponding tree path
- */
- TreePath getFullTreePath(IModelDelta node) {
+ IModelDelta[] deltaArray = new IModelDelta[] { delta };
+ updateNodes(deltaArray, mask & (IModelDelta.REMOVED | IModelDelta.UNINSTALL));
+ updateNodes(deltaArray, mask & ITreeModelContentProvider.UPDATE_MODEL_DELTA_FLAGS
+ & ~(IModelDelta.REMOVED | IModelDelta.UNINSTALL));
+ updateNodes(deltaArray, mask & ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS);
+
+ fStateTracker.checkIfRestoreComplete();
+ }
+
+ /**
+ * Returns a tree path for the node including the root element.
+ *
+ * @param node
+ * model delta
+ * @return corresponding tree path
+ */
+ TreePath getFullTreePath(IModelDelta node) {
ArrayList<Object> list = new ArrayList<>();
- while (node.getParentDelta() != null) {
- list.add(0, node.getElement());
- node = node.getParentDelta();
- }
- return new TreePath(list.toArray());
- }
-
- /**
- * Returns a tree path for the node, *not* including the root element.
- *
- * @param node
- * model delta
- * @return corresponding tree path
- */
- TreePath getViewerTreePath(IModelDelta node) {
+ while (node.getParentDelta() != null) {
+ list.add(0, node.getElement());
+ node = node.getParentDelta();
+ }
+ return new TreePath(list.toArray());
+ }
+
+ /**
+ * Returns a tree path for the node, *not* including the root element.
+ *
+ * @param node
+ * model delta
+ * @return corresponding tree path
+ */
+ TreePath getViewerTreePath(IModelDelta node) {
ArrayList<Object> list = new ArrayList<>();
- IModelDelta parentDelta = node.getParentDelta();
- while (parentDelta != null) {
- list.add(0, node.getElement());
- node = parentDelta;
- parentDelta = node.getParentDelta();
- }
- return new TreePath(list.toArray());
- }
-
- /**
- * Returns the viewer this content provider is working for.
- *
- * @return viewer
- */
- protected IInternalTreeModelViewer getViewer() {
- synchronized(this) {
- return fViewer;
- }
- }
-
- @Override
+ IModelDelta parentDelta = node.getParentDelta();
+ while (parentDelta != null) {
+ list.add(0, node.getElement());
+ node = parentDelta;
+ parentDelta = node.getParentDelta();
+ }
+ return new TreePath(list.toArray());
+ }
+
+ /**
+ * Returns the viewer this content provider is working for.
+ *
+ * @return viewer
+ */
+ protected IInternalTreeModelViewer getViewer() {
+ synchronized(this) {
+ return fViewer;
+ }
+ }
+
+ @Override
public int viewToModelIndex(TreePath parentPath, int index) {
- return fTransform.viewToModelIndex(parentPath, index);
- }
+ return fTransform.viewToModelIndex(parentPath, index);
+ }
- @Override
+ @Override
public int viewToModelCount(TreePath parentPath, int count) {
- return fTransform.viewToModelCount(parentPath, count);
- }
+ return fTransform.viewToModelCount(parentPath, count);
+ }
- @Override
+ @Override
public int modelToViewIndex(TreePath parentPath, int index) {
- return fTransform.modelToViewIndex(parentPath, index);
- }
+ return fTransform.modelToViewIndex(parentPath, index);
+ }
- @Override
+ @Override
public int modelToViewChildCount(TreePath parentPath, int count) {
- return fTransform.modelToViewCount(parentPath, count);
- }
+ return fTransform.modelToViewCount(parentPath, count);
+ }
- @Override
+ @Override
public boolean areTreeModelViewerFiltersApplicable(Object parentElement) {
- ViewerFilter[] filters = fViewer.getFilters();
- if (filters.length > 0) {
- for (int j = 0; j < filters.length; j++) {
- if (filters[j] instanceof TreeModelViewerFilter &&
- ((TreeModelViewerFilter)filters[j]).isApplicable(fViewer, parentElement))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
+ ViewerFilter[] filters = fViewer.getFilters();
+ if (filters.length > 0) {
+ for (int j = 0; j < filters.length; j++) {
+ if (filters[j] instanceof TreeModelViewerFilter &&
+ ((TreeModelViewerFilter)filters[j]).isApplicable(fViewer, parentElement))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
public boolean shouldFilter(Object parentElementOrTreePath, Object element) {
- ViewerFilter[] filters = fViewer.getFilters();
- if (filters.length > 0) {
- for (int j = 0; j < filters.length; j++) {
- if (filters[j] instanceof TreeModelViewerFilter) {
- // Skip the filter if not applicable to parent element
- Object parentElement = parentElementOrTreePath instanceof TreePath
- ? ((TreePath)parentElementOrTreePath).getLastSegment() : parentElementOrTreePath;
- if (parentElement == null) {
+ ViewerFilter[] filters = fViewer.getFilters();
+ if (filters.length > 0) {
+ for (int j = 0; j < filters.length; j++) {
+ if (filters[j] instanceof TreeModelViewerFilter) {
+ // Skip the filter if not applicable to parent element
+ Object parentElement = parentElementOrTreePath instanceof TreePath
+ ? ((TreePath)parentElementOrTreePath).getLastSegment() : parentElementOrTreePath;
+ if (parentElement == null) {
parentElement = fViewer.getInput();
}
- if (!((TreeModelViewerFilter)filters[j]).isApplicable(fViewer, parentElement)) {
- continue;
- }
- }
-
- if (!(filters[j].select((Viewer) fViewer, parentElementOrTreePath, element))) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
+ if (!((TreeModelViewerFilter)filters[j]).isApplicable(fViewer, parentElement)) {
+ continue;
+ }
+ }
+
+ if (!(filters[j].select((Viewer) fViewer, parentElementOrTreePath, element))) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
public void unmapPath(TreePath path) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- fTransform.clear(path);
- cancelSubtreeUpdates(path);
- }
-
-
- boolean addFilteredIndex(TreePath parentPath, int index, Object element) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- return fTransform.addFilteredIndex(parentPath, index, element);
- }
-
- void removeElementFromFilters(TreePath parentPath, int index) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- fTransform.removeElementFromFilters(parentPath, index);
- }
-
- boolean removeElementFromFilters(TreePath parentPath, Object element) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- return fTransform.removeElementFromFilters(parentPath, element);
- }
-
- void setModelChildCount(TreePath parentPath, int childCount) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- fTransform.setModelChildCount(parentPath, childCount);
- }
-
- boolean isFiltered(TreePath parentPath, int index) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- return fTransform.isFiltered(parentPath, index);
- }
-
- int[] getFilteredChildren(TreePath parent) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- return fTransform.getFilteredChildren(parent);
- }
-
- void clearFilteredChild(TreePath parent, int modelIndex) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- fTransform.clear(parent, modelIndex);
- }
-
- void clearFilters(TreePath parent) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- fTransform.clear(parent);
- }
-
- /**
- * Notification an update request has started
- *
- * @param update the update to notify about
- */
- void updateStarted(ViewerUpdateMonitor update) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ fTransform.clear(path);
+ cancelSubtreeUpdates(path);
+ }
+
+
+ boolean addFilteredIndex(TreePath parentPath, int index, Object element) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ return fTransform.addFilteredIndex(parentPath, index, element);
+ }
+
+ void removeElementFromFilters(TreePath parentPath, int index) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ fTransform.removeElementFromFilters(parentPath, index);
+ }
+
+ boolean removeElementFromFilters(TreePath parentPath, Object element) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ return fTransform.removeElementFromFilters(parentPath, element);
+ }
+
+ void setModelChildCount(TreePath parentPath, int childCount) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ fTransform.setModelChildCount(parentPath, childCount);
+ }
+
+ boolean isFiltered(TreePath parentPath, int index) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ return fTransform.isFiltered(parentPath, index);
+ }
+
+ int[] getFilteredChildren(TreePath parent) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ return fTransform.getFilteredChildren(parent);
+ }
+
+ void clearFilteredChild(TreePath parent, int modelIndex) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ fTransform.clear(parent, modelIndex);
+ }
+
+ void clearFilters(TreePath parent) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ fTransform.clear(parent);
+ }
+
+ /**
+ * Notification an update request has started
+ *
+ * @param update the update to notify about
+ */
+ void updateStarted(ViewerUpdateMonitor update) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
List<ViewerUpdateMonitor> requests = fRequestsInProgress.get(update.getSchedulingPath());
- if (requests == null) {
+ if (requests == null) {
requests = new ArrayList<>();
- fRequestsInProgress.put(update.getSchedulingPath(), requests);
- }
- requests.add(update);
- if (!fModelSequenceRunning) {
- fModelSequenceRunning = true;
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("MODEL SEQUENCE BEGINS"); //$NON-NLS-1$
- }
- notifyUpdate(UPDATE_SEQUENCE_BEGINS, null);
- }
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("\tBEGIN - " + update); //$NON-NLS-1$
- }
- notifyUpdate(UPDATE_BEGINS, update);
- }
-
- /**
- * Notification an update request has completed
- *
- * @param updates the updates to notify
- */
+ fRequestsInProgress.put(update.getSchedulingPath(), requests);
+ }
+ requests.add(update);
+ if (!fModelSequenceRunning) {
+ fModelSequenceRunning = true;
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("MODEL SEQUENCE BEGINS"); //$NON-NLS-1$
+ }
+ notifyUpdate(UPDATE_SEQUENCE_BEGINS, null);
+ }
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("\tBEGIN - " + update); //$NON-NLS-1$
+ }
+ notifyUpdate(UPDATE_BEGINS, update);
+ }
+
+ /**
+ * Notification an update request has completed
+ *
+ * @param updates the updates to notify
+ */
void updatesComplete(final List<ViewerUpdateMonitor> updates) {
- for (int i = 0; i < updates.size(); i++) {
- ViewerUpdateMonitor update = updates.get(i);
- notifyUpdate(UPDATE_COMPLETE, update);
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
- }
- }
-
- // Wait a single cycle to allow viewer to queue requests triggered by completed updates.
+ for (int i = 0; i < updates.size(); i++) {
+ ViewerUpdateMonitor update = updates.get(i);
+ notifyUpdate(UPDATE_COMPLETE, update);
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
+ }
+ }
+
+ // Wait a single cycle to allow viewer to queue requests triggered by completed updates.
getViewer().getDisplay().asyncExec(() -> {
if (isDisposed()) {
return;
@@ -811,355 +811,355 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
});
- }
-
- /**
- * @return Returns true if there are outstanding updates in the viewer.
- */
- boolean areRequestsPending() {
- return !fRequestsInProgress.isEmpty() || !fWaitingRequests.isEmpty();
- }
-
- /**
- * @return Returns the state tracker for the content provider.
- */
- ViewerStateTracker getStateTracker() {
- return fStateTracker;
- }
-
- /**
- * Notifies listeners about given update.
- * @param type Type of update to call listeners with.
- * @param update Update to notify about.
- */
- private void notifyUpdate(final int type, final IViewerUpdate update) {
- if (!fUpdateListeners.isEmpty()) {
+ }
+
+ /**
+ * @return Returns true if there are outstanding updates in the viewer.
+ */
+ boolean areRequestsPending() {
+ return !fRequestsInProgress.isEmpty() || !fWaitingRequests.isEmpty();
+ }
+
+ /**
+ * @return Returns the state tracker for the content provider.
+ */
+ ViewerStateTracker getStateTracker() {
+ return fStateTracker;
+ }
+
+ /**
+ * Notifies listeners about given update.
+ * @param type Type of update to call listeners with.
+ * @param update Update to notify about.
+ */
+ private void notifyUpdate(final int type, final IViewerUpdate update) {
+ if (!fUpdateListeners.isEmpty()) {
for (IViewerUpdateListener iViewerUpdateListener : fUpdateListeners) {
final IViewerUpdateListener listener = iViewerUpdateListener;
- SafeRunner.run(new ISafeRunnable() {
- @Override
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
public void run() throws Exception {
- switch (type) {
- case UPDATE_SEQUENCE_BEGINS:
- listener.viewerUpdatesBegin();
- break;
- case UPDATE_SEQUENCE_COMPLETE:
- listener.viewerUpdatesComplete();
- break;
- case UPDATE_BEGINS:
- listener.updateStarted(update);
- break;
- case UPDATE_COMPLETE:
- listener.updateComplete(update);
- break;
+ switch (type) {
+ case UPDATE_SEQUENCE_BEGINS:
+ listener.viewerUpdatesBegin();
+ break;
+ case UPDATE_SEQUENCE_COMPLETE:
+ listener.viewerUpdatesComplete();
+ break;
+ case UPDATE_BEGINS:
+ listener.updateStarted(update);
+ break;
+ case UPDATE_COMPLETE:
+ listener.updateComplete(update);
+ break;
default:
break;
- }
- }
+ }
+ }
- @Override
+ @Override
public void handleException(Throwable exception) {
- DebugUIPlugin.log(exception);
- }
- });
- }
- }
- }
-
- /**
- * Cancels outstanding updates for the element at given path and its
- * children.
- * @param path Path of element.
- */
- private void cancelSubtreeUpdates(TreePath path) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ DebugUIPlugin.log(exception);
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Cancels outstanding updates for the element at given path and its
+ * children.
+ * @param path Path of element.
+ */
+ private void cancelSubtreeUpdates(TreePath path) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
for (Entry<TreePath, List<ViewerUpdateMonitor>> entry : fRequestsInProgress.entrySet()) {
- TreePath entryPath = entry.getKey();
- if (entryPath.startsWith(path, null)) {
+ TreePath entryPath = entry.getKey();
+ if (entryPath.startsWith(path, null)) {
List<ViewerUpdateMonitor> requests = entry.getValue();
Iterator<ViewerUpdateMonitor> reqIter = requests.iterator();
- while (reqIter.hasNext()) {
- // Cancel update and remove from requests list. Removing from
- // fRequestsInProgress ensures that isRequestBlocked() won't be triggered
- // by a canceled update.
+ while (reqIter.hasNext()) {
+ // Cancel update and remove from requests list. Removing from
+ // fRequestsInProgress ensures that isRequestBlocked() won't be triggered
+ // by a canceled update.
reqIter.next().cancel();
- reqIter.remove();
- }
- }
- }
+ reqIter.remove();
+ }
+ }
+ }
List<TreePath> purge = new ArrayList<>();
for (TreePath entryPath : fWaitingRequests.keySet()) {
- if (entryPath.startsWith(path, null)) {
- purge.add(entryPath);
- }
- }
+ if (entryPath.startsWith(path, null)) {
+ purge.add(entryPath);
+ }
+ }
for (TreePath tp : purge) {
fWaitingRequests.remove(tp);
- }
+ }
- fStateTracker.cancelStateSubtreeUpdates(path);
- }
+ fStateTracker.cancelStateSubtreeUpdates(path);
+ }
- /**
- * Returns whether this given request should be run, or should wait for
- * parent update to complete.
- *
- * @param update the update the schedule
- */
- private void schedule(final ViewerUpdateMonitor update) {
- Assert.isTrue(getViewer().getDisplay().getThread() == Thread.currentThread());
+ /**
+ * Returns whether this given request should be run, or should wait for
+ * parent update to complete.
+ *
+ * @param update the update the schedule
+ */
+ private void schedule(final ViewerUpdateMonitor update) {
+ Assert.isTrue(getViewer().getDisplay().getThread() == Thread.currentThread());
- TreePath schedulingPath = update.getSchedulingPath();
+ TreePath schedulingPath = update.getSchedulingPath();
List<ViewerUpdateMonitor> requests = fWaitingRequests.get(schedulingPath);
- if (requests == null) {
+ if (requests == null) {
requests = new LinkedList<>();
- requests.add(update);
- fWaitingRequests.put(schedulingPath, requests);
+ requests.add(update);
+ fWaitingRequests.put(schedulingPath, requests);
List<ViewerUpdateMonitor> inProgressList = fRequestsInProgress.get(schedulingPath);
- if (inProgressList != null) {
- int staleUpdateIndex = inProgressList.indexOf(update);
- if (staleUpdateIndex >= 0) {
- // Cancel update and remove from requests list. Removing from
- // fRequestsInProgress ensures that isRequestBlocked() won't be triggered
- // by a canceled update.
- ViewerUpdateMonitor staleUpdate = inProgressList.remove(staleUpdateIndex);
- staleUpdate.cancel();
- // Note: Do not reset the inProgressList to null. This would cause the
- // updateStarted() method to think that a new update sequence is
- // being started. Since there are waiting requests for this scheduling
- // path, the list will be cleaned up later.
- }
- }
- if (inProgressList == null || inProgressList.isEmpty()) {
+ if (inProgressList != null) {
+ int staleUpdateIndex = inProgressList.indexOf(update);
+ if (staleUpdateIndex >= 0) {
+ // Cancel update and remove from requests list. Removing from
+ // fRequestsInProgress ensures that isRequestBlocked() won't be triggered
+ // by a canceled update.
+ ViewerUpdateMonitor staleUpdate = inProgressList.remove(staleUpdateIndex);
+ staleUpdate.cancel();
+ // Note: Do not reset the inProgressList to null. This would cause the
+ // updateStarted() method to think that a new update sequence is
+ // being started. Since there are waiting requests for this scheduling
+ // path, the list will be cleaned up later.
+ }
+ }
+ if (inProgressList == null || inProgressList.isEmpty()) {
getViewer().getDisplay().asyncExec(() -> {
if (isDisposed()) {
return;
}
trigger(update.getSchedulingPath());
});
- }
- } else {
- // there are waiting requests: coalesce with existing request and add to list
- requests.add(coalesce(requests, update));
- }
- }
-
- /**
- * Tries to coalesce the given request with any request in the list. If a match is found,
- * the resulting request is then coalesced again with candidates in list.
- * @param requests List of waiting requests to coalesce with
- * @param toCoalesce request to coalesce
- * @return Returns either the coalesced request. If no match was found it returns the
- * toCoalesce parameter request. Either way the returned request needs to be added to the
- * waiting requests list.
- */
+ }
+ } else {
+ // there are waiting requests: coalesce with existing request and add to list
+ requests.add(coalesce(requests, update));
+ }
+ }
+
+ /**
+ * Tries to coalesce the given request with any request in the list. If a match is found,
+ * the resulting request is then coalesced again with candidates in list.
+ * @param requests List of waiting requests to coalesce with
+ * @param toCoalesce request to coalesce
+ * @return Returns either the coalesced request. If no match was found it returns the
+ * toCoalesce parameter request. Either way the returned request needs to be added to the
+ * waiting requests list.
+ */
private ViewerUpdateMonitor coalesce(List<ViewerUpdateMonitor> requests, ViewerUpdateMonitor toCoalesce) {
for (ViewerUpdateMonitor waiting : requests) {
- if (waiting.coalesce(toCoalesce)) {
- requests.remove(waiting);
- // coalesced with existing request, done
- // try to coalesce the combined requests with other waiting requests
- return coalesce(requests, waiting);
- }
- }
- return toCoalesce;
- }
-
- /**
- * Returns whether there are outstanding ChildrenUpdate updates for the given path.
- * This method is expected to be called during processing of a ChildrenRequest,
- * therefore one running children request is ignored.
- * @param path Path of element to check.
- * @return True if there are outstanding children updates for given element.
- */
- boolean areChildrenUpdatesPending(TreePath path) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ if (waiting.coalesce(toCoalesce)) {
+ requests.remove(waiting);
+ // coalesced with existing request, done
+ // try to coalesce the combined requests with other waiting requests
+ return coalesce(requests, waiting);
+ }
+ }
+ return toCoalesce;
+ }
+
+ /**
+ * Returns whether there are outstanding ChildrenUpdate updates for the given path.
+ * This method is expected to be called during processing of a ChildrenRequest,
+ * therefore one running children request is ignored.
+ * @param path Path of element to check.
+ * @return True if there are outstanding children updates for given element.
+ */
+ boolean areChildrenUpdatesPending(TreePath path) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
List<ViewerUpdateMonitor> requests = fWaitingRequests.get(path);
- if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- if (requests.get(i) instanceof ChildrenUpdate) {
- return true;
- }
- }
- }
- requests = fRequestsInProgress.get(path);
- if (requests != null) {
- int numChildrenUpdateRequests = 0;
- for (int i = 0; i < requests.size(); i++) {
- if (requests.get(i) instanceof ChildrenUpdate) {
- if (++numChildrenUpdateRequests > 1) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Triggers waiting requests based on the given request that just
- * completed.
- * <p>
- * Requests are processed in order such that updates to
- * children are delayed until updates for parent elements are completed.
- * This allows the expansion/selection state of the elements to be
- * properly restored as new elements are retrieved from model.
- * </p>
- * @param schedulingPath schedulingPath path or requests to start processing. May
- * be <code>null</code> to start the shortest path request.
- */
- private void trigger(TreePath schedulingPath) {
- Assert.isTrue(getViewer().getDisplay().getThread() == Thread.currentThread());
-
- if (fWaitingRequests.isEmpty()) {
- return;
- }
+ if (requests != null) {
+ for (int i = 0; i < requests.size(); i++) {
+ if (requests.get(i) instanceof ChildrenUpdate) {
+ return true;
+ }
+ }
+ }
+ requests = fRequestsInProgress.get(path);
+ if (requests != null) {
+ int numChildrenUpdateRequests = 0;
+ for (int i = 0; i < requests.size(); i++) {
+ if (requests.get(i) instanceof ChildrenUpdate) {
+ if (++numChildrenUpdateRequests > 1) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Triggers waiting requests based on the given request that just
+ * completed.
+ * <p>
+ * Requests are processed in order such that updates to
+ * children are delayed until updates for parent elements are completed.
+ * This allows the expansion/selection state of the elements to be
+ * properly restored as new elements are retrieved from model.
+ * </p>
+ * @param schedulingPath schedulingPath path or requests to start processing. May
+ * be <code>null</code> to start the shortest path request.
+ */
+ private void trigger(TreePath schedulingPath) {
+ Assert.isTrue(getViewer().getDisplay().getThread() == Thread.currentThread());
+
+ if (fWaitingRequests.isEmpty()) {
+ return;
+ }
List<ViewerUpdateMonitor> waiting = fWaitingRequests.get(schedulingPath);
- if (waiting == null) {
- // no waiting, update the entry with the shortest path
- int length = Integer.MAX_VALUE;
+ if (waiting == null) {
+ // no waiting, update the entry with the shortest path
+ int length = Integer.MAX_VALUE;
Entry<TreePath, List<ViewerUpdateMonitor>> candidate = null;
for (Entry<TreePath, List<ViewerUpdateMonitor>> entry : fWaitingRequests.entrySet()) {
- TreePath key = entry.getKey();
- if (key.getSegmentCount() < length && !isRequestBlocked(key)) {
- candidate = entry;
- length = key.getSegmentCount();
- }
- }
- if (candidate != null) {
- startHighestPriorityRequest(candidate.getKey(), candidate.getValue());
- }
- } else if (!isRequestBlocked(schedulingPath)) {
- // start the highest priority request
- startHighestPriorityRequest(schedulingPath, waiting);
- }
- }
-
- /**
- * Returns true if there are running requests for any parent element of
- * the given tree path.
- * @param requestPath Path of element to check.
- * @return Returns true if requests are running.
- */
- private boolean isRequestBlocked(TreePath requestPath) {
- TreePath parentPath = requestPath;
+ TreePath key = entry.getKey();
+ if (key.getSegmentCount() < length && !isRequestBlocked(key)) {
+ candidate = entry;
+ length = key.getSegmentCount();
+ }
+ }
+ if (candidate != null) {
+ startHighestPriorityRequest(candidate.getKey(), candidate.getValue());
+ }
+ } else if (!isRequestBlocked(schedulingPath)) {
+ // start the highest priority request
+ startHighestPriorityRequest(schedulingPath, waiting);
+ }
+ }
+
+ /**
+ * Returns true if there are running requests for any parent element of
+ * the given tree path.
+ * @param requestPath Path of element to check.
+ * @return Returns true if requests are running.
+ */
+ private boolean isRequestBlocked(TreePath requestPath) {
+ TreePath parentPath = requestPath;
List<ViewerUpdateMonitor> parentRequests = fRequestsInProgress.get(parentPath);
- while (parentRequests == null || parentRequests.isEmpty()) {
- parentPath = parentPath.getParentPath();
- if (parentPath == null) {
- // no running requests: start request
- return false;
- }
- parentRequests = fRequestsInProgress.get(parentPath);
- }
- return true;
- }
-
- /**
- * @param key the {@link TreePath}
- * @param waiting the list of waiting requests
- */
+ while (parentRequests == null || parentRequests.isEmpty()) {
+ parentPath = parentPath.getParentPath();
+ if (parentPath == null) {
+ // no running requests: start request
+ return false;
+ }
+ parentRequests = fRequestsInProgress.get(parentPath);
+ }
+ return true;
+ }
+
+ /**
+ * @param key the {@link TreePath}
+ * @param waiting the list of waiting requests
+ */
private void startHighestPriorityRequest(TreePath key, List<ViewerUpdateMonitor> waiting) {
- int priority = 4;
- ViewerUpdateMonitor next = null;
+ int priority = 4;
+ ViewerUpdateMonitor next = null;
for (ViewerUpdateMonitor vu : waiting) {
- if (vu.getPriority() < priority) {
- next = vu;
- priority = next.getPriority();
- }
- }
- if (next != null) {
- waiting.remove(next);
- if (waiting.isEmpty()) {
- fWaitingRequests.remove(key);
- }
- next.start();
- }
- }
-
- /**
- * Returns the element corresponding to the given tree path.
- *
- * @param path
- * tree path
- * @return model element
- */
- protected Object getElement(TreePath path) {
- if (path.getSegmentCount() > 0) {
- return path.getLastSegment();
- }
- return getViewer().getInput();
- }
-
- /**
- * Reschedule any children updates in progress for the given parent that
- * have a start index greater than the given index. An element has been
- * removed at this index, invalidating updates in progress.
- *
- * @param parentPath
- * view tree path to parent element
- * @param modelIndex
- * index at which an element was removed
- */
- private void rescheduleUpdates(TreePath parentPath, int modelIndex) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ if (vu.getPriority() < priority) {
+ next = vu;
+ priority = next.getPriority();
+ }
+ }
+ if (next != null) {
+ waiting.remove(next);
+ if (waiting.isEmpty()) {
+ fWaitingRequests.remove(key);
+ }
+ next.start();
+ }
+ }
+
+ /**
+ * Returns the element corresponding to the given tree path.
+ *
+ * @param path
+ * tree path
+ * @return model element
+ */
+ protected Object getElement(TreePath path) {
+ if (path.getSegmentCount() > 0) {
+ return path.getLastSegment();
+ }
+ return getViewer().getInput();
+ }
+
+ /**
+ * Reschedule any children updates in progress for the given parent that
+ * have a start index greater than the given index. An element has been
+ * removed at this index, invalidating updates in progress.
+ *
+ * @param parentPath
+ * view tree path to parent element
+ * @param modelIndex
+ * index at which an element was removed
+ */
+ private void rescheduleUpdates(TreePath parentPath, int modelIndex) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
List<ViewerUpdateMonitor> requests = fRequestsInProgress.get(parentPath);
List<IChildrenUpdate> reCreate = null;
- if (requests != null) {
+ if (requests != null) {
Iterator<ViewerUpdateMonitor> iterator = requests.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
ViewerUpdateMonitor update = iterator.next();
- if (update instanceof IChildrenUpdate) {
- IChildrenUpdate childrenUpdate = (IChildrenUpdate) update;
- if (childrenUpdate.getOffset() > modelIndex) {
- // Cancel update and remove from requests list. Removing from
- // fRequestsInProgress ensures that isRequestBlocked() won't be triggered
- // by a canceled update.
- childrenUpdate.cancel();
- iterator.remove();
- if (reCreate == null) {
+ if (update instanceof IChildrenUpdate) {
+ IChildrenUpdate childrenUpdate = (IChildrenUpdate) update;
+ if (childrenUpdate.getOffset() > modelIndex) {
+ // Cancel update and remove from requests list. Removing from
+ // fRequestsInProgress ensures that isRequestBlocked() won't be triggered
+ // by a canceled update.
+ childrenUpdate.cancel();
+ iterator.remove();
+ if (reCreate == null) {
reCreate = new ArrayList<>();
- }
- reCreate.add(childrenUpdate);
- if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("canceled update in progress handling REMOVE: " + childrenUpdate); //$NON-NLS-1$
- }
- }
- }
- }
- }
- requests = fWaitingRequests.get(parentPath);
- if (requests != null) {
+ }
+ reCreate.add(childrenUpdate);
+ if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("canceled update in progress handling REMOVE: " + childrenUpdate); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+ requests = fWaitingRequests.get(parentPath);
+ if (requests != null) {
for (ViewerUpdateMonitor update : requests) {
- if (update instanceof IChildrenUpdate) {
- IChildrenUpdate childrenUpdate = (IChildrenUpdate) update;
- if (childrenUpdate.getOffset() > modelIndex) {
- ((ChildrenUpdate) childrenUpdate).setOffset(childrenUpdate.getOffset() - 1);
- if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("modified waiting update handling REMOVE: " + childrenUpdate); //$NON-NLS-1$
- }
- }
- }
- }
- }
- // re-schedule canceled updates at new position.
- // have to do this last else the requests would be waiting and
- // get modified.
- if (reCreate != null) {
+ if (update instanceof IChildrenUpdate) {
+ IChildrenUpdate childrenUpdate = (IChildrenUpdate) update;
+ if (childrenUpdate.getOffset() > modelIndex) {
+ ((ChildrenUpdate) childrenUpdate).setOffset(childrenUpdate.getOffset() - 1);
+ if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("modified waiting update handling REMOVE: " + childrenUpdate); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+ // re-schedule canceled updates at new position.
+ // have to do this last else the requests would be waiting and
+ // get modified.
+ if (reCreate != null) {
for (IChildrenUpdate childrenUpdate : reCreate) {
- int start = childrenUpdate.getOffset() - 1;
- int end = start + childrenUpdate.getLength();
- for (int i = start; i < end; i++) {
- doUpdateElement(parentPath, i);
- }
- }
- }
- }
+ int start = childrenUpdate.getOffset() - 1;
+ int end = start + childrenUpdate.getLength();
+ for (int i = start; i < end; i++) {
+ doUpdateElement(parentPath, i);
+ }
+ }
+ }
+ }
private void doUpdateChildCount(TreePath path) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
Object element = getElement(path);
IElementContentProvider contentAdapter = ViewerAdapterService.getContentProvider(element);
@@ -1170,7 +1170,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
void doUpdateElement(TreePath parentPath, int modelIndex) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
Object parent = getElement(parentPath);
IElementContentProvider contentAdapter = ViewerAdapterService.getContentProvider(parent);
@@ -1181,7 +1181,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
private void doUpdateHasChildren(TreePath path) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
Object element = getElement(path);
IElementContentProvider contentAdapter = ViewerAdapterService.getContentProvider(element);
@@ -1197,73 +1197,73 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
* @param path Path of element to check.
* @return Returns true if there are outstanding updates.
*/
- boolean areElementUpdatesPending(TreePath path) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ boolean areElementUpdatesPending(TreePath path) {
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
- TreePath parentPath = path.getParentPath();
+ TreePath parentPath = path.getParentPath();
List<ViewerUpdateMonitor> requests = fWaitingRequests.get(path);
- if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
- if (update instanceof ChildrenUpdate) {
- return true;
- }
- }
- }
- requests = fWaitingRequests.get(parentPath);
- if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
- if (update.containsUpdate(path)) {
- return true;
- }
- }
- }
- requests = fRequestsInProgress.get(path);
- if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
- if (update instanceof ChildrenUpdate) {
- return true;
- }
- }
- }
- requests = fRequestsInProgress.get(parentPath);
- if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
- if (update.getElement().equals(path.getLastSegment())) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns the presentation context for this content provider.
- *
- * @return presentation context
- */
+ if (requests != null) {
+ for (int i = 0; i < requests.size(); i++) {
+ ViewerUpdateMonitor update = requests.get(i);
+ if (update instanceof ChildrenUpdate) {
+ return true;
+ }
+ }
+ }
+ requests = fWaitingRequests.get(parentPath);
+ if (requests != null) {
+ for (int i = 0; i < requests.size(); i++) {
+ ViewerUpdateMonitor update = requests.get(i);
+ if (update.containsUpdate(path)) {
+ return true;
+ }
+ }
+ }
+ requests = fRequestsInProgress.get(path);
+ if (requests != null) {
+ for (int i = 0; i < requests.size(); i++) {
+ ViewerUpdateMonitor update = requests.get(i);
+ if (update instanceof ChildrenUpdate) {
+ return true;
+ }
+ }
+ }
+ requests = fRequestsInProgress.get(parentPath);
+ if (requests != null) {
+ for (int i = 0; i < requests.size(); i++) {
+ ViewerUpdateMonitor update = requests.get(i);
+ if (update.getElement().equals(path.getLastSegment())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the presentation context for this content provider.
+ *
+ * @return presentation context
+ */
protected IPresentationContext getPresentationContext() {
- ITreeModelViewer viewer = getViewer();
- if (viewer != null) {
- return viewer.getPresentationContext();
- }
- return null;
- }
-
- /**
- * Updates the viewer with the following deltas.
- *
- * @param nodes Model deltas to be processed.
- * @param mask the model delta mask
- * @see IModelDelta for a list of masks
- */
- protected void updateNodes(IModelDelta[] nodes, int mask) {
- for (int i = 0; i < nodes.length; i++) {
- IModelDelta node = nodes[i];
- int flags = node.getFlags() & mask;
+ ITreeModelViewer viewer = getViewer();
+ if (viewer != null) {
+ return viewer.getPresentationContext();
+ }
+ return null;
+ }
+
+ /**
+ * Updates the viewer with the following deltas.
+ *
+ * @param nodes Model deltas to be processed.
+ * @param mask the model delta mask
+ * @see IModelDelta for a list of masks
+ */
+ protected void updateNodes(IModelDelta[] nodes, int mask) {
+ for (int i = 0; i < nodes.length; i++) {
+ IModelDelta node = nodes[i];
+ int flags = node.getFlags() & mask;
if (flags != 0) {
if ((flags & IModelDelta.ADDED) != 0) {
handleAdd(node);
@@ -1301,36 +1301,36 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
if ((flags & IModelDelta.REVEAL) != 0) {
handleReveal(node);
}
- }
- updateNodes(node.getChildDeltas(), mask);
- }
- }
+ }
+ updateNodes(node.getChildDeltas(), mask);
+ }
+ }
- protected void handleInstall(IModelDelta delta) {
- installModelProxy(getViewer().getInput(), getFullTreePath(delta));
- }
+ protected void handleInstall(IModelDelta delta) {
+ installModelProxy(getViewer().getInput(), getFullTreePath(delta));
+ }
- protected void handleUninstall(IModelDelta delta) {
- disposeModelProxy(getFullTreePath(delta));
- }
+ protected void handleUninstall(IModelDelta delta) {
+ disposeModelProxy(getFullTreePath(delta));
+ }
- protected void handleAdd(IModelDelta delta) {
+ protected void handleAdd(IModelDelta delta) {
IModelDelta parentDelta = delta.getParentDelta();
if (parentDelta == null) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
- return;
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
}
TreePath parentPath = getViewerTreePath(parentDelta);
Object element = delta.getElement();
int count = parentDelta.getChildCount();
if (count > 0) {
- setModelChildCount(parentPath, count);
- int modelIndex = count - 1;
- if (delta.getIndex() != -1) {
- // assume addition at end, unless index specified by delta
- modelIndex = delta.getIndex();
- }
+ setModelChildCount(parentPath, count);
+ int modelIndex = count - 1;
+ if (delta.getIndex() != -1) {
+ // assume addition at end, unless index specified by delta
+ modelIndex = delta.getIndex();
+ }
if (shouldFilter(parentPath, element)) {
addFilteredIndex(parentPath, modelIndex, element);
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
@@ -1341,7 +1341,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
if (isFiltered(parentPath, modelIndex)) {
clearFilteredChild(parentPath, modelIndex);
}
- int viewIndex = modelToViewIndex(parentPath, modelIndex);
+ int viewIndex = modelToViewIndex(parentPath, modelIndex);
int viewCount = modelToViewChildCount(parentPath, count);
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("handleAdd(" + delta.getElement() + ") viewIndex: " + viewIndex + " modelIndex: " + modelIndex + " viewCount: " + viewCount + " modelCount: " + count); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
@@ -1357,11 +1357,11 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("handleAdd(" + delta.getElement() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
- doUpdateChildCount(getViewerTreePath(delta.getParentDelta()));
+ doUpdateChildCount(getViewerTreePath(delta.getParentDelta()));
}
}
- protected void handleContent(IModelDelta delta) {
+ protected void handleContent(IModelDelta delta) {
if (delta.getParentDelta() == null && delta.getChildCount() == 0) {
// if the delta is for the root, ensure the root still matches viewer input
if (!delta.getElement().equals(getViewer().getInput())) {
@@ -1373,13 +1373,13 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
getViewer().refresh(getElement(treePath));
}
- protected void handleCollapse(IModelDelta delta) {
+ protected void handleCollapse(IModelDelta delta) {
TreePath elementPath = getViewerTreePath(delta);
getViewer().setExpandedState(elementPath, false);
- cancelRestore(elementPath, IModelDelta.EXPAND);
+ cancelRestore(elementPath, IModelDelta.EXPAND);
}
- protected void handleExpand(IModelDelta delta) {
+ protected void handleExpand(IModelDelta delta) {
// expand each parent, then this node
IModelDelta parentDelta = delta.getParentDelta();
if (parentDelta != null) {
@@ -1388,22 +1388,22 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
expand(delta);
} else {
- int childCount = delta.getChildCount();
- TreePath elementPath = getViewerTreePath(delta);
- if (childCount > 0) {
- int viewCount = modelToViewChildCount(elementPath, childCount);
- if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("[expand] setChildCount(" + delta.getElement() + ", (model) " + childCount + " (view) " + viewCount); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- getViewer().setChildCount(elementPath, viewCount);
- }
- }
- }
-
- /**
- * Expands the element pointed to by given delta.
- * @param delta Delta that points to the element to expand.
- */
+ int childCount = delta.getChildCount();
+ TreePath elementPath = getViewerTreePath(delta);
+ if (childCount > 0) {
+ int viewCount = modelToViewChildCount(elementPath, childCount);
+ if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("[expand] setChildCount(" + delta.getElement() + ", (model) " + childCount + " (view) " + viewCount); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ getViewer().setChildCount(elementPath, viewCount);
+ }
+ }
+ }
+
+ /**
+ * Expands the element pointed to by given delta.
+ * @param delta Delta that points to the element to expand.
+ */
private void expand(IModelDelta delta) {
int childCount = delta.getChildCount();
int modelIndex = delta.getIndex();
@@ -1435,9 +1435,9 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
DebugUIPlugin.trace("[expand] setChildCount(" + delta.getElement() + ", (model) " + childCount + " (view) " + viewCount); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
treeViewer.setChildCount(elementPath, viewCount);
- if (!treeViewer.getExpandedState(elementPath)) {
- treeViewer.expandToLevel(elementPath, 1);
- }
+ if (!treeViewer.getExpandedState(elementPath)) {
+ treeViewer.expandToLevel(elementPath, 1);
+ }
cancelRestore(elementPath, IModelDelta.COLLAPSE);
}
}
@@ -1451,7 +1451,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
* @param element element to insert
* @param modelIndex index of the element in the model
* @return Returns the view index of the newly inserted element
- * or -1 if not inserted.
+ * or -1 if not inserted.
*/
private int unfilterElement(TreePath parentPath, Object element, int modelIndex) {
// Element is filtered - if no longer filtered, insert the element
@@ -1478,11 +1478,11 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
protected void handleInsert(IModelDelta delta) {
- IModelDelta parentDelta = delta.getParentDelta();
- if (parentDelta == null) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
+ IModelDelta parentDelta = delta.getParentDelta();
+ if (parentDelta == null) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
TreePath parentPath = getViewerTreePath(delta.getParentDelta());
Object element = delta.getElement();
@@ -1505,7 +1505,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("handleInsert(" + delta.getElement() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
- doUpdateChildCount(getViewerTreePath(delta.getParentDelta()));
+ doUpdateChildCount(getViewerTreePath(delta.getParentDelta()));
}
}
@@ -1515,8 +1515,8 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
IModelDelta parentDelta = delta.getParentDelta();
if (parentDelta == null) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
- return;
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
}
IInternalTreeModelViewer treeViewer = getViewer();
TreePath parentPath = getViewerTreePath(parentDelta);
@@ -1530,16 +1530,16 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
int unmappedIndex = -1;
int itemCount = -1;
if (modelIndex < 0) {
- itemCount = treeViewer.getChildCount(parentPath);
- if (itemCount == -1) {
- clearFilters(parentPath);
- }
- viewIndex = treeViewer.findElementIndex(parentPath, element);
- if (viewIndex >= 0) {
- modelIndex = viewToModelIndex(parentPath, viewIndex);
- } else {
- unmappedIndex = treeViewer.findElementIndex(parentPath, null);
- }
+ itemCount = treeViewer.getChildCount(parentPath);
+ if (itemCount == -1) {
+ clearFilters(parentPath);
+ }
+ viewIndex = treeViewer.findElementIndex(parentPath, element);
+ if (viewIndex >= 0) {
+ modelIndex = viewToModelIndex(parentPath, viewIndex);
+ } else {
+ unmappedIndex = treeViewer.findElementIndex(parentPath, null);
+ }
} else {
viewIndex = modelToViewIndex(parentPath, modelIndex);
}
@@ -1583,41 +1583,41 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
protected void handleReplace(IModelDelta delta) {
- IModelDelta parentDelta = delta.getParentDelta();
- if (parentDelta == null) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
+ IModelDelta parentDelta = delta.getParentDelta();
+ if (parentDelta == null) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
TreePath parentPath = getViewerTreePath(parentDelta);
int index = delta.getIndex();
if (index < 0) {
- index = fTransform.indexOfFilteredElement(parentPath, delta.getElement());
+ index = fTransform.indexOfFilteredElement(parentPath, delta.getElement());
}
if (index >= 0) {
- boolean filtered = isFiltered(parentPath, index);
- boolean shouldFilter = shouldFilter(parentPath, delta.getReplacementElement());
-
- // Update the filter transform
- if (filtered) {
- clearFilteredChild(parentPath, index);
- }
- if (shouldFilter) {
- addFilteredIndex(parentPath, index, delta.getElement());
- }
-
- // Update the viewer
- if (filtered) {
- if (!shouldFilter) {
- getViewer().insert(parentPath, delta.getReplacementElement(), modelToViewIndex(parentPath, index));
- }
- //else do nothing
- } else {
- if (shouldFilter) {
- getViewer().remove(parentPath, modelToViewIndex(parentPath, index));
- } else {
- getViewer().replace(parentPath, delta.getIndex(), delta.getReplacementElement());
- }
- }
+ boolean filtered = isFiltered(parentPath, index);
+ boolean shouldFilter = shouldFilter(parentPath, delta.getReplacementElement());
+
+ // Update the filter transform
+ if (filtered) {
+ clearFilteredChild(parentPath, index);
+ }
+ if (shouldFilter) {
+ addFilteredIndex(parentPath, index, delta.getElement());
+ }
+
+ // Update the viewer
+ if (filtered) {
+ if (!shouldFilter) {
+ getViewer().insert(parentPath, delta.getReplacementElement(), modelToViewIndex(parentPath, index));
+ }
+ //else do nothing
+ } else {
+ if (shouldFilter) {
+ getViewer().remove(parentPath, modelToViewIndex(parentPath, index));
+ } else {
+ getViewer().replace(parentPath, delta.getIndex(), delta.getReplacementElement());
+ }
+ }
}
}
@@ -1627,18 +1627,18 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
// check if selection is allowed
IStructuredSelection candidate = new TreeSelection(getViewerTreePath(delta));
if ((delta.getFlags() & IModelDelta.FORCE) == 0 &&
- !treeViewer.overrideSelection(treeViewer.getSelection(), candidate))
+ !treeViewer.overrideSelection(treeViewer.getSelection(), candidate))
{
return;
}
// empty the selection before replacing elements to avoid materializing elements (@see bug 305739)
treeViewer.clearSelectionQuiet();
if (modelIndex >= 0) {
- IModelDelta parentDelta = delta.getParentDelta();
- if (parentDelta == null) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
+ IModelDelta parentDelta = delta.getParentDelta();
+ if (parentDelta == null) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
TreePath parentPath = getViewerTreePath(parentDelta);
int viewIndex = modelToViewIndex(parentPath, modelIndex);
if (viewIndex >= 0) {
@@ -1659,7 +1659,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
TreePath selectionPath = getViewerTreePath(delta);
if (treeViewer.trySelection(new TreeSelection(selectionPath), false, (delta.getFlags() | IModelDelta.FORCE) == 0)) {
- cancelRestore(selectionPath, IModelDelta.SELECT);
+ cancelRestore(selectionPath, IModelDelta.SELECT);
}
}
@@ -1669,13 +1669,13 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
protected void handleReveal(IModelDelta delta) {
IModelDelta parentDelta = delta.getParentDelta();
- if (parentDelta == null) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- handleExpand(parentDelta);
- reveal(delta);
- cancelRestore(getViewerTreePath(delta), IModelDelta.REVEAL);
+ if (parentDelta == null) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Invalid viewer update: " + delta + ", in " + getPresentationContext().getId(), null )); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ handleExpand(parentDelta);
+ reveal(delta);
+ cancelRestore(getViewerTreePath(delta), IModelDelta.REVEAL);
}
/**
@@ -1708,7 +1708,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
// only move tree based on force flag and selection policy
if ((delta.getFlags() & IModelDelta.FORCE) != 0 ||
- treeViewer.overrideSelection(treeViewer.getSelection(), new TreeSelection(elementPath)))
+ treeViewer.overrideSelection(treeViewer.getSelection(), new TreeSelection(elementPath)))
{
/*
* Bug 438724 - Save reveal parameters and redo reveal on
@@ -1717,7 +1717,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
*/
fRevealPath = parentPath;
fRevealIndex = viewIndex;
- treeViewer.reveal(parentPath, viewIndex);
+ treeViewer.reveal(parentPath, viewIndex);
}
}
}
@@ -1729,7 +1729,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
@Override
public void updateChildCount(TreePath treePath, int currentChildCount) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("updateChildCount(" + getElement(treePath) + ", " + currentChildCount + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -1739,7 +1739,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
@Override
public void updateElement(TreePath parentPath, int viewIndex) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
int modelIndex = viewToModelIndex(parentPath, viewIndex);
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
@@ -1750,7 +1750,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
@Override
public void updateHasChildren(TreePath path) {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("updateHasChildren(" + getElement(path)); //$NON-NLS-1$
@@ -1765,61 +1765,61 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
* @param update Update to perform.
*/
void scheduleViewerUpdate(ViewerUpdateMonitor update) {
- Display display;
- Runnable updateJob = null;
- synchronized(this) {
- if (isDisposed()) {
+ Display display;
+ Runnable updateJob = null;
+ synchronized(this) {
+ if (isDisposed()) {
return;
}
- display = getViewer().getDisplay();
- fCompletedUpdates.add(update);
- if (fCompletedUpdatesRunnable == null) {
+ display = getViewer().getDisplay();
+ fCompletedUpdates.add(update);
+ if (fCompletedUpdatesRunnable == null) {
fCompletedUpdatesRunnable = () -> {
if (!isDisposed()) {
performUpdates();
}
};
- updateJob = fCompletedUpdatesRunnable;
- }
- }
-
- if (updateJob != null) {
- if (Thread.currentThread() == display.getThread()) {
- performUpdates();
- } else {
+ updateJob = fCompletedUpdatesRunnable;
+ }
+ }
+
+ if (updateJob != null) {
+ if (Thread.currentThread() == display.getThread()) {
+ performUpdates();
+ } else {
fDelayedDoModelChangeJob.runDelayed(updateJob);
- }
- }
+ }
+ }
}
/**
* Perform the updates pointed to by given array on the viewer.
*/
private void performUpdates() {
- Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
List<ViewerUpdateMonitor> jobCompletedUpdates;
- synchronized(this) {
- if (isDisposed()) {
- return;
- }
- jobCompletedUpdates = fCompletedUpdates;
- fCompletedUpdatesRunnable = null;
+ synchronized(this) {
+ if (isDisposed()) {
+ return;
+ }
+ jobCompletedUpdates = fCompletedUpdates;
+ fCompletedUpdatesRunnable = null;
fCompletedUpdates = new ArrayList<>();
- }
- // necessary to check if viewer is disposed
- try {
- for (int i = 0; i < jobCompletedUpdates.size(); i++) {
- ViewerUpdateMonitor completedUpdate = jobCompletedUpdates.get(i);
- if (!completedUpdate.isCanceled() && !isDisposed()) {
- IStatus status = completedUpdate.getStatus();
- if (status == null || status.isOK()) {
- completedUpdate.performUpdate();
- }
- }
- }
- } finally {
- updatesComplete(jobCompletedUpdates);
- }
+ }
+ // necessary to check if viewer is disposed
+ try {
+ for (int i = 0; i < jobCompletedUpdates.size(); i++) {
+ ViewerUpdateMonitor completedUpdate = jobCompletedUpdates.get(i);
+ if (!completedUpdate.isCanceled() && !isDisposed()) {
+ IStatus status = completedUpdate.getStatus();
+ if (status == null || status.isOK()) {
+ completedUpdate.performUpdate();
+ }
+ }
+ }
+ } finally {
+ updatesComplete(jobCompletedUpdates);
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
index dbf6f53c2..bbde049f8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
@@ -49,7 +49,7 @@ import org.eclipse.swt.widgets.Display;
* @since 3.3
*/
public class TreeModelLabelProvider extends ColumnLabelProvider
- implements ITreeModelLabelProvider, IModelChangedListener
+ implements ITreeModelLabelProvider, IModelChangedListener
{
private IInternalTreeModelViewer fViewer;
@@ -103,28 +103,28 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
*/
private List<ILabelUpdate> fUpdatesInProgress = new ArrayList<>();
- /**
- * Delta visitor actively cancels the outstanding label updates for
- * elements that are changed and are about to be updated.
- */
- class CancelPendingUpdatesVisitor implements IModelDeltaVisitor {
- @Override
+ /**
+ * Delta visitor actively cancels the outstanding label updates for
+ * elements that are changed and are about to be updated.
+ */
+ class CancelPendingUpdatesVisitor implements IModelDeltaVisitor {
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- if ((delta.getFlags() & IModelDelta.CONTENT) > 0) {
- cancelElementUpdates(delta.getElement(), true);
- return false;
- } else if ((delta.getFlags() & IModelDelta.STATE) > 0) {
- cancelElementUpdates(delta.getElement(), false);
- return true;
- }
- return true;
- }
- }
-
- /**
- * Delta visitor
- */
- private CancelPendingUpdatesVisitor fCancelPendingUpdatesVisitor = new CancelPendingUpdatesVisitor();
+ if ((delta.getFlags() & IModelDelta.CONTENT) > 0) {
+ cancelElementUpdates(delta.getElement(), true);
+ return false;
+ } else if ((delta.getFlags() & IModelDelta.STATE) > 0) {
+ cancelElementUpdates(delta.getElement(), false);
+ return true;
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Delta visitor
+ */
+ private CancelPendingUpdatesVisitor fCancelPendingUpdatesVisitor = new CancelPendingUpdatesVisitor();
/**
* Constructs a new label provider on the given display
@@ -206,21 +206,21 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
@Override
public void dispose() {
- Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
+ Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
- fViewer.removeModelChangedListener(this);
- fViewer = null;
+ fViewer.removeModelChangedListener(this);
+ fViewer = null;
List<ILabelUpdate> complete = null;
- synchronized(this) {
- complete = fComplete;
- fComplete = null;
- }
- if (complete != null) {
+ synchronized(this) {
+ complete = fComplete;
+ fComplete = null;
+ }
+ if (complete != null) {
for (ILabelUpdate update : complete) {
update.cancel();
}
- }
+ }
for (ILabelUpdate currentUpdate : fUpdatesInProgress) {
currentUpdate.cancel();
}
@@ -231,7 +231,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
for (List<ILabelUpdate> updateList : fPendingUpdates.values()) {
for (ILabelUpdate update : updateList) {
update.cancel();
- }
+ }
}
fPendingUpdates.clear();
for (Image image : fImageCache.values()) {
@@ -250,7 +250,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
}
private boolean isDisposed() {
- return fViewer == null;
+ return fViewer == null;
}
@Override
@@ -260,120 +260,120 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
@Override
public boolean update(TreePath elementPath) {
- Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
+ Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
- cancelPathUpdates(elementPath);
+ cancelPathUpdates(elementPath);
String[] visibleColumns = fViewer.getVisibleColumns();
Object element = elementPath.getLastSegment();
IElementLabelProvider presentation = ViewerAdapterService.getLabelProvider(element);
if (presentation != null) {
List<ILabelUpdate> updates = fPendingUpdates.get(presentation);
- if (updates == null) {
+ if (updates == null) {
updates = new LinkedList<>();
- fPendingUpdates.put(presentation, updates);
- }
- updates.add(new LabelUpdate(fViewer.getInput(), elementPath, this, visibleColumns, fViewer.getPresentationContext()));
- fPendingUpdatesRunnable = new Runnable() {
- @Override
+ fPendingUpdates.put(presentation, updates);
+ }
+ updates.add(new LabelUpdate(fViewer.getInput(), elementPath, this, visibleColumns, fViewer.getPresentationContext()));
+ fPendingUpdatesRunnable = new Runnable() {
+ @Override
public void run() {
- if (isDisposed()) {
+ if (isDisposed()) {
return;
}
- startRequests(this);
- }
- };
- fViewer.getDisplay().asyncExec(fPendingUpdatesRunnable);
+ startRequests(this);
+ }
+ };
+ fViewer.getDisplay().asyncExec(fPendingUpdatesRunnable);
return true;
} else {
- return false;
+ return false;
}
}
/**
- * Cancel any outstanding updates that are running for this element.
+ * Cancel any outstanding updates that are running for this element.
* @param elementPath Element to cancel updates for.
- */
- private void cancelPathUpdates(TreePath elementPath) {
- Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
+ */
+ private void cancelPathUpdates(TreePath elementPath) {
+ Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
for (ILabelUpdate currentUpdate : fUpdatesInProgress) {
- if (elementPath.equals(currentUpdate.getElementPath())) {
- currentUpdate.cancel();
- }
- }
- }
-
- /**
- * Sets the element's display information in the viewer.
- *
- * @param path Element path.
- * @param numColumns Number of columns in the data.
- * @param labels Array of labels. The array cannot to be
- * <code>null</code>, but values within the array may be.
- * @param images Array of image descriptors, may be <code>null</code>.
- * @param fontDatas Array of fond data objects, may be <code>null</code>.
- * @param foregrounds Array of RGB values for foreground colors, may be
- * <code>null</code>.
- * @param backgrounds Array of RGB values for background colors, may be
- * <code>null</code>.
- * @param checked Whether given item should be checked.
- * @param grayed Whether given item's checkbox should be grayed.
- */
- void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
- FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds, boolean checked, boolean grayed)
- {
- fViewer.setElementData(path, numColumns, labels, images, fontDatas, foregrounds, backgrounds);
- fViewer.setElementChecked(path, checked, grayed);
- }
+ if (elementPath.equals(currentUpdate.getElementPath())) {
+ currentUpdate.cancel();
+ }
+ }
+ }
+
+ /**
+ * Sets the element's display information in the viewer.
+ *
+ * @param path Element path.
+ * @param numColumns Number of columns in the data.
+ * @param labels Array of labels. The array cannot to be
+ * <code>null</code>, but values within the array may be.
+ * @param images Array of image descriptors, may be <code>null</code>.
+ * @param fontDatas Array of fond data objects, may be <code>null</code>.
+ * @param foregrounds Array of RGB values for foreground colors, may be
+ * <code>null</code>.
+ * @param backgrounds Array of RGB values for background colors, may be
+ * <code>null</code>.
+ * @param checked Whether given item should be checked.
+ * @param grayed Whether given item's checkbox should be grayed.
+ */
+ void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
+ FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds, boolean checked, boolean grayed)
+ {
+ fViewer.setElementData(path, numColumns, labels, images, fontDatas, foregrounds, backgrounds);
+ fViewer.setElementChecked(path, checked, grayed);
+ }
private void startRequests(Runnable runnable) {
- if (runnable != fPendingUpdatesRunnable) {
- return;
- }
- if (!fPendingUpdates.isEmpty()) {
+ if (runnable != fPendingUpdatesRunnable) {
+ return;
+ }
+ if (!fPendingUpdates.isEmpty()) {
List<ILabelUpdate> list = null;
for (Entry<IElementLabelProvider, List<ILabelUpdate>> entry : fPendingUpdates.entrySet()) {
list = entry.getValue();
for (ILabelUpdate update : list) {
updateStarted(update);
- }
+ }
entry.getKey().update(list.toArray(new ILabelUpdate[list.size()]));
- }
- }
- fPendingUpdates.clear();
- fPendingUpdatesRunnable = null;
+ }
+ }
+ fPendingUpdates.clear();
+ fPendingUpdatesRunnable = null;
}
- /**
- * Cancels all running updates for the given element. If seachFullPath is true,
- * all updates will be canceled which have the given element anywhere in their
- * patch.
- * @param element element to search for.
- * @param searchFullPath flag whether to look for the element in the full path
- * of the update
- */
- private void cancelElementUpdates(Object element, boolean searchFullPath) {
+ /**
+ * Cancels all running updates for the given element. If seachFullPath is true,
+ * all updates will be canceled which have the given element anywhere in their
+ * patch.
+ * @param element element to search for.
+ * @param searchFullPath flag whether to look for the element in the full path
+ * of the update
+ */
+ private void cancelElementUpdates(Object element, boolean searchFullPath) {
for (ILabelUpdate currentUpdate : fUpdatesInProgress) {
- if (searchFullPath) {
- if (element.equals(fViewer.getInput())) {
- currentUpdate.cancel();
- } else {
- TreePath updatePath = currentUpdate.getElementPath();
- for (int i = 0; i < updatePath.getSegmentCount(); i++) {
- if (element.equals(updatePath.getSegment(i))) {
- currentUpdate.cancel();
- break; // Exit the for loop, stay in the while loop
- }
- }
- }
- } else {
- if (element.equals(currentUpdate.getElement())) {
- currentUpdate.cancel();
- }
- }
- }
- }
+ if (searchFullPath) {
+ if (element.equals(fViewer.getInput())) {
+ currentUpdate.cancel();
+ } else {
+ TreePath updatePath = currentUpdate.getElementPath();
+ for (int i = 0; i < updatePath.getSegmentCount(); i++) {
+ if (element.equals(updatePath.getSegment(i))) {
+ currentUpdate.cancel();
+ break; // Exit the for loop, stay in the while loop
+ }
+ }
+ }
+ } else {
+ if (element.equals(currentUpdate.getElement())) {
+ currentUpdate.cancel();
+ }
+ }
+ }
+ }
/**
* Returns the presentation context for this label provider.
@@ -384,13 +384,13 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
return fViewer.getPresentationContext();
}
- /**
- * A label update is complete.
- *
- * @param update Update that is to be completed.
- */
- synchronized void complete(ILabelUpdate update) {
- if (fViewer == null) {
+ /**
+ * A label update is complete.
+ *
+ * @param update Update that is to be completed.
+ */
+ synchronized void complete(ILabelUpdate update) {
+ if (fViewer == null) {
return;
}
@@ -411,11 +411,11 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
} else {
((LabelUpdate) itrUpdate).performUpdate();
}
- }
+ }
});
}
fComplete.add(update);
- }
+ }
@Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {
@@ -433,7 +433,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
* @param update Update that was started
*/
void updateStarted(ILabelUpdate update) {
- Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
+ Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
boolean begin = fUpdatesInProgress.isEmpty();
fUpdatesInProgress.add(update);
@@ -444,8 +444,8 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
}
notifyUpdate(TreeModelContentProvider.UPDATE_SEQUENCE_BEGINS, null);
}
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("\tBEGIN - " + update); //$NON-NLS-1$
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("\tBEGIN - " + update); //$NON-NLS-1$
}
notifyUpdate(TreeModelContentProvider.UPDATE_BEGINS, update);
}
@@ -458,13 +458,13 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
void updateComplete(ILabelUpdate update) {
fUpdatesInProgress.remove(update);
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
}
notifyUpdate(TreeModelContentProvider.UPDATE_COMPLETE, update);
if (fUpdatesInProgress.isEmpty()) {
- if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
- DebugUIPlugin.trace("LABEL SEQUENCE ENDS"); //$NON-NLS-1$
+ if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace("LABEL SEQUENCE ENDS"); //$NON-NLS-1$
}
notifyUpdate(TreeModelContentProvider.UPDATE_SEQUENCE_COMPLETE, null);
}
@@ -505,7 +505,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
@Override
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- delta.accept(fCancelPendingUpdatesVisitor);
- }
+ delta.accept(fCancelPendingUpdatesVisitor);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java
index ad74f09e2..293f64366 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java
@@ -38,45 +38,45 @@ import org.eclipse.jface.viewers.IStructuredSelection;
public class ViewerAdapterService {
- /**
- * Returns the content provider for the given element or
- * <code>null</code> if none.
- *
- * @param element element to retrieve adapter for
- * @return content provider or <code>null</code>
- */
- public static IElementContentProvider getContentProvider(Object element) {
- return (IElementContentProvider)getAdapter(element, IElementContentProvider.class);
- }
+ /**
+ * Returns the content provider for the given element or
+ * <code>null</code> if none.
+ *
+ * @param element element to retrieve adapter for
+ * @return content provider or <code>null</code>
+ */
+ public static IElementContentProvider getContentProvider(Object element) {
+ return (IElementContentProvider)getAdapter(element, IElementContentProvider.class);
+ }
- /**
- * Returns the label provider for the given element or
- * <code>null</code> if none.
- *
- * @param element element to retrieve adapter for
- * @return label provider or <code>null</code>
- */
- public static IElementLabelProvider getLabelProvider(Object element) {
- IElementLabelProvider lp = (IElementLabelProvider)getAdapter(element, IElementLabelProvider.class);
- if (lp == null && element instanceof String) {
- // there are no adapters registered for Strings
- return new DebugElementAdapterFactory().getAdapter(element, IElementLabelProvider.class);
- }
- return lp;
- }
+ /**
+ * Returns the label provider for the given element or
+ * <code>null</code> if none.
+ *
+ * @param element element to retrieve adapter for
+ * @return label provider or <code>null</code>
+ */
+ public static IElementLabelProvider getLabelProvider(Object element) {
+ IElementLabelProvider lp = (IElementLabelProvider)getAdapter(element, IElementLabelProvider.class);
+ if (lp == null && element instanceof String) {
+ // there are no adapters registered for Strings
+ return new DebugElementAdapterFactory().getAdapter(element, IElementLabelProvider.class);
+ }
+ return lp;
+ }
- /**
- * Returns the column presentation factory for the given element or <code>null</code>.
- *
- * @param element element to retrieve adapter for
- * @return column presentation factory of <code>null</code>
- */
- public static IColumnPresentationFactory getColumnPresentationFactory(Object element) {
- return (IColumnPresentationFactory)getAdapter(element, IColumnPresentationFactory.class);
- }
+ /**
+ * Returns the column presentation factory for the given element or <code>null</code>.
+ *
+ * @param element element to retrieve adapter for
+ * @return column presentation factory of <code>null</code>
+ */
+ public static IColumnPresentationFactory getColumnPresentationFactory(Object element) {
+ return (IColumnPresentationFactory)getAdapter(element, IColumnPresentationFactory.class);
+ }
/**
- * Returns the model proxy factory for the given element or
+ * Returns the model proxy factory for the given element or
* <code>null</code> if none.
*
* @param element element to retrieve adapter for
@@ -87,15 +87,15 @@ public class ViewerAdapterService {
}
/**
- * Returns the model proxy factory v.2 for the given element or
- * <code>null</code> if none.
- *
- * @param element element to retrieve adapter for
- * @return model proxy factory or <code>null</code>
- */
- public static IModelProxyFactory2 getModelProxyFactory2(Object element) {
- return (IModelProxyFactory2)getAdapter(element, IModelProxyFactory2.class);
- }
+ * Returns the model proxy factory v.2 for the given element or
+ * <code>null</code> if none.
+ *
+ * @param element element to retrieve adapter for
+ * @return model proxy factory or <code>null</code>
+ */
+ public static IModelProxyFactory2 getModelProxyFactory2(Object element) {
+ return (IModelProxyFactory2)getAdapter(element, IModelProxyFactory2.class);
+ }
/**
* Returns the memento provider for the given element or
@@ -108,15 +108,15 @@ public class ViewerAdapterService {
return (IElementMementoProvider)getAdapter(element, IElementMementoProvider.class);
}
- /**
- * Returns the element editor for the given element or <code>null</code>.
- *
- * @param element element to retrieve adapter for
- * @return element editor or <code>null</code>
- */
- public static IElementEditor getElementEditor(Object element) {
- return (IElementEditor)getAdapter(element, IElementEditor.class);
- }
+ /**
+ * Returns the element editor for the given element or <code>null</code>.
+ *
+ * @param element element to retrieve adapter for
+ * @return element editor or <code>null</code>
+ */
+ public static IElementEditor getElementEditor(Object element) {
+ return (IElementEditor)getAdapter(element, IElementEditor.class);
+ }
/**
* Creates and returns the selection policy associated with the given selection
@@ -138,16 +138,16 @@ public class ViewerAdapterService {
return null;
}
- /**
- * Returns the viewer input provider for the given element or
- * <code>null</code> if none.
- *
- * @param element element to retrieve adapter for
- * @return viewer input provider or <code>null</code>
- */
- public static IViewerInputProvider getInputProvider(Object element) {
- return (IViewerInputProvider)getAdapter(element, IViewerInputProvider.class);
- }
+ /**
+ * Returns the viewer input provider for the given element or
+ * <code>null</code> if none.
+ *
+ * @param element element to retrieve adapter for
+ * @return viewer input provider or <code>null</code>
+ */
+ public static IViewerInputProvider getInputProvider(Object element) {
+ return (IViewerInputProvider)getAdapter(element, IViewerInputProvider.class);
+ }
/**
* Returns an adapter of the specified type for the given object or <code>null</code>
@@ -158,6 +158,6 @@ public class ViewerAdapterService {
* @return adapter or <code>null</code>
*/
private static Object getAdapter(Object element, Class<?> type) {
- return DebugPlugin.getAdapter(element, type);
+ return DebugPlugin.getAdapter(element, type);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerInputUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerInputUpdate.java
index 77ac587fd..60336ac97 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerInputUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerInputUpdate.java
@@ -33,90 +33,90 @@ import org.eclipse.ui.progress.WorkbenchJob;
*/
public class ViewerInputUpdate extends Request implements IViewerInputUpdate {
- /**
- * Presentation context
- */
- private IPresentationContext fContext;
-
- /**
- * New viewer input
- */
- private Object fSource;
-
- /**
- * Whether this update is done
- */
- private boolean fDone;
-
- /**
- * Viewer input to use
- */
- private Object fInputElement;
-
- /**
- * Viewer input at the time the request was made
- */
- private Object fViewerInput;
-
- /**
- * Client making request
- */
- private IViewerInputRequestor fRequestor;
-
- /**
- * When <code>done()</code> is called, the viewer must be informed that the update is complete in the UI thread.
- */
- protected WorkbenchJob fViewerInputUpdateJob = new WorkbenchJob("Asynchronous viewer input update") { //$NON-NLS-1$
- @Override
+ /**
+ * Presentation context
+ */
+ private IPresentationContext fContext;
+
+ /**
+ * New viewer input
+ */
+ private Object fSource;
+
+ /**
+ * Whether this update is done
+ */
+ private boolean fDone;
+
+ /**
+ * Viewer input to use
+ */
+ private Object fInputElement;
+
+ /**
+ * Viewer input at the time the request was made
+ */
+ private Object fViewerInput;
+
+ /**
+ * Client making request
+ */
+ private IViewerInputRequestor fRequestor;
+
+ /**
+ * When <code>done()</code> is called, the viewer must be informed that the update is complete in the UI thread.
+ */
+ protected WorkbenchJob fViewerInputUpdateJob = new WorkbenchJob("Asynchronous viewer input update") { //$NON-NLS-1$
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (ViewerInputUpdate.this.isCanceled()){
- return Status.CANCEL_STATUS;
- }
- fRequestor.viewerInputComplete(ViewerInputUpdate.this);
- return Status.OK_STATUS;
- }
- };
-
- /**
- * Constructs a viewer input update request.
- *
- * @param context presentation context
- * @param viewerInput viewer input at the time the request was made
- * @param requestor client making the request
- * @param source source from which to derive a viewer input
- */
- public ViewerInputUpdate(IPresentationContext context, Object viewerInput, IViewerInputRequestor requestor, Object source){
- fContext = context;
- fSource = source;
- fRequestor = requestor;
- fViewerInputUpdateJob.setSystem(true);
- fViewerInput = viewerInput;
- }
+ if (ViewerInputUpdate.this.isCanceled()){
+ return Status.CANCEL_STATUS;
+ }
+ fRequestor.viewerInputComplete(ViewerInputUpdate.this);
+ return Status.OK_STATUS;
+ }
+ };
+
+ /**
+ * Constructs a viewer input update request.
+ *
+ * @param context presentation context
+ * @param viewerInput viewer input at the time the request was made
+ * @param requestor client making the request
+ * @param source source from which to derive a viewer input
+ */
+ public ViewerInputUpdate(IPresentationContext context, Object viewerInput, IViewerInputRequestor requestor, Object source){
+ fContext = context;
+ fSource = source;
+ fRequestor = requestor;
+ fViewerInputUpdateJob.setSystem(true);
+ fViewerInput = viewerInput;
+ }
@Override
public IPresentationContext getPresentationContext() {
return fContext;
}
- @Override
+ @Override
public final void done() {
- synchronized (this) {
- if (isDone()) {
- return;
- }
- fDone = true;
+ synchronized (this) {
+ if (isDone()) {
+ return;
+ }
+ fDone = true;
}
- fViewerInputUpdateJob.schedule();
+ fViewerInputUpdateJob.schedule();
}
- /**
- * Returns whether this request is done yet.
- *
- * @return whether this request is done yet
- */
- protected synchronized boolean isDone() {
- return fDone;
- }
+ /**
+ * Returns whether this request is done yet.
+ *
+ * @return whether this request is done yet
+ */
+ protected synchronized boolean isDone() {
+ return fDone;
+ }
@Override
public Object getElement() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
index 4fb884148..4ddb63f31 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java
@@ -77,208 +77,208 @@ import org.eclipse.ui.XMLMemento;
*/
class ViewerStateTracker {
- // State update type constants used in notifying listeners
- static final int STATE_SAVE_SEQUENCE_BEGINS = 4;
- static final int STATE_SAVE_SEQUENCE_COMPLETE = 5;
- static final int STATE_RESTORE_SEQUENCE_BEGINS = 6;
- static final int STATE_RESTORE_SEQUENCE_COMPLETE = 7;
-
- /**
- * Dummy marker element used in the state delta. The marker indicates that a
- * given element in the pending state delta has been removed. It replaces
- * the original element so that it may optionally be garbage collected.
- */
- private final static String ELEMENT_REMOVED = "ELEMENT_REMOVED"; //$NON-NLS-1$
-
- /**
- * Collector of memento encoding requests.
- */
- interface IElementMementoCollector {
-
- /**
- * Adds the request to this manager.
- *
- * @param request to add
- */
- void addRequest(ElementMementoRequest request);
-
- /**
- * Notification the request is complete.
- *
- * @param request that was completed
- */
- void requestComplete(ElementMementoRequest request);
-
- /**
- * Process the queued requests. Accepts no more new requests.
- */
- void processReqeusts();
-
- /**
- * Cancels the requests in progress.
- */
- void cancel();
- }
-
- /**
- * LRU cache for viewer states
- */
+ // State update type constants used in notifying listeners
+ static final int STATE_SAVE_SEQUENCE_BEGINS = 4;
+ static final int STATE_SAVE_SEQUENCE_COMPLETE = 5;
+ static final int STATE_RESTORE_SEQUENCE_BEGINS = 6;
+ static final int STATE_RESTORE_SEQUENCE_COMPLETE = 7;
+
+ /**
+ * Dummy marker element used in the state delta. The marker indicates that a
+ * given element in the pending state delta has been removed. It replaces
+ * the original element so that it may optionally be garbage collected.
+ */
+ private final static String ELEMENT_REMOVED = "ELEMENT_REMOVED"; //$NON-NLS-1$
+
+ /**
+ * Collector of memento encoding requests.
+ */
+ interface IElementMementoCollector {
+
+ /**
+ * Adds the request to this manager.
+ *
+ * @param request to add
+ */
+ void addRequest(ElementMementoRequest request);
+
+ /**
+ * Notification the request is complete.
+ *
+ * @param request that was completed
+ */
+ void requestComplete(ElementMementoRequest request);
+
+ /**
+ * Process the queued requests. Accepts no more new requests.
+ */
+ void processReqeusts();
+
+ /**
+ * Cancels the requests in progress.
+ */
+ void cancel();
+ }
+
+ /**
+ * LRU cache for viewer states
+ */
class LRUMap<K, V> extends LinkedHashMap<K, V> {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- private int fMaxSize;
+ private int fMaxSize;
- LRUMap(int maxSize) {
- super();
- fMaxSize = maxSize;
- }
+ LRUMap(int maxSize) {
+ super();
+ fMaxSize = maxSize;
+ }
- @Override
+ @Override
protected boolean removeEldestEntry(Entry<K, V> eldest) {
- return size() > fMaxSize;
- }
- }
-
- /**
- * Content provider that is using this state tracker.
- */
- private TreeModelContentProvider fContentProvider;
-
- ViewerStateTracker(TreeModelContentProvider contentProvider) {
- fContentProvider = contentProvider;
- }
-
- /**
- * Map of viewer states keyed by viewer input mementos
- */
+ return size() > fMaxSize;
+ }
+ }
+
+ /**
+ * Content provider that is using this state tracker.
+ */
+ private TreeModelContentProvider fContentProvider;
+
+ ViewerStateTracker(TreeModelContentProvider contentProvider) {
+ fContentProvider = contentProvider;
+ }
+
+ /**
+ * Map of viewer states keyed by viewer input mementos
+ */
private Map<String, ModelDelta> fViewerStates = new LRUMap<>(20);
- /**
- * Pending viewer state to be restored
- */
- private ModelDelta fPendingState = null;
+ /**
+ * Pending viewer state to be restored
+ */
+ private ModelDelta fPendingState = null;
- /**
- * Flag indicating that the content provider is performing
- * state restore operations.
- */
- private boolean fInStateRestore = false;
+ /**
+ * Flag indicating that the content provider is performing
+ * state restore operations.
+ */
+ private boolean fInStateRestore = false;
- /**
- * State update listeners
- */
+ /**
+ * State update listeners
+ */
private ListenerList<IStateUpdateListener> fStateUpdateListeners = new ListenerList<>();
- /**
- * Postpone restoring REVEAL element until the current updates are complete.
- * See bug 324100
- */
- protected PendingRevealDelta fPendingSetTopItem = null;
+ /**
+ * Postpone restoring REVEAL element until the current updates are complete.
+ * See bug 324100
+ */
+ protected PendingRevealDelta fPendingSetTopItem = null;
- /**
- * Set of IMementoManager's that are currently saving state
- */
+ /**
+ * Set of IMementoManager's that are currently saving state
+ */
private Set<IElementMementoCollector> fPendingStateSaves = new HashSet<>();
- /**
- * Used to queue a viewer input for state restore
- */
- private Object fQueuedRestore = null;
+ /**
+ * Used to queue a viewer input for state restore
+ */
+ private Object fQueuedRestore = null;
- /**
- * Object used to key compare requests in map.
- */
- private static class CompareRequestKey {
+ /**
+ * Object used to key compare requests in map.
+ */
+ private static class CompareRequestKey {
- CompareRequestKey(TreePath path, IModelDelta delta) {
- fPath = path;
- fDelta = delta;
- }
+ CompareRequestKey(TreePath path, IModelDelta delta) {
+ fPath = path;
+ fDelta = delta;
+ }
- TreePath fPath;
- IModelDelta fDelta;
+ TreePath fPath;
+ IModelDelta fDelta;
- @Override
+ @Override
public boolean equals(Object obj) {
- if (obj instanceof CompareRequestKey) {
- CompareRequestKey key = (CompareRequestKey) obj;
- return key.fDelta.equals(fDelta) && key.fPath.equals(fPath);
- }
- return false;
- }
-
- @Override
+ if (obj instanceof CompareRequestKey) {
+ CompareRequestKey key = (CompareRequestKey) obj;
+ return key.fDelta.equals(fDelta) && key.fPath.equals(fPath);
+ }
+ return false;
+ }
+
+ @Override
public int hashCode() {
- return fDelta.hashCode() + fPath.hashCode();
- }
- }
+ return fDelta.hashCode() + fPath.hashCode();
+ }
+ }
- /**
- * Compare requests that are currently running.
- */
+ /**
+ * Compare requests that are currently running.
+ */
private Map<CompareRequestKey, ElementCompareRequest> fCompareRequestsInProgress = new LinkedHashMap<>();
- /**
- * Cancels pending updates.
- */
- void dispose() {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+ /**
+ * Cancels pending updates.
+ */
+ void dispose() {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
for (IElementMementoCollector emc : fPendingStateSaves) {
emc.cancel();
- }
- fStateUpdateListeners.clear();
+ }
+ fStateUpdateListeners.clear();
for (ElementCompareRequest ecr : fCompareRequestsInProgress.values()) {
ecr.cancel();
- }
- fCompareRequestsInProgress.clear();
-
- if (fPendingSetTopItem != null) {
- fPendingSetTopItem.dispose();
- }
- }
-
- /**
- * Restores viewer state for the given input
- *
- * @param input
- * viewer input
- */
- private void startRestoreViewerState(final Object input) {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- fPendingState = null;
- final IElementMementoProvider defaultProvider = ViewerAdapterService.getMementoProvider(input);
- if (defaultProvider != null) {
- // build a model delta representing expansion and selection state
- final ModelDelta delta = new ModelDelta(input, IModelDelta.NO_CHANGE);
- final XMLMemento inputMemento = XMLMemento.createWriteRoot("VIEWER_INPUT_MEMENTO"); //$NON-NLS-1$
- final IElementMementoCollector manager = new IElementMementoCollector() {
-
- private IElementMementoRequest fRequest;
-
- @Override
+ }
+ fCompareRequestsInProgress.clear();
+
+ if (fPendingSetTopItem != null) {
+ fPendingSetTopItem.dispose();
+ }
+ }
+
+ /**
+ * Restores viewer state for the given input
+ *
+ * @param input
+ * viewer input
+ */
+ private void startRestoreViewerState(final Object input) {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ fPendingState = null;
+ final IElementMementoProvider defaultProvider = ViewerAdapterService.getMementoProvider(input);
+ if (defaultProvider != null) {
+ // build a model delta representing expansion and selection state
+ final ModelDelta delta = new ModelDelta(input, IModelDelta.NO_CHANGE);
+ final XMLMemento inputMemento = XMLMemento.createWriteRoot("VIEWER_INPUT_MEMENTO"); //$NON-NLS-1$
+ final IElementMementoCollector manager = new IElementMementoCollector() {
+
+ private IElementMementoRequest fRequest;
+
+ @Override
public void requestComplete(ElementMementoRequest request) {
- if (fContentProvider.isDisposed()) {
+ if (fContentProvider.isDisposed()) {
return;
}
- notifyStateUpdate(input, TreeModelContentProvider.UPDATE_COMPLETE, request);
-
- if (!request.isCanceled() && (request.getStatus() == null || request.getStatus().isOK())) {
- XMLMemento keyMemento = (XMLMemento) delta.getElement();
- StringWriter writer = new StringWriter();
- try {
- keyMemento.save(writer);
- final String keyMementoString = writer.toString();
- ModelDelta stateDelta = fViewerStates.get(keyMementoString);
- if (stateDelta != null) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - MATCHING STATE FOUND"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // Process start of restore in an async cycle because we may still be inside inputChanged()
- // call. I.e. the "input.equals(fContentProvider.getViewer().getInput())" test may fail.
+ notifyStateUpdate(input, TreeModelContentProvider.UPDATE_COMPLETE, request);
+
+ if (!request.isCanceled() && (request.getStatus() == null || request.getStatus().isOK())) {
+ XMLMemento keyMemento = (XMLMemento) delta.getElement();
+ StringWriter writer = new StringWriter();
+ try {
+ keyMemento.save(writer);
+ final String keyMementoString = writer.toString();
+ ModelDelta stateDelta = fViewerStates.get(keyMementoString);
+ if (stateDelta != null) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - MATCHING STATE FOUND"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // Process start of restore in an async cycle because we may still be inside inputChanged()
+ // call. I.e. the "input.equals(fContentProvider.getViewer().getInput())" test may fail.
fContentProvider.getViewer().getDisplay().asyncExec(() -> {
if (!fContentProvider.isDisposed()
&& input.equals(fContentProvider.getViewer().getInput())) {
@@ -303,85 +303,85 @@ class ViewerStateTracker {
}
}
});
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - NO MATCHING STATE"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- } else {
- notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null);
- }
- }
-
- @Override
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - NO MATCHING STATE"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
+ } else {
+ notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null);
+ }
+ }
+
+ @Override
public void processReqeusts() {
- notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null);
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE INPUT COMARE BEGIN : " + fRequest); //$NON-NLS-1$
- }
- notifyStateUpdate(input, TreeModelContentProvider.UPDATE_BEGINS, fRequest);
- defaultProvider.encodeElements(new IElementMementoRequest[] { fRequest });
- }
-
- @Override
+ notifyStateUpdate(input, STATE_RESTORE_SEQUENCE_BEGINS, null);
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE INPUT COMARE BEGIN : " + fRequest); //$NON-NLS-1$
+ }
+ notifyStateUpdate(input, TreeModelContentProvider.UPDATE_BEGINS, fRequest);
+ defaultProvider.encodeElements(new IElementMementoRequest[] { fRequest });
+ }
+
+ @Override
public void addRequest(ElementMementoRequest req) {
- fRequest = req;
- }
+ fRequest = req;
+ }
- @Override
+ @Override
public void cancel() {
- // not used
- }
-
- };
- manager.addRequest(
- new ElementMementoRequest(fContentProvider, fContentProvider.getViewer().getInput(), manager,
- delta.getElement(), fContentProvider.getViewerTreePath(delta), inputMemento, delta));
- manager.processReqeusts();
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE: No input memento provider"); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Appends the state of the given subtree to the current pending delta.
- * @param path Path to subtree to restore.
- */
- void appendToPendingStateDelta(final TreePath path) {
- if (fContentProvider.getViewer() == null)
+ // not used
+ }
+
+ };
+ manager.addRequest(
+ new ElementMementoRequest(fContentProvider, fContentProvider.getViewer().getInput(), manager,
+ delta.getElement(), fContentProvider.getViewerTreePath(delta), inputMemento, delta));
+ manager.processReqeusts();
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE: No input memento provider"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * Appends the state of the given subtree to the current pending delta.
+ * @param path Path to subtree to restore.
+ */
+ void appendToPendingStateDelta(final TreePath path) {
+ if (fContentProvider.getViewer() == null)
{
return; // Not initialized yet.
}
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE APPEND BEGIN: " + path.getLastSegment()); //$NON-NLS-1$
- }
-
- // build a model delta representing expansion and selection state
- final ModelDelta appendDeltaRoot = new ModelDelta(fContentProvider.getViewer().getInput(), IModelDelta.NO_CHANGE);
- ModelDelta delta = appendDeltaRoot;
- for (int i = 0; i < path.getSegmentCount(); i++) {
- delta = delta.addNode(path.getSegment(i), IModelDelta.NO_CHANGE);
- }
-
- if (!fContentProvider.getViewer().saveElementState(path, delta, IModelDelta.COLLAPSE | IModelDelta.EXPAND | IModelDelta.SELECT)) {
- // Path to save the state was not found or there was no
- // (expansion) state to save! Abort.
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE APPEND CANCEL: Element " + path.getLastSegment() + " not found."); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return;
- }
-
- // Append a marker CONTENT flag to all the delta nodes that contain the
- // EXPAND node. These
- // markers are used by the restore logic to know when a delta node can
- // be removed.
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE APPEND BEGIN: " + path.getLastSegment()); //$NON-NLS-1$
+ }
+
+ // build a model delta representing expansion and selection state
+ final ModelDelta appendDeltaRoot = new ModelDelta(fContentProvider.getViewer().getInput(), IModelDelta.NO_CHANGE);
+ ModelDelta delta = appendDeltaRoot;
+ for (int i = 0; i < path.getSegmentCount(); i++) {
+ delta = delta.addNode(path.getSegment(i), IModelDelta.NO_CHANGE);
+ }
+
+ if (!fContentProvider.getViewer().saveElementState(path, delta, IModelDelta.COLLAPSE | IModelDelta.EXPAND | IModelDelta.SELECT)) {
+ // Path to save the state was not found or there was no
+ // (expansion) state to save! Abort.
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE APPEND CANCEL: Element " + path.getLastSegment() + " not found."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return;
+ }
+
+ // Append a marker CONTENT flag to all the delta nodes that contain the
+ // EXPAND node. These
+ // markers are used by the restore logic to know when a delta node can
+ // be removed.
delta.accept((d, depth) -> {
if ((d.getFlags() & IModelDelta.EXPAND) != 0) {
((ModelDelta) d).setFlags(d.getFlags() | IModelDelta.CONTENT);
@@ -389,21 +389,21 @@ class ViewerStateTracker {
return true;
});
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tAPPEND DELTA: " + appendDeltaRoot); //$NON-NLS-1$
- }
-
- if (fPendingState != null) {
- // If the restore for the current input was never completed,
- // preserve
- // that restore along with the restore that was completed.
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tAPPEND OUTSTANDING RESTORE: " + fPendingState); //$NON-NLS-1$
- }
-
- // If the append delta is generated for a sub-tree, copy the pending delta
- // attributes into the pending delta.
- if (path.getSegmentCount() > 0) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tAPPEND DELTA: " + appendDeltaRoot); //$NON-NLS-1$
+ }
+
+ if (fPendingState != null) {
+ // If the restore for the current input was never completed,
+ // preserve
+ // that restore along with the restore that was completed.
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tAPPEND OUTSTANDING RESTORE: " + fPendingState); //$NON-NLS-1$
+ }
+
+ // If the append delta is generated for a sub-tree, copy the pending delta
+ // attributes into the pending delta.
+ if (path.getSegmentCount() > 0) {
fPendingState.accept((pendingDeltaNode, depth) -> {
TreePath pendingDeltaPath = fContentProvider.getViewerTreePath(pendingDeltaNode);
if (path.startsWith(pendingDeltaPath, null)) {
@@ -415,9 +415,9 @@ class ViewerStateTracker {
}
return false;
});
- }
+ }
- // Copy the pending state into the new appended state.
+ // Copy the pending state into the new appended state.
fPendingState.accept((pendingDeltaNode, depth) -> {
// Skip the top element
if (pendingDeltaNode.getParentDelta() == null) {
@@ -455,80 +455,80 @@ class ViewerStateTracker {
return pendingDeltaNode.getChildCount() > 0;
}
});
- }
-
- if (appendDeltaRoot.getChildDeltas().length > 0) {
- // Set the new delta root as the pending state delta.
- if (fPendingState == null) {
- notifyStateUpdate(appendDeltaRoot.getElement(), STATE_RESTORE_SEQUENCE_BEGINS, null);
- }
- fPendingState = appendDeltaRoot;
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE APPEND COMPLETE " + fPendingState); //$NON-NLS-1$
- }
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE APPEND CANCELED: No Data"); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Saves the viewer's state for the previous input. * @param oldInput
- * @param input the {@link ModelDelta} input
- */
- protected void saveViewerState(Object input) {
+ }
+
+ if (appendDeltaRoot.getChildDeltas().length > 0) {
+ // Set the new delta root as the pending state delta.
+ if (fPendingState == null) {
+ notifyStateUpdate(appendDeltaRoot.getElement(), STATE_RESTORE_SEQUENCE_BEGINS, null);
+ }
+ fPendingState = appendDeltaRoot;
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE APPEND COMPLETE " + fPendingState); //$NON-NLS-1$
+ }
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE APPEND CANCELED: No Data"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * Saves the viewer's state for the previous input. * @param oldInput
+ * @param input the {@link ModelDelta} input
+ */
+ protected void saveViewerState(Object input) {
for (Iterator<ElementCompareRequest> itr = fCompareRequestsInProgress.values().iterator(); itr.hasNext();) {
- itr.next().cancel();
- itr.remove();
- }
-
- IElementMementoProvider stateProvider = ViewerAdapterService.getMementoProvider(input);
- if (stateProvider != null) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE SAVE BEGIN: " + input); //$NON-NLS-1$
- }
-
- // build a model delta representing expansion and selection state
- final ModelDelta saveDeltaRoot = new ModelDelta(input, IModelDelta.NO_CHANGE);
- buildViewerState(saveDeltaRoot);
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSAVE DELTA FROM VIEW:\n" + saveDeltaRoot); //$NON-NLS-1$
- }
-
- // check if pending restore reveal
- if (fPendingSetTopItem != null) {
- // set back the pending reveal flag
- ModelDelta revealDelta = fPendingSetTopItem.getDelta();
- revealDelta.setFlags(revealDelta.getFlags() | IModelDelta.REVEAL);
-
- fPendingSetTopItem.dispose();
-
- ModelDelta saveDeltaNode = findSubDeltaParent(saveDeltaRoot, revealDelta);
- if (saveDeltaNode != null) {
- clearRevealFlag(saveDeltaRoot);
- ModelDelta child = saveDeltaNode.getChildDelta(revealDelta.getElement(), revealDelta.getIndex());
- if (child != null) {
- child.setFlags(child.getFlags() | IModelDelta.REVEAL);
- } else {
- // the node should be added if not found
- saveDeltaNode.setChildCount(revealDelta.getParentDelta().getChildCount());
- copyIntoDelta(revealDelta, saveDeltaNode);
- }
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSKIPPED: " + revealDelta.getElement()); //$NON-NLS-1$
- }
- }
- }
-
- if (fPendingState != null) {
- // If the restore for the current input was never completed,
- // preserve
- // that restore along with the restore that was completed.
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSAVE OUTSTANDING RESTORE: " + fPendingState); //$NON-NLS-1$
- }
+ itr.next().cancel();
+ itr.remove();
+ }
+
+ IElementMementoProvider stateProvider = ViewerAdapterService.getMementoProvider(input);
+ if (stateProvider != null) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE SAVE BEGIN: " + input); //$NON-NLS-1$
+ }
+
+ // build a model delta representing expansion and selection state
+ final ModelDelta saveDeltaRoot = new ModelDelta(input, IModelDelta.NO_CHANGE);
+ buildViewerState(saveDeltaRoot);
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSAVE DELTA FROM VIEW:\n" + saveDeltaRoot); //$NON-NLS-1$
+ }
+
+ // check if pending restore reveal
+ if (fPendingSetTopItem != null) {
+ // set back the pending reveal flag
+ ModelDelta revealDelta = fPendingSetTopItem.getDelta();
+ revealDelta.setFlags(revealDelta.getFlags() | IModelDelta.REVEAL);
+
+ fPendingSetTopItem.dispose();
+
+ ModelDelta saveDeltaNode = findSubDeltaParent(saveDeltaRoot, revealDelta);
+ if (saveDeltaNode != null) {
+ clearRevealFlag(saveDeltaRoot);
+ ModelDelta child = saveDeltaNode.getChildDelta(revealDelta.getElement(), revealDelta.getIndex());
+ if (child != null) {
+ child.setFlags(child.getFlags() | IModelDelta.REVEAL);
+ } else {
+ // the node should be added if not found
+ saveDeltaNode.setChildCount(revealDelta.getParentDelta().getChildCount());
+ copyIntoDelta(revealDelta, saveDeltaNode);
+ }
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSKIPPED: " + revealDelta.getElement()); //$NON-NLS-1$
+ }
+ }
+ }
+
+ if (fPendingState != null) {
+ // If the restore for the current input was never completed,
+ // preserve
+ // that restore along with the restore that was completed.
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSAVE OUTSTANDING RESTORE: " + fPendingState); //$NON-NLS-1$
+ }
IModelDeltaVisitor pendingStateVisitor = (pendingDeltaNode, depth) -> {
// Ignore the top element.
@@ -577,184 +577,184 @@ class ViewerStateTracker {
return pendingDeltaNode.getChildCount() > 0;
}
};
- fPendingState.accept(pendingStateVisitor);
- }
-
- if (saveDeltaRoot.getChildDeltas().length > 0) {
- // encode delta with mementos in place of elements, in non-UI
- // thread
- encodeDelta(saveDeltaRoot, stateProvider);
- } else {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE SAVE CANCELED, NO DATA"); //$NON-NLS-1$
- }
- }
- }
- }
-
- private void clearRevealFlag(ModelDelta saveRootDelta) {
+ fPendingState.accept(pendingStateVisitor);
+ }
+
+ if (saveDeltaRoot.getChildDeltas().length > 0) {
+ // encode delta with mementos in place of elements, in non-UI
+ // thread
+ encodeDelta(saveDeltaRoot, stateProvider);
+ } else {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE SAVE CANCELED, NO DATA"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ private void clearRevealFlag(ModelDelta saveRootDelta) {
IModelDeltaVisitor clearDeltaVisitor = (delta, depth) -> {
if ((delta.getFlags() & IModelDelta.REVEAL) != 0) {
((ModelDelta) delta).setFlags(delta.getFlags() & ~IModelDelta.REVEAL);
}
return true;
};
- saveRootDelta.accept(clearDeltaVisitor);
- }
+ saveRootDelta.accept(clearDeltaVisitor);
+ }
- private ModelDelta findSubDeltaParent(ModelDelta destinationDeltaRoot, IModelDelta subDelta) {
- // Create a path of elements to the sub-delta.
+ private ModelDelta findSubDeltaParent(ModelDelta destinationDeltaRoot, IModelDelta subDelta) {
+ // Create a path of elements to the sub-delta.
LinkedList<IModelDelta> deltaPath = new LinkedList<>();
- IModelDelta delta = subDelta;
- while (delta.getParentDelta() != null) {
- delta = delta.getParentDelta();
- deltaPath.addFirst(delta);
- }
-
- // For each element in the path of the sub-delta, find the corresponding
- // element in the destination delta
+ IModelDelta delta = subDelta;
+ while (delta.getParentDelta() != null) {
+ delta = delta.getParentDelta();
+ deltaPath.addFirst(delta);
+ }
+
+ // For each element in the path of the sub-delta, find the corresponding
+ // element in the destination delta
Iterator<IModelDelta> itr = deltaPath.iterator();
- // Skip the root element
- itr.next();
- ModelDelta saveDelta = destinationDeltaRoot;
- while (saveDelta != null && itr.hasNext()) {
- IModelDelta itrDelta = itr.next();
- saveDelta = saveDelta.getChildDelta(itrDelta.getElement(), itrDelta.getIndex());
- }
- return saveDelta;
- }
-
- private ModelDelta findDeltaForPath(ModelDelta root, TreePath path) {
- ModelDelta delta = root;
- for (int i = 0; i < path.getSegmentCount(); i++) {
- delta = delta.getChildDelta(path.getSegment(i));
- if (delta == null) {
- return null;
- }
- }
- return delta;
- }
-
- private boolean isDeltaInParent(IModelDelta delta, ModelDelta destParent) {
- return destParent.getChildDelta(delta.getElement(), delta.getIndex()) != null;
- }
-
- private void copyIntoDelta(IModelDelta delta, ModelDelta destParent) {
- ModelDelta newDelta = destParent.addNode(delta.getElement(), delta.getIndex(), delta.getFlags(), delta
- .getChildCount());
- for (int i = 0; i < delta.getChildDeltas().length; i++) {
- copyIntoDelta(delta.getChildDeltas()[i], newDelta);
- }
- }
-
- /**
- * Encodes delta elements into mementos using the given provider.
- * @param rootDelta the {@link ModelDelta} to encode
- * @param defaultProvider the default provider to use when processing the given delta
- *
- */
- protected void encodeDelta(final ModelDelta rootDelta, final IElementMementoProvider defaultProvider) {
- final Object input = rootDelta.getElement();
- final XMLMemento inputMemento = XMLMemento.createWriteRoot("VIEWER_INPUT_MEMENTO"); //$NON-NLS-1$
- final XMLMemento childrenMemento = XMLMemento.createWriteRoot("CHILDREN_MEMENTO"); //$NON-NLS-1$
- final IElementMementoCollector manager = new IElementMementoCollector() {
-
- /**
- * list of memento fRequests
- */
+ // Skip the root element
+ itr.next();
+ ModelDelta saveDelta = destinationDeltaRoot;
+ while (saveDelta != null && itr.hasNext()) {
+ IModelDelta itrDelta = itr.next();
+ saveDelta = saveDelta.getChildDelta(itrDelta.getElement(), itrDelta.getIndex());
+ }
+ return saveDelta;
+ }
+
+ private ModelDelta findDeltaForPath(ModelDelta root, TreePath path) {
+ ModelDelta delta = root;
+ for (int i = 0; i < path.getSegmentCount(); i++) {
+ delta = delta.getChildDelta(path.getSegment(i));
+ if (delta == null) {
+ return null;
+ }
+ }
+ return delta;
+ }
+
+ private boolean isDeltaInParent(IModelDelta delta, ModelDelta destParent) {
+ return destParent.getChildDelta(delta.getElement(), delta.getIndex()) != null;
+ }
+
+ private void copyIntoDelta(IModelDelta delta, ModelDelta destParent) {
+ ModelDelta newDelta = destParent.addNode(delta.getElement(), delta.getIndex(), delta.getFlags(), delta
+ .getChildCount());
+ for (int i = 0; i < delta.getChildDeltas().length; i++) {
+ copyIntoDelta(delta.getChildDeltas()[i], newDelta);
+ }
+ }
+
+ /**
+ * Encodes delta elements into mementos using the given provider.
+ * @param rootDelta the {@link ModelDelta} to encode
+ * @param defaultProvider the default provider to use when processing the given delta
+ *
+ */
+ protected void encodeDelta(final ModelDelta rootDelta, final IElementMementoProvider defaultProvider) {
+ final Object input = rootDelta.getElement();
+ final XMLMemento inputMemento = XMLMemento.createWriteRoot("VIEWER_INPUT_MEMENTO"); //$NON-NLS-1$
+ final XMLMemento childrenMemento = XMLMemento.createWriteRoot("CHILDREN_MEMENTO"); //$NON-NLS-1$
+ final IElementMementoCollector manager = new IElementMementoCollector() {
+
+ /**
+ * list of memento fRequests
+ */
private List<IElementMementoRequest> fRequests = new ArrayList<>();
- /**
- * Flag indicating whether the encoding of delta has been canceled.
- */
- private boolean fCanceled = false;
+ /**
+ * Flag indicating whether the encoding of delta has been canceled.
+ */
+ private boolean fCanceled = false;
- @Override
+ @Override
public void requestComplete(ElementMementoRequest request) {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- notifyStateUpdate(input, TreeModelContentProvider.UPDATE_COMPLETE, request);
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSTATE END: " + request); //$NON-NLS-1$
- }
-
- if (!request.isCanceled() && (request.getStatus() == null || request.getStatus().isOK())) {
- boolean requestsComplted = false;
- if (!fCanceled) {
- fRequests.remove(request);
- requestsComplted = fRequests.isEmpty();
- }
- if (requestsComplted) {
- XMLMemento keyMemento = (XMLMemento) rootDelta.getElement();
- StringWriter writer = new StringWriter();
- try {
- keyMemento.save(writer);
- fViewerStates.put(writer.toString(), rootDelta);
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE SAVE COMPLETED: " + rootDelta); //$NON-NLS-1$
- }
- stateSaveComplete(input, this);
- }
- } else {
- cancel();
- }
- }
-
- @Override
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ notifyStateUpdate(input, TreeModelContentProvider.UPDATE_COMPLETE, request);
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSTATE END: " + request); //$NON-NLS-1$
+ }
+
+ if (!request.isCanceled() && (request.getStatus() == null || request.getStatus().isOK())) {
+ boolean requestsComplted = false;
+ if (!fCanceled) {
+ fRequests.remove(request);
+ requestsComplted = fRequests.isEmpty();
+ }
+ if (requestsComplted) {
+ XMLMemento keyMemento = (XMLMemento) rootDelta.getElement();
+ StringWriter writer = new StringWriter();
+ try {
+ keyMemento.save(writer);
+ fViewerStates.put(writer.toString(), rootDelta);
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE SAVE COMPLETED: " + rootDelta); //$NON-NLS-1$
+ }
+ stateSaveComplete(input, this);
+ }
+ } else {
+ cancel();
+ }
+ }
+
+ @Override
public void cancel() {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
- if (fCanceled) {
- return;
- }
+ if (fCanceled) {
+ return;
+ }
- fCanceled = true;
+ fCanceled = true;
for (IElementMementoRequest req : fRequests) {
- req.cancel();
- }
- fRequests.clear();
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE SAVE ABORTED: " + rootDelta.getElement()); //$NON-NLS-1$
- }
- stateSaveComplete(input, this);
- }
-
- @Override
+ req.cancel();
+ }
+ fRequests.clear();
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE SAVE ABORTED: " + rootDelta.getElement()); //$NON-NLS-1$
+ }
+ stateSaveComplete(input, this);
+ }
+
+ @Override
public void processReqeusts() {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
Map<IElementMementoProvider, List<IElementMementoRequest>> providers = new HashMap<>();
for (IElementMementoRequest request : fRequests) {
- notifyStateUpdate(input, TreeModelContentProvider.UPDATE_BEGINS, request);
- IElementMementoProvider provider = ViewerAdapterService.getMementoProvider(request.getElement());
- if (provider == null) {
- provider = defaultProvider;
- }
+ notifyStateUpdate(input, TreeModelContentProvider.UPDATE_BEGINS, request);
+ IElementMementoProvider provider = ViewerAdapterService.getMementoProvider(request.getElement());
+ if (provider == null) {
+ provider = defaultProvider;
+ }
List<IElementMementoRequest> reqs = providers.get(provider);
- if (reqs == null) {
+ if (reqs == null) {
reqs = new ArrayList<>();
- providers.put(provider, reqs);
- }
- reqs.add(request);
- }
+ providers.put(provider, reqs);
+ }
+ reqs.add(request);
+ }
for (Entry<IElementMementoProvider, List<IElementMementoRequest>> entry : providers.entrySet()) {
- IElementMementoProvider provider = entry.getKey();
+ IElementMementoProvider provider = entry.getKey();
List<IElementMementoRequest> reqs = entry.getValue();
provider.encodeElements(reqs.toArray(new IElementMementoRequest[reqs.size()]));
- }
- }
+ }
+ }
- @Override
+ @Override
public void addRequest(ElementMementoRequest request) {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
- fRequests.add(request);
- }
+ fRequests.add(request);
+ }
- };
+ };
IModelDeltaVisitor visitor = (delta, depth) -> {
// Add the CONTENT flag to all nodes with an EXPAND flag.
// During restoring, this flag is used as a marker indicating
@@ -778,94 +778,94 @@ class ViewerStateTracker {
}
return true;
};
- rootDelta.accept(visitor);
- stateSaveStarted(input, manager);
- manager.processReqeusts();
- }
-
- /**
- * Called when a state save is starting.
- * @param input the {@link ModelDelta} input
- * @param manager the manager to notify
- */
- private void stateSaveStarted(Object input, IElementMementoCollector manager) {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- notifyStateUpdate(input, STATE_SAVE_SEQUENCE_BEGINS, null);
- fPendingStateSaves.add(manager);
- }
-
- /**
- * Called when a state save is complete.
- * @param input the {@link ModelDelta} input
- * @param manager the manager to notify
- */
- private void stateSaveComplete(Object input, IElementMementoCollector manager) {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- notifyStateUpdate(input, STATE_SAVE_SEQUENCE_COMPLETE, null);
- fPendingStateSaves.remove(manager);
- if (fQueuedRestore != null) {
- Object temp = fQueuedRestore;
- fQueuedRestore = null;
- restoreViewerState(temp);
- }
- }
-
- /**
- * Returns whether any state saving is in progress.
- *
- * @return whether any state saving is in progress
- */
- private boolean isSavingState() {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- return !fPendingStateSaves.isEmpty();
- }
-
- /**
- * Restores the viewer state unless a save is taking place. If a save is
- * taking place, the restore is queued.
- *
- * @param input
- * viewer input
- */
- protected void restoreViewerState(final Object input) {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- fPendingState = null;
- if (isSavingState()) {
- fQueuedRestore = input;
- } else {
- startRestoreViewerState(input);
- }
- }
-
-
- public void cancelRestore(final TreePath path, final int flags) {
- if (fInStateRestore) {
- // If we are currently processing pending state already, ignore
- // cancelRestore requests. These requests may be triggered in the viewer
- // by changes to the tree state (Bug 295585).
- return;
- }
-
- if ((flags & IModelDelta.REVEAL) != 0 && fPendingSetTopItem != null) {
- fPendingSetTopItem.dispose();
- return;
- }
-
- // Nothing else to do
- if (fPendingState == null) {
- return;
- }
-
- if ((flags & (IModelDelta.SELECT | IModelDelta.REVEAL)) != 0) {
- // If we're canceling reveal and this is waiting for updates to complete
- // then just cancel it and return
-
- // If we're canceling select or reveal, cancel it for all of pending deltas
- final int mask = flags & (IModelDelta.SELECT | IModelDelta.REVEAL);
+ rootDelta.accept(visitor);
+ stateSaveStarted(input, manager);
+ manager.processReqeusts();
+ }
+
+ /**
+ * Called when a state save is starting.
+ * @param input the {@link ModelDelta} input
+ * @param manager the manager to notify
+ */
+ private void stateSaveStarted(Object input, IElementMementoCollector manager) {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ notifyStateUpdate(input, STATE_SAVE_SEQUENCE_BEGINS, null);
+ fPendingStateSaves.add(manager);
+ }
+
+ /**
+ * Called when a state save is complete.
+ * @param input the {@link ModelDelta} input
+ * @param manager the manager to notify
+ */
+ private void stateSaveComplete(Object input, IElementMementoCollector manager) {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ notifyStateUpdate(input, STATE_SAVE_SEQUENCE_COMPLETE, null);
+ fPendingStateSaves.remove(manager);
+ if (fQueuedRestore != null) {
+ Object temp = fQueuedRestore;
+ fQueuedRestore = null;
+ restoreViewerState(temp);
+ }
+ }
+
+ /**
+ * Returns whether any state saving is in progress.
+ *
+ * @return whether any state saving is in progress
+ */
+ private boolean isSavingState() {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ return !fPendingStateSaves.isEmpty();
+ }
+
+ /**
+ * Restores the viewer state unless a save is taking place. If a save is
+ * taking place, the restore is queued.
+ *
+ * @param input
+ * viewer input
+ */
+ protected void restoreViewerState(final Object input) {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ fPendingState = null;
+ if (isSavingState()) {
+ fQueuedRestore = input;
+ } else {
+ startRestoreViewerState(input);
+ }
+ }
+
+
+ public void cancelRestore(final TreePath path, final int flags) {
+ if (fInStateRestore) {
+ // If we are currently processing pending state already, ignore
+ // cancelRestore requests. These requests may be triggered in the viewer
+ // by changes to the tree state (Bug 295585).
+ return;
+ }
+
+ if ((flags & IModelDelta.REVEAL) != 0 && fPendingSetTopItem != null) {
+ fPendingSetTopItem.dispose();
+ return;
+ }
+
+ // Nothing else to do
+ if (fPendingState == null) {
+ return;
+ }
+
+ if ((flags & (IModelDelta.SELECT | IModelDelta.REVEAL)) != 0) {
+ // If we're canceling reveal and this is waiting for updates to complete
+ // then just cancel it and return
+
+ // If we're canceling select or reveal, cancel it for all of pending deltas
+ final int mask = flags & (IModelDelta.SELECT | IModelDelta.REVEAL);
fPendingState.accept((delta, depth) -> {
int deltaFlags = delta.getFlags();
int newFlags = deltaFlags & ~mask;
@@ -879,10 +879,10 @@ class ViewerStateTracker {
((ModelDelta) delta).setFlags(newFlags);
return true;
});
- }
- if ((flags & ~(IModelDelta.SELECT | IModelDelta.REVEAL)) != 0) {
- final int mask = flags & ~(IModelDelta.SELECT | IModelDelta.REVEAL);
- // For other flags (EXPAND/COLLAPSE), cancel only from the matching path.
+ }
+ if ((flags & ~(IModelDelta.SELECT | IModelDelta.REVEAL)) != 0) {
+ final int mask = flags & ~(IModelDelta.SELECT | IModelDelta.REVEAL);
+ // For other flags (EXPAND/COLLAPSE), cancel only from the matching path.
fPendingState.accept((delta, depth) -> {
if (depth < path.getSegmentCount()) {
// Descend until we reach a matching depth.
@@ -926,30 +926,30 @@ class ViewerStateTracker {
return true;
}
});
- }
- }
-
-
- /**
- * Perform any restoration required for the given tree path.
- * <p>
- * This method is called after every viewer update completion to continue
- * restoring the expansion state that was previously saved.
- *
- * @param path the tree path to update
- * @param modelIndex the index in the current model
- * @param knowsHasChildren if the content provider knows it has children already
- * @param knowsChildCount if the content provider knows the current child count already
- * @param checkChildrenRealized if any realized children should be checked or not
- */
- void restorePendingStateOnUpdate(final TreePath path, final int modelIndex, final boolean knowsHasChildren,
- final boolean knowsChildCount, final boolean checkChildrenRealized)
- {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- if (fPendingState == null) {
- return;
- }
+ }
+ }
+
+
+ /**
+ * Perform any restoration required for the given tree path.
+ * <p>
+ * This method is called after every viewer update completion to continue
+ * restoring the expansion state that was previously saved.
+ *
+ * @param path the tree path to update
+ * @param modelIndex the index in the current model
+ * @param knowsHasChildren if the content provider knows it has children already
+ * @param knowsChildCount if the content provider knows the current child count already
+ * @param checkChildrenRealized if any realized children should be checked or not
+ */
+ void restorePendingStateOnUpdate(final TreePath path, final int modelIndex, final boolean knowsHasChildren,
+ final boolean knowsChildCount, final boolean checkChildrenRealized)
+ {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ if (fPendingState == null) {
+ return;
+ }
IModelDeltaVisitor visitor = (delta, depth) -> {
@@ -1000,81 +1000,81 @@ class ViewerStateTracker {
return element.equals(potentialMatch);
};
- try {
- fInStateRestore = true;
- fPendingState.accept(visitor);
- }
- finally {
- fInStateRestore = false;
- }
- checkIfRestoreComplete();
- }
-
- /**
- * Checks whether restoring pending state is already complete.
- */
- void checkIfRestoreComplete() {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- if (fPendingState == null) {
- return;
- }
-
- /**
- * Used to determine when restoration delta has been processed
- */
- class CheckState implements IModelDeltaVisitor {
- private boolean complete = true;
-
- @Override
+ try {
+ fInStateRestore = true;
+ fPendingState.accept(visitor);
+ }
+ finally {
+ fInStateRestore = false;
+ }
+ checkIfRestoreComplete();
+ }
+
+ /**
+ * Checks whether restoring pending state is already complete.
+ */
+ void checkIfRestoreComplete() {
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ if (fPendingState == null) {
+ return;
+ }
+
+ /**
+ * Used to determine when restoration delta has been processed
+ */
+ class CheckState implements IModelDeltaVisitor {
+ private boolean complete = true;
+
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- // Filter out the CONTENT flags from the delta flags, the content
- // flag is only used as a marker indicating that all the sub-elements
- // of a given delta have been retrieved.
- int flags = (delta.getFlags() & ~IModelDelta.CONTENT);
-
- if (flags != IModelDelta.NO_CHANGE) {
- IModelDelta parentDelta = delta.getParentDelta();
- // Remove the delta if :
- // - The parent delta has no more flags on it (the content flag is removed as well),
- // which means that parent element's children have been completely exposed.
- // - There are no more pending updates for the element.
- // - If element is a memento, there are no state requests pending.
- if (parentDelta != null && parentDelta.getFlags() == IModelDelta.NO_CHANGE) {
- TreePath deltaPath = fContentProvider.getViewerTreePath(delta);
- if ( !fContentProvider.areElementUpdatesPending(deltaPath) &&
- (!(delta.getElement() instanceof IMemento) || !areMementoUpdatesPending(delta)) )
- {
- removeDelta(delta);
- return false;
- }
- }
-
- if (flags != IModelDelta.REVEAL || (delta.getElement() instanceof IMemento)) {
- complete = false;
- return false;
- }
- }
- return true;
- }
-
- public boolean isComplete() {
- return complete;
- }
-
- private boolean areMementoUpdatesPending(IModelDelta delta) {
+ // Filter out the CONTENT flags from the delta flags, the content
+ // flag is only used as a marker indicating that all the sub-elements
+ // of a given delta have been retrieved.
+ int flags = (delta.getFlags() & ~IModelDelta.CONTENT);
+
+ if (flags != IModelDelta.NO_CHANGE) {
+ IModelDelta parentDelta = delta.getParentDelta();
+ // Remove the delta if :
+ // - The parent delta has no more flags on it (the content flag is removed as well),
+ // which means that parent element's children have been completely exposed.
+ // - There are no more pending updates for the element.
+ // - If element is a memento, there are no state requests pending.
+ if (parentDelta != null && parentDelta.getFlags() == IModelDelta.NO_CHANGE) {
+ TreePath deltaPath = fContentProvider.getViewerTreePath(delta);
+ if ( !fContentProvider.areElementUpdatesPending(deltaPath) &&
+ (!(delta.getElement() instanceof IMemento) || !areMementoUpdatesPending(delta)) )
+ {
+ removeDelta(delta);
+ return false;
+ }
+ }
+
+ if (flags != IModelDelta.REVEAL || (delta.getElement() instanceof IMemento)) {
+ complete = false;
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isComplete() {
+ return complete;
+ }
+
+ private boolean areMementoUpdatesPending(IModelDelta delta) {
for (CompareRequestKey key : fCompareRequestsInProgress.keySet()) {
- if (delta.getElement().equals(key.fDelta.getElement())) {
- return true;
- }
- }
- return false;
- }
-
- private void removeDelta(IModelDelta delta) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tRESTORE REMOVED: " + delta.getElement()); //$NON-NLS-1$
- }
+ if (delta.getElement().equals(key.fDelta.getElement())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void removeDelta(IModelDelta delta) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tRESTORE REMOVED: " + delta.getElement()); //$NON-NLS-1$
+ }
delta.accept((_visitorDelta, depth) -> {
ModelDelta visitorDelta = (ModelDelta) _visitorDelta;
@@ -1083,285 +1083,285 @@ class ViewerStateTracker {
return true;
});
- }
- }
-
- CheckState state = new CheckState();
- fPendingState.accept(state);
- if (state.isComplete()) {
- // notify restore complete if REVEAL was restored also, otherwise
- // postpone until then.
- if (fPendingSetTopItem == null) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE COMPELTE: " + fPendingState); //$NON-NLS-1$
- }
-
- notifyStateUpdate(fPendingState.getElement(), STATE_RESTORE_SEQUENCE_COMPLETE, null);
- }
-
- fPendingState = null;
- }
- }
-
- /**
- * Restores the pending state in the given delta node. This method is called
- * once the state tracker has found the element which matches the element in
- * the given delta node.
- * @param delta the {@link ModelDelta} to restore from
- * @param knowsHasChildren if the content provider has computed its children
- * @param knowsChildCount if the content provider has already computed the child count
- * @param checkChildrenRealized if any realized children should be checked
- */
- void restorePendingStateNode(final ModelDelta delta, boolean knowsHasChildren, boolean knowsChildCount, boolean checkChildrenRealized) {
- final TreePath treePath = fContentProvider.getViewerTreePath(delta);
- final IInternalTreeModelViewer viewer = fContentProvider.getViewer();
-
- // Attempt to expand the node only if the children are known.
- if (knowsHasChildren) {
- if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tRESTORE EXPAND: " + treePath.getLastSegment()); //$NON-NLS-1$
- }
- viewer.expandToLevel(treePath, 1);
- delta.setFlags(delta.getFlags() & ~IModelDelta.EXPAND);
- }
- if ((delta.getFlags() & IModelDelta.COLLAPSE) != 0) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tRESTORE COLLAPSE: " + treePath.getLastSegment()); //$NON-NLS-1$
- }
- // Check auto-expand before collapsing an element (bug 335734)
- int autoexpand = fContentProvider.getViewer().getAutoExpandLevel();
- if (autoexpand != ITreeModelViewer.ALL_LEVELS && autoexpand < (treePath.getSegmentCount() + 1)) {
- fContentProvider.getViewer().setExpandedState(treePath, false);
- }
- delta.setFlags(delta.getFlags() & ~IModelDelta.COLLAPSE);
- }
- }
-
- if ((delta.getFlags() & IModelDelta.SELECT) != 0) {
- delta.setFlags(delta.getFlags() & ~IModelDelta.SELECT);
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tRESTORE SELECT: " + treePath.getLastSegment()); //$NON-NLS-1$
- }
- ITreeSelection currentSelection = (ITreeSelection)viewer.getSelection();
- if (currentSelection == null || currentSelection.isEmpty()) {
- viewer.setSelection(new TreeSelection(treePath), false, false);
- } else {
- TreePath[] currentPaths = currentSelection.getPaths();
- boolean pathInSelection = false;
- for (int i = 0; i < currentPaths.length; i++) {
- if (currentPaths[i].equals(treePath)) {
- pathInSelection = true;
- break;
- }
- }
- // Only set the selection if the element is not yet in
- // selection. Otherwise the setSelection() call will
- // update selection listeners needlessly.
- if (!pathInSelection) {
- TreePath[] newPaths = new TreePath[currentPaths.length + 1];
- System.arraycopy(currentPaths, 0, newPaths, 0, currentPaths.length);
- newPaths[newPaths.length - 1] = treePath;
- viewer.setSelection(new TreeSelection(newPaths), false, false);
- }
- }
- }
-
- if ((delta.getFlags() & IModelDelta.REVEAL) != 0) {
- delta.setFlags(delta.getFlags() & ~IModelDelta.REVEAL);
- // Look for the reveal flag in the child deltas. If
- // A child delta has the reveal flag, do not set the
- // top element yet.
- boolean setTopItem = true;
- IModelDelta[] childDeltas = delta.getChildDeltas();
- for (int i = 0; i < childDeltas.length; i++) {
- IModelDelta childDelta = childDeltas[i];
- int modelIndex = childDelta.getIndex();
- if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
- setTopItem = false;
- }
- }
-
- if (setTopItem) {
- Assert.isTrue(fPendingSetTopItem == null);
-
- fPendingSetTopItem = new PendingRevealDelta(treePath, delta);
- viewer.addViewerUpdateListener(fPendingSetTopItem);
- }
- }
-
- // If we know the child count of the element, look for the reveal
- // flag in the child deltas. For the children with reveal flag start
- // a new update.
- // If the child delta's index is out of range, strip the reveal flag
- // since it is no longer applicable.
- if (knowsChildCount) {
- int childCount = viewer.getChildCount(treePath);
- if (childCount >= 0) {
- ModelDelta[] childDeltas = (ModelDelta[])delta.getChildDeltas();
- for (int i = 0; i < childDeltas.length; i++) {
- ModelDelta childDelta = childDeltas[i];
- int modelIndex = childDelta.getIndex();
- if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
- if (modelIndex < childCount) {
- fContentProvider.doUpdateElement(treePath, modelIndex);
- } else {
- childDelta.setFlags(childDelta.getFlags() & ~IModelDelta.REVEAL);
- }
- }
- }
- }
- }
-
- // Some children of this element were just updated. If all its
- // children are now realized, clear out any elements that still
- // have flags, because they represent elements that were removed.
- if ((checkChildrenRealized &&
- !fContentProvider.areChildrenUpdatesPending(treePath) &&
- fContentProvider.getViewer().getElementChildrenRealized(treePath)) ||
- (knowsHasChildren && !viewer.getHasChildren(treePath)) )
- {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tRESTORE CONTENT: " + treePath.getLastSegment()); //$NON-NLS-1$
- }
- delta.setFlags(delta.getFlags() & ~IModelDelta.CONTENT);
- }
- }
-
- /**
- * Utility that reveals the saved top item in the viewer. It listens for
- * all content updates to complete in order to avoid having the desired top item
- * scroll out as view content is filled in.
- * <br>
- * Revealing some elements can trigger expanding some of elements
- * that have been just revealed. Therefore, we have to check one
- * more time after the new triggered updates are completed if we
- * have to set again the top index
- */
- private class PendingRevealDelta implements IViewerUpdateListener {
-
- private final TreePath fPathToReveal;
- private final ModelDelta fRevealDelta;
-
- PendingRevealDelta(TreePath pathToReveal, ModelDelta revealDelta) {
- fPathToReveal = pathToReveal;
- fRevealDelta = revealDelta;
- }
-
- /**
- * Counter that tracks how many time the viewer updates were completed.
- */
- private int fCounter = 0;
- private Object fModelInput = fPendingState.getElement();
-
- @Override
+ }
+ }
+
+ CheckState state = new CheckState();
+ fPendingState.accept(state);
+ if (state.isComplete()) {
+ // notify restore complete if REVEAL was restored also, otherwise
+ // postpone until then.
+ if (fPendingSetTopItem == null) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE COMPELTE: " + fPendingState); //$NON-NLS-1$
+ }
+
+ notifyStateUpdate(fPendingState.getElement(), STATE_RESTORE_SEQUENCE_COMPLETE, null);
+ }
+
+ fPendingState = null;
+ }
+ }
+
+ /**
+ * Restores the pending state in the given delta node. This method is called
+ * once the state tracker has found the element which matches the element in
+ * the given delta node.
+ * @param delta the {@link ModelDelta} to restore from
+ * @param knowsHasChildren if the content provider has computed its children
+ * @param knowsChildCount if the content provider has already computed the child count
+ * @param checkChildrenRealized if any realized children should be checked
+ */
+ void restorePendingStateNode(final ModelDelta delta, boolean knowsHasChildren, boolean knowsChildCount, boolean checkChildrenRealized) {
+ final TreePath treePath = fContentProvider.getViewerTreePath(delta);
+ final IInternalTreeModelViewer viewer = fContentProvider.getViewer();
+
+ // Attempt to expand the node only if the children are known.
+ if (knowsHasChildren) {
+ if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tRESTORE EXPAND: " + treePath.getLastSegment()); //$NON-NLS-1$
+ }
+ viewer.expandToLevel(treePath, 1);
+ delta.setFlags(delta.getFlags() & ~IModelDelta.EXPAND);
+ }
+ if ((delta.getFlags() & IModelDelta.COLLAPSE) != 0) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tRESTORE COLLAPSE: " + treePath.getLastSegment()); //$NON-NLS-1$
+ }
+ // Check auto-expand before collapsing an element (bug 335734)
+ int autoexpand = fContentProvider.getViewer().getAutoExpandLevel();
+ if (autoexpand != ITreeModelViewer.ALL_LEVELS && autoexpand < (treePath.getSegmentCount() + 1)) {
+ fContentProvider.getViewer().setExpandedState(treePath, false);
+ }
+ delta.setFlags(delta.getFlags() & ~IModelDelta.COLLAPSE);
+ }
+ }
+
+ if ((delta.getFlags() & IModelDelta.SELECT) != 0) {
+ delta.setFlags(delta.getFlags() & ~IModelDelta.SELECT);
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tRESTORE SELECT: " + treePath.getLastSegment()); //$NON-NLS-1$
+ }
+ ITreeSelection currentSelection = (ITreeSelection)viewer.getSelection();
+ if (currentSelection == null || currentSelection.isEmpty()) {
+ viewer.setSelection(new TreeSelection(treePath), false, false);
+ } else {
+ TreePath[] currentPaths = currentSelection.getPaths();
+ boolean pathInSelection = false;
+ for (int i = 0; i < currentPaths.length; i++) {
+ if (currentPaths[i].equals(treePath)) {
+ pathInSelection = true;
+ break;
+ }
+ }
+ // Only set the selection if the element is not yet in
+ // selection. Otherwise the setSelection() call will
+ // update selection listeners needlessly.
+ if (!pathInSelection) {
+ TreePath[] newPaths = new TreePath[currentPaths.length + 1];
+ System.arraycopy(currentPaths, 0, newPaths, 0, currentPaths.length);
+ newPaths[newPaths.length - 1] = treePath;
+ viewer.setSelection(new TreeSelection(newPaths), false, false);
+ }
+ }
+ }
+
+ if ((delta.getFlags() & IModelDelta.REVEAL) != 0) {
+ delta.setFlags(delta.getFlags() & ~IModelDelta.REVEAL);
+ // Look for the reveal flag in the child deltas. If
+ // A child delta has the reveal flag, do not set the
+ // top element yet.
+ boolean setTopItem = true;
+ IModelDelta[] childDeltas = delta.getChildDeltas();
+ for (int i = 0; i < childDeltas.length; i++) {
+ IModelDelta childDelta = childDeltas[i];
+ int modelIndex = childDelta.getIndex();
+ if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
+ setTopItem = false;
+ }
+ }
+
+ if (setTopItem) {
+ Assert.isTrue(fPendingSetTopItem == null);
+
+ fPendingSetTopItem = new PendingRevealDelta(treePath, delta);
+ viewer.addViewerUpdateListener(fPendingSetTopItem);
+ }
+ }
+
+ // If we know the child count of the element, look for the reveal
+ // flag in the child deltas. For the children with reveal flag start
+ // a new update.
+ // If the child delta's index is out of range, strip the reveal flag
+ // since it is no longer applicable.
+ if (knowsChildCount) {
+ int childCount = viewer.getChildCount(treePath);
+ if (childCount >= 0) {
+ ModelDelta[] childDeltas = (ModelDelta[])delta.getChildDeltas();
+ for (int i = 0; i < childDeltas.length; i++) {
+ ModelDelta childDelta = childDeltas[i];
+ int modelIndex = childDelta.getIndex();
+ if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
+ if (modelIndex < childCount) {
+ fContentProvider.doUpdateElement(treePath, modelIndex);
+ } else {
+ childDelta.setFlags(childDelta.getFlags() & ~IModelDelta.REVEAL);
+ }
+ }
+ }
+ }
+ }
+
+ // Some children of this element were just updated. If all its
+ // children are now realized, clear out any elements that still
+ // have flags, because they represent elements that were removed.
+ if ((checkChildrenRealized &&
+ !fContentProvider.areChildrenUpdatesPending(treePath) &&
+ fContentProvider.getViewer().getElementChildrenRealized(treePath)) ||
+ (knowsHasChildren && !viewer.getHasChildren(treePath)) )
+ {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tRESTORE CONTENT: " + treePath.getLastSegment()); //$NON-NLS-1$
+ }
+ delta.setFlags(delta.getFlags() & ~IModelDelta.CONTENT);
+ }
+ }
+
+ /**
+ * Utility that reveals the saved top item in the viewer. It listens for
+ * all content updates to complete in order to avoid having the desired top item
+ * scroll out as view content is filled in.
+ * <br>
+ * Revealing some elements can trigger expanding some of elements
+ * that have been just revealed. Therefore, we have to check one
+ * more time after the new triggered updates are completed if we
+ * have to set again the top index
+ */
+ private class PendingRevealDelta implements IViewerUpdateListener {
+
+ private final TreePath fPathToReveal;
+ private final ModelDelta fRevealDelta;
+
+ PendingRevealDelta(TreePath pathToReveal, ModelDelta revealDelta) {
+ fPathToReveal = pathToReveal;
+ fRevealDelta = revealDelta;
+ }
+
+ /**
+ * Counter that tracks how many time the viewer updates were completed.
+ */
+ private int fCounter = 0;
+ private Object fModelInput = fPendingState.getElement();
+
+ @Override
public void viewerUpdatesComplete() {
- Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
-
- IInternalTreeModelViewer viewer = fContentProvider.getViewer();
- if (viewer == null || fPendingSetTopItem != this) {
- return;
- }
-
- TreePath topPath = viewer.getTopElementPath();
- if (!fPathToReveal.equals(topPath)) {
- TreePath parentPath = fPathToReveal.getParentPath();
- int index = viewer.findElementIndex(parentPath, fPathToReveal.getLastSegment());
- if (index >= 0) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tRESTORE REVEAL: " + fPathToReveal.getLastSegment()); //$NON-NLS-1$
- }
- viewer.reveal(parentPath, index);
-
- }
- }
-
- fCounter++;
- // in case the pending state was already set to null, we assume that
- // all others elements are restored, so we don't expect that REVEAL will
- // trigger other updates
- if (fCounter > 1 || fPendingState == null) {
- dispose();
- }
- }
-
- @Override
+ Assert.isTrue( fContentProvider.getViewer().getDisplay().getThread() == Thread.currentThread() );
+
+ IInternalTreeModelViewer viewer = fContentProvider.getViewer();
+ if (viewer == null || fPendingSetTopItem != this) {
+ return;
+ }
+
+ TreePath topPath = viewer.getTopElementPath();
+ if (!fPathToReveal.equals(topPath)) {
+ TreePath parentPath = fPathToReveal.getParentPath();
+ int index = viewer.findElementIndex(parentPath, fPathToReveal.getLastSegment());
+ if (index >= 0) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tRESTORE REVEAL: " + fPathToReveal.getLastSegment()); //$NON-NLS-1$
+ }
+ viewer.reveal(parentPath, index);
+
+ }
+ }
+
+ fCounter++;
+ // in case the pending state was already set to null, we assume that
+ // all others elements are restored, so we don't expect that REVEAL will
+ // trigger other updates
+ if (fCounter > 1 || fPendingState == null) {
+ dispose();
+ }
+ }
+
+ @Override
public void viewerUpdatesBegin() {}
- @Override
+ @Override
public void updateStarted(IViewerUpdate update) {}
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {}
- /**
- * Returns delta that is used to reveal the item.
- * @return delta to be revealed.
- */
- public ModelDelta getDelta() {
- return fRevealDelta;
- }
-
- /**
- * Resets the item
- */
- public void dispose() {
- // top item is set
- fPendingSetTopItem = null;
-
- IInternalTreeModelViewer viewer = fContentProvider.getViewer();
- if (viewer == null) {
+ /**
+ * Returns delta that is used to reveal the item.
+ * @return delta to be revealed.
+ */
+ public ModelDelta getDelta() {
+ return fRevealDelta;
+ }
+
+ /**
+ * Resets the item
+ */
+ public void dispose() {
+ // top item is set
+ fPendingSetTopItem = null;
+
+ IInternalTreeModelViewer viewer = fContentProvider.getViewer();
+ if (viewer == null) {
return;
}
- // remove myself as viewer update listener
- viewer.removeViewerUpdateListener(this);
-
- if (fPendingState == null) {
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("STATE RESTORE COMPELTE: " + fPendingState); //$NON-NLS-1$
- }
- notifyStateUpdate(fModelInput, STATE_RESTORE_SEQUENCE_COMPLETE, null);
- } else {
- checkIfRestoreComplete();
- }
- }
-
- }
-
- /**
- * Restore selection/expansion based on items already in the viewer
- * @param delta the {@link ModelDelta} to restore from
- */
- protected void doInitialRestore(ModelDelta delta) {
- // Find the reveal delta and mark nodes on its path
- // to reveal as elements are updated.
- markRevealDelta(delta);
-
- // Restore visible items.
- // Note (Pawel Piech): the initial list of items is normally
- // empty, so in most cases the code below does not do anything.
- // Instead doRestore() is called when various updates complete.
- int count = fContentProvider.getViewer().getChildCount(TreePath.EMPTY);
- for (int i = 0; i < count; i++) {
- Object data = fContentProvider.getViewer().getChildElement(TreePath.EMPTY, i);
- if (data != null) {
- restorePendingStateOnUpdate(new TreePath(new Object[]{data}), i, false, false, false);
- }
- }
-
- }
-
- /**
- * Finds the delta with the reveal flag, then it walks up this
- * delta and marks all the parents of it with the reveal flag.
- * These flags are then used by the restore logic to restore
- * and reveal all the nodes leading up to the element that should
- * be ultimately at the top.
- * @param rootDelta Delta to search
- * @return The node just under the rootDelta which contains
- * the reveal flag. <code>null</code> if no reveal flag was found.
- */
- private ModelDelta markRevealDelta(ModelDelta rootDelta) {
- final ModelDelta[] revealDelta = new ModelDelta[1];
+ // remove myself as viewer update listener
+ viewer.removeViewerUpdateListener(this);
+
+ if (fPendingState == null) {
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("STATE RESTORE COMPELTE: " + fPendingState); //$NON-NLS-1$
+ }
+ notifyStateUpdate(fModelInput, STATE_RESTORE_SEQUENCE_COMPLETE, null);
+ } else {
+ checkIfRestoreComplete();
+ }
+ }
+
+ }
+
+ /**
+ * Restore selection/expansion based on items already in the viewer
+ * @param delta the {@link ModelDelta} to restore from
+ */
+ protected void doInitialRestore(ModelDelta delta) {
+ // Find the reveal delta and mark nodes on its path
+ // to reveal as elements are updated.
+ markRevealDelta(delta);
+
+ // Restore visible items.
+ // Note (Pawel Piech): the initial list of items is normally
+ // empty, so in most cases the code below does not do anything.
+ // Instead doRestore() is called when various updates complete.
+ int count = fContentProvider.getViewer().getChildCount(TreePath.EMPTY);
+ for (int i = 0; i < count; i++) {
+ Object data = fContentProvider.getViewer().getChildElement(TreePath.EMPTY, i);
+ if (data != null) {
+ restorePendingStateOnUpdate(new TreePath(new Object[]{data}), i, false, false, false);
+ }
+ }
+
+ }
+
+ /**
+ * Finds the delta with the reveal flag, then it walks up this
+ * delta and marks all the parents of it with the reveal flag.
+ * These flags are then used by the restore logic to restore
+ * and reveal all the nodes leading up to the element that should
+ * be ultimately at the top.
+ * @param rootDelta Delta to search
+ * @return The node just under the rootDelta which contains
+ * the reveal flag. <code>null</code> if no reveal flag was found.
+ */
+ private ModelDelta markRevealDelta(ModelDelta rootDelta) {
+ final ModelDelta[] revealDelta = new ModelDelta[1];
IModelDeltaVisitor visitor = (delta, depth) -> {
if ((delta.getFlags() & IModelDelta.REVEAL) != 0) {
revealDelta[0] = (ModelDelta) delta;
@@ -1370,106 +1370,106 @@ class ViewerStateTracker {
return revealDelta[0] == null;
};
- rootDelta.accept(visitor);
- if (revealDelta[0] != null) {
- ModelDelta parentDelta = (ModelDelta)revealDelta[0].getParentDelta();
- while(parentDelta.getParentDelta() != null) {
- revealDelta[0] = parentDelta;
- revealDelta[0].setFlags(revealDelta[0].getFlags() | IModelDelta.REVEAL);
- parentDelta = (ModelDelta)parentDelta.getParentDelta();
- }
- }
- return revealDelta[0];
- }
-
- /**
- * Builds a delta with the given root delta for expansion/selection state.
- *
- * @param delta
- * root delta
- */
- private void buildViewerState(ModelDelta delta) {
- IInternalTreeModelViewer viewer = fContentProvider.getViewer();
- viewer.saveElementState(TreeModelContentProvider.EMPTY_TREE_PATH, delta, IModelDelta.SELECT | IModelDelta.EXPAND);
-
- // Add memento for top item if it is mapped to an element. The reveal memento
- // is in its own path to avoid requesting unnecessary data when restoring it.
- TreePath topElementPath = viewer.getTopElementPath();
- if (topElementPath != null) {
- ModelDelta parentDelta = delta;
- TreePath parentPath = TreeModelContentProvider.EMPTY_TREE_PATH;
- for (int i = 0; i < topElementPath.getSegmentCount(); i++) {
- Object element = topElementPath.getSegment(i);
- int index = viewer.findElementIndex(parentPath, element);
- ModelDelta childDelta = parentDelta.getChildDelta(element);
- if (childDelta == null) {
- parentDelta = parentDelta.addNode(element, index, IModelDelta.NO_CHANGE);
- } else {
- parentDelta = childDelta;
- }
- parentPath = parentPath.createChildPath(element);
- }
- parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.REVEAL);
- }
- }
-
- /**
- * Cancels any outstanding compare requests for given element and its children.
- * @param path Path of element to cancel updates for.
- */
- void cancelStateSubtreeUpdates(TreePath path) {
+ rootDelta.accept(visitor);
+ if (revealDelta[0] != null) {
+ ModelDelta parentDelta = (ModelDelta)revealDelta[0].getParentDelta();
+ while(parentDelta.getParentDelta() != null) {
+ revealDelta[0] = parentDelta;
+ revealDelta[0].setFlags(revealDelta[0].getFlags() | IModelDelta.REVEAL);
+ parentDelta = (ModelDelta)parentDelta.getParentDelta();
+ }
+ }
+ return revealDelta[0];
+ }
+
+ /**
+ * Builds a delta with the given root delta for expansion/selection state.
+ *
+ * @param delta
+ * root delta
+ */
+ private void buildViewerState(ModelDelta delta) {
+ IInternalTreeModelViewer viewer = fContentProvider.getViewer();
+ viewer.saveElementState(TreeModelContentProvider.EMPTY_TREE_PATH, delta, IModelDelta.SELECT | IModelDelta.EXPAND);
+
+ // Add memento for top item if it is mapped to an element. The reveal memento
+ // is in its own path to avoid requesting unnecessary data when restoring it.
+ TreePath topElementPath = viewer.getTopElementPath();
+ if (topElementPath != null) {
+ ModelDelta parentDelta = delta;
+ TreePath parentPath = TreeModelContentProvider.EMPTY_TREE_PATH;
+ for (int i = 0; i < topElementPath.getSegmentCount(); i++) {
+ Object element = topElementPath.getSegment(i);
+ int index = viewer.findElementIndex(parentPath, element);
+ ModelDelta childDelta = parentDelta.getChildDelta(element);
+ if (childDelta == null) {
+ parentDelta = parentDelta.addNode(element, index, IModelDelta.NO_CHANGE);
+ } else {
+ parentDelta = childDelta;
+ }
+ parentPath = parentPath.createChildPath(element);
+ }
+ parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.REVEAL);
+ }
+ }
+
+ /**
+ * Cancels any outstanding compare requests for given element and its children.
+ * @param path Path of element to cancel updates for.
+ */
+ void cancelStateSubtreeUpdates(TreePath path) {
for (Iterator<CompareRequestKey> itr = fCompareRequestsInProgress.keySet().iterator(); itr.hasNext();) {
CompareRequestKey key = itr.next();
- if (key.fPath.startsWith(path, null)) {
- ElementCompareRequest compareRequest = fCompareRequestsInProgress.get(key);
- compareRequest.cancel();
- itr.remove();
- }
- }
- }
-
- void compareFinished(ElementCompareRequest request, ModelDelta delta) {
- notifyStateUpdate(request.getViewerInput(), TreeModelContentProvider.UPDATE_COMPLETE, request);
- if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
- DebugUIPlugin.trace("\tSTATE END: " + request + " = " + false); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- fCompareRequestsInProgress.remove(new CompareRequestKey(request.getElementPath(), delta));
- if (!request.isCanceled()) {
- if (request.isEqual()) {
- delta.setElement(request.getElement());
- restorePendingStateNode(delta, request.knowsHasChildren(), request.knowChildCount(), request.checkChildrenRealized());
- } else if (request.getModelIndex() != -1) {
- // Comparison failed.
- // Check if the delta has a reveal flag, and if its index
- // matches the index of the element that it was compared
- // against. If this is the case, strip the reveal flag from
- // the delta as it is most likely not applicable anymore.
- if ((delta.getFlags() & IModelDelta.REVEAL) != 0 && delta.getIndex() == request.getModelIndex()) {
- delta.setFlags(delta.getFlags() & ~IModelDelta.REVEAL);
- }
- }
- }
- checkIfRestoreComplete();
- }
-
-
- void addStateUpdateListener(IStateUpdateListener listener) {
- fStateUpdateListeners.add(listener);
- }
-
- void removeStateUpdateListener(IStateUpdateListener listener) {
- fStateUpdateListeners.remove(listener);
- }
-
- void notifyStateUpdate(final Object input, final int type, final IViewerUpdate update) {
- if (!fStateUpdateListeners.isEmpty()) {
+ if (key.fPath.startsWith(path, null)) {
+ ElementCompareRequest compareRequest = fCompareRequestsInProgress.get(key);
+ compareRequest.cancel();
+ itr.remove();
+ }
+ }
+ }
+
+ void compareFinished(ElementCompareRequest request, ModelDelta delta) {
+ notifyStateUpdate(request.getViewerInput(), TreeModelContentProvider.UPDATE_COMPLETE, request);
+ if (DebugUIPlugin.DEBUG_STATE_SAVE_RESTORE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(fContentProvider.getPresentationContext())) {
+ DebugUIPlugin.trace("\tSTATE END: " + request + " = " + false); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ fCompareRequestsInProgress.remove(new CompareRequestKey(request.getElementPath(), delta));
+ if (!request.isCanceled()) {
+ if (request.isEqual()) {
+ delta.setElement(request.getElement());
+ restorePendingStateNode(delta, request.knowsHasChildren(), request.knowChildCount(), request.checkChildrenRealized());
+ } else if (request.getModelIndex() != -1) {
+ // Comparison failed.
+ // Check if the delta has a reveal flag, and if its index
+ // matches the index of the element that it was compared
+ // against. If this is the case, strip the reveal flag from
+ // the delta as it is most likely not applicable anymore.
+ if ((delta.getFlags() & IModelDelta.REVEAL) != 0 && delta.getIndex() == request.getModelIndex()) {
+ delta.setFlags(delta.getFlags() & ~IModelDelta.REVEAL);
+ }
+ }
+ }
+ checkIfRestoreComplete();
+ }
+
+
+ void addStateUpdateListener(IStateUpdateListener listener) {
+ fStateUpdateListeners.add(listener);
+ }
+
+ void removeStateUpdateListener(IStateUpdateListener listener) {
+ fStateUpdateListeners.remove(listener);
+ }
+
+ void notifyStateUpdate(final Object input, final int type, final IViewerUpdate update) {
+ if (!fStateUpdateListeners.isEmpty()) {
for (IStateUpdateListener iStateUpdateListener : fStateUpdateListeners) {
final IStateUpdateListener listener = iStateUpdateListener;
- SafeRunner.run(new ISafeRunnable() {
- @Override
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
public void run() throws Exception {
- switch (type) {
+ switch (type) {
case STATE_SAVE_SEQUENCE_BEGINS:
listener.stateSaveUpdatesBegin(input);
break;
@@ -1490,15 +1490,15 @@ class ViewerStateTracker {
break;
default:
break;
- }
- }
+ }
+ }
- @Override
+ @Override
public void handleException(Throwable exception) {
- DebugUIPlugin.log(exception);
- }
- });
- }
- }
- }
+ DebugUIPlugin.log(exception);
+ }
+ });
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java
index 8be777195..cf706ed4a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerUpdateMonitor.java
@@ -47,111 +47,111 @@ public abstract class ViewerUpdateMonitor extends Request implements IViewerUpda
*/
private IElementContentProvider fElementContentProvider;
- /**
- * Whether this request's 'done' method has been called.
- */
- private boolean fDone = false;
-
- /**
- * Whether this request has been started
- */
- private boolean fStarted = false;
-
- /**
- * Viewer input at the time the request was made
- */
- private Object fViewerInput = null;
-
- /**
- * Whether this update has been delegated to another content provider
- * @since 3.4
- */
- private boolean fIsDelegated = false;
-
- /**
- * Presentation context
- */
- private IPresentationContext fContext;
-
- /**
- * Constructs an update for the given content provider
- *
- * @param contentProvider content provider
- * @param viewerInput Viewer input for update
- * @param elementPath path to associated model element - empty for root element
- * @param element associated model element
- * @param elementContentProvider Content provider for this update.
- * @param context Presentation contest for this update
- */
- public ViewerUpdateMonitor(TreeModelContentProvider contentProvider, Object viewerInput, TreePath elementPath, Object element, IElementContentProvider elementContentProvider, IPresentationContext context) {
- fContext = context;
+ /**
+ * Whether this request's 'done' method has been called.
+ */
+ private boolean fDone = false;
+
+ /**
+ * Whether this request has been started
+ */
+ private boolean fStarted = false;
+
+ /**
+ * Viewer input at the time the request was made
+ */
+ private Object fViewerInput = null;
+
+ /**
+ * Whether this update has been delegated to another content provider
+ * @since 3.4
+ */
+ private boolean fIsDelegated = false;
+
+ /**
+ * Presentation context
+ */
+ private IPresentationContext fContext;
+
+ /**
+ * Constructs an update for the given content provider
+ *
+ * @param contentProvider content provider
+ * @param viewerInput Viewer input for update
+ * @param elementPath path to associated model element - empty for root element
+ * @param element associated model element
+ * @param elementContentProvider Content provider for this update.
+ * @param context Presentation contest for this update
+ */
+ public ViewerUpdateMonitor(TreeModelContentProvider contentProvider, Object viewerInput, TreePath elementPath, Object element, IElementContentProvider elementContentProvider, IPresentationContext context) {
+ fContext = context;
// Bug 380288: Catch and log a race condition where the viewer input is null.
- if (viewerInput == null) {
- DebugUIPlugin.log(new NullPointerException("Input to viewer update should not be null")); //$NON-NLS-1$
- }
- fViewerInput = viewerInput;
- fElementContentProvider = elementContentProvider;
- fContentProvider = contentProvider;
- fElement = element;
- fElementPath = elementPath;
- }
-
- /**
- * Returns the scheduling rule for viewer update job.
- *
- * @return rule or <code>null</code>
- */
- protected ISchedulingRule getUpdateSchedulingRule() {
- return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(getContentProvider());
- }
-
- /**
- * Returns the model content provider this update is being performed for.
- *
- * @return the model content provider this update is being performed for
- */
- protected TreeModelContentProvider getContentProvider() {
- return fContentProvider;
- }
-
- /**
- * Returns the element content provider to use for this request
- *
- * @return element content provider
- */
- protected IElementContentProvider getElementContentProvider() {
- return fElementContentProvider;
- }
-
- @Override
+ if (viewerInput == null) {
+ DebugUIPlugin.log(new NullPointerException("Input to viewer update should not be null")); //$NON-NLS-1$
+ }
+ fViewerInput = viewerInput;
+ fElementContentProvider = elementContentProvider;
+ fContentProvider = contentProvider;
+ fElement = element;
+ fElementPath = elementPath;
+ }
+
+ /**
+ * Returns the scheduling rule for viewer update job.
+ *
+ * @return rule or <code>null</code>
+ */
+ protected ISchedulingRule getUpdateSchedulingRule() {
+ return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(getContentProvider());
+ }
+
+ /**
+ * Returns the model content provider this update is being performed for.
+ *
+ * @return the model content provider this update is being performed for
+ */
+ protected TreeModelContentProvider getContentProvider() {
+ return fContentProvider;
+ }
+
+ /**
+ * Returns the element content provider to use for this request
+ *
+ * @return element content provider
+ */
+ protected IElementContentProvider getElementContentProvider() {
+ return fElementContentProvider;
+ }
+
+ @Override
public final void done() {
- synchronized (this) {
- if (isDone()) {
- return;
- }
- fDone = true;
+ synchronized (this) {
+ if (isDone()) {
+ return;
+ }
+ fDone = true;
}
- scheduleViewerUpdate();
+ scheduleViewerUpdate();
}
- /**
- * Returns whether this request is done yet.
- *
- * @return True if this update is done.
- */
- protected synchronized boolean isDone() {
- return fDone;
- }
+ /**
+ * Returns whether this request is done yet.
+ *
+ * @return True if this update is done.
+ */
+ protected synchronized boolean isDone() {
+ return fDone;
+ }
- protected void scheduleViewerUpdate() {
- getContentProvider().scheduleViewerUpdate(this);
- }
+ protected void scheduleViewerUpdate() {
+ getContentProvider().scheduleViewerUpdate(this);
+ }
- /**
+ /**
* Notification this update has been completed and should now be applied to
* this update's viewer. This method is called in the UI thread.
*/
- protected abstract void performUpdate();
+ protected abstract void performUpdate();
@Override
public IPresentationContext getPresentationContext() {
@@ -183,7 +183,7 @@ public abstract class ViewerUpdateMonitor extends Request implements IViewerUpda
* @param path Element path to check.
* @return True if this update contains the given update path.
*
- * @since 3.6
+ * @since 3.6
*/
abstract boolean containsUpdate(TreePath path);
@@ -252,15 +252,15 @@ public abstract class ViewerUpdateMonitor extends Request implements IViewerUpda
@Override
public boolean equals(Object obj) {
- if (obj instanceof ViewerUpdateMonitor) {
- return doEquals((ViewerUpdateMonitor)obj);
- }
- return false;
+ if (obj instanceof ViewerUpdateMonitor) {
+ return doEquals((ViewerUpdateMonitor)obj);
+ }
+ return false;
}
@Override
public int hashCode() {
- return doHashCode();
+ return doHashCode();
}
/**
@@ -268,34 +268,34 @@ public abstract class ViewerUpdateMonitor extends Request implements IViewerUpda
* the same type of update and its updating the same elements.
* @param update Update to compare to.
* @return True if the given update is equals
- * @since 3.8
+ * @since 3.8
*/
abstract protected boolean doEquals(ViewerUpdateMonitor update);
/**
* Calculates the hash code of the given update using the same parameters as doEquals().
* @return Update's hash code.
- * @since 3.8
+ * @since 3.8
+ */
+ abstract protected int doHashCode();
+
+ /**
+ * Executes the given runnable in the UI thread. If method is called in
+ * UI thread, then runnable is executed immediately, otherwise it's executed
+ * using <code>Display.asyncExec()</code>. Runnable is not executed if update is
+ * canceled or content provider is disposed.
+ * @since 3.8
*/
- abstract protected int doHashCode();
-
- /**
- * Executes the given runnable in the UI thread. If method is called in
- * UI thread, then runnable is executed immediately, otherwise it's executed
- * using <code>Display.asyncExec()</code>. Runnable is not executed if update is
- * canceled or content provider is disposed.
- * @since 3.8
- */
protected void execInDisplayThread(Runnable runnable) {
- ITreeModelViewer viewer = getContentProvider().getViewer();
- if (viewer != null && !isCanceled()) {
- Display display = viewer.getDisplay();
- if (Thread.currentThread() == display.getThread()) {
- runnable.run();
- } else {
- display.asyncExec(runnable);
- }
- }
+ ITreeModelViewer viewer = getContentProvider().getViewer();
+ if (viewer != null && !isCanceled()) {
+ Display display = viewer.getDisplay();
+ if (Thread.currentThread() == display.getThread()) {
+ runnable.run();
+ } else {
+ display.asyncExec(runnable);
+ }
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
index 2425e4e3c..cdc5dfd0b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java
@@ -65,50 +65,50 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
private class VirtualViewerListener implements ILabelUpdateListener, IVirtualItemListener {
VirtualTreeModelViewer fVirtualViewer;
- IProgressMonitor fProgressMonitor;
- int fSelectionRootDepth;
+ IProgressMonitor fProgressMonitor;
+ int fSelectionRootDepth;
Set<VirtualItem> fItemsToUpdate;
- @Override
+ @Override
public void labelUpdateStarted(ILabelUpdate update) {}
- @Override
+ @Override
public void labelUpdateComplete(ILabelUpdate update) {
- VirtualItem updatedItem = fVirtualViewer.findItem(update.getElementPath());
- if (fItemsToUpdate.remove(updatedItem)) {
- incrementProgress(1);
- }
- }
- @Override
+ VirtualItem updatedItem = fVirtualViewer.findItem(update.getElementPath());
+ if (fItemsToUpdate.remove(updatedItem)) {
+ incrementProgress(1);
+ }
+ }
+ @Override
public void labelUpdatesBegin() {
- }
- @Override
+ }
+ @Override
public void labelUpdatesComplete() {
- }
+ }
- @Override
+ @Override
public void revealed(VirtualItem item) {
- }
+ }
- @Override
+ @Override
public void disposed(VirtualItem item) {
- if (fItemsToUpdate.remove(item)) {
- incrementProgress(1);
- }
- }
-
- private void incrementProgress(int count) {
- IProgressMonitor pm;
- synchronized (VirtualCopyToClipboardActionDelegate.this) {
- pm = fProgressMonitor;
- }
- if (pm != null) {
- pm.worked(count);
- if (fItemsToUpdate.isEmpty()) {
- pm.done();
- }
- }
- }
- }
+ if (fItemsToUpdate.remove(item)) {
+ incrementProgress(1);
+ }
+ }
+
+ private void incrementProgress(int count) {
+ IProgressMonitor pm;
+ synchronized (VirtualCopyToClipboardActionDelegate.this) {
+ pm = fProgressMonitor;
+ }
+ if (pm != null) {
+ pm.worked(count);
+ if (fItemsToUpdate.isEmpty()) {
+ pm.done();
+ }
+ }
+ }
+ }
/**
* @see AbstractDebugActionDelegate#initialize(IAction, ISelection)
@@ -176,76 +176,76 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
Set<VirtualItem> fItemsToCopy = Collections.EMPTY_SET;
Set<VirtualItem> fItemsToValidate = Collections.EMPTY_SET;
- @Override
+ @Override
public boolean isItemVisible(VirtualItem item) {
- return fItemsToValidate.contains(item);
- }
+ return fItemsToValidate.contains(item);
+ }
- @Override
+ @Override
public void showItem(VirtualItem item) {
- }
+ }
void setItemsToCopy(Set<VirtualItem> itemsToCopy) {
- fItemsToCopy = itemsToCopy;
+ fItemsToCopy = itemsToCopy;
fItemsToValidate = new HashSet<>();
for (VirtualItem itemToCopy : itemsToCopy) {
- while (itemToCopy != null) {
- fItemsToValidate.add(itemToCopy);
- itemToCopy = itemToCopy.getParent();
- }
- }
- }
+ while (itemToCopy != null) {
+ fItemsToValidate.add(itemToCopy);
+ itemToCopy = itemToCopy.getParent();
+ }
+ }
+ }
}
private VirtualTreeModelViewer initVirtualViewer(TreeModelViewer clientViewer, VirtualViewerListener listener, ItemsToCopyVirtualItemValidator validator) {
- Object input = clientViewer.getInput();
- ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
- clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
- VirtualTreeModelViewer virtualViewer = new VirtualTreeModelViewer(
- clientViewer.getDisplay(),
- SWT.VIRTUAL,
- clientViewer.getPresentationContext(),
- validator);
- virtualViewer.setFilters(clientViewer.getFilters());
- virtualViewer.addLabelUpdateListener(listener);
- virtualViewer.getTree().addItemListener(listener);
- String[] columns = clientViewer.getPresentationContext().getColumns();
- virtualViewer.setInput(input);
- if (virtualViewer.canToggleColumns()) {
- virtualViewer.setShowColumns(clientViewer.isShowColumns());
- virtualViewer.setVisibleColumns(columns);
- }
- virtualViewer.updateViewer(stateDelta);
-
- // Parse selected items from client viewer and add them to the virtual viewer selection.
- listener.fSelectionRootDepth = Integer.MAX_VALUE;
- TreeItem[] selection = getSelectedItems(clientViewer);
+ Object input = clientViewer.getInput();
+ ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
+ clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
+ VirtualTreeModelViewer virtualViewer = new VirtualTreeModelViewer(
+ clientViewer.getDisplay(),
+ SWT.VIRTUAL,
+ clientViewer.getPresentationContext(),
+ validator);
+ virtualViewer.setFilters(clientViewer.getFilters());
+ virtualViewer.addLabelUpdateListener(listener);
+ virtualViewer.getTree().addItemListener(listener);
+ String[] columns = clientViewer.getPresentationContext().getColumns();
+ virtualViewer.setInput(input);
+ if (virtualViewer.canToggleColumns()) {
+ virtualViewer.setShowColumns(clientViewer.isShowColumns());
+ virtualViewer.setVisibleColumns(columns);
+ }
+ virtualViewer.updateViewer(stateDelta);
+
+ // Parse selected items from client viewer and add them to the virtual viewer selection.
+ listener.fSelectionRootDepth = Integer.MAX_VALUE;
+ TreeItem[] selection = getSelectedItems(clientViewer);
Set<VirtualItem> vSelection = new HashSet<>(selection.length * 4 / 3);
- for (int i = 0; i < selection.length; i++) {
- TreePath parentPath = fClientViewer.getTreePathFromItem(selection[i].getParentItem());
- listener.fSelectionRootDepth = Math.min(parentPath.getSegmentCount() + 1, listener.fSelectionRootDepth);
- VirtualItem parentVItem = virtualViewer.findItem(parentPath);
- if (parentVItem != null) {
- int index = -1;
- TreeItem parentItem = selection[i].getParentItem();
- if (parentItem != null) {
- index = parentItem.indexOf(selection[i]);
- } else {
- Tree parentTree = selection[i].getParent();
- index = parentTree.indexOf(selection[i]);
- }
- index = ((ITreeModelContentProvider)clientViewer.getContentProvider()).viewToModelIndex(parentPath, index);
- vSelection.add( parentVItem.getItem(new Index(index)) );
- }
- }
- validator.setItemsToCopy(vSelection);
+ for (int i = 0; i < selection.length; i++) {
+ TreePath parentPath = fClientViewer.getTreePathFromItem(selection[i].getParentItem());
+ listener.fSelectionRootDepth = Math.min(parentPath.getSegmentCount() + 1, listener.fSelectionRootDepth);
+ VirtualItem parentVItem = virtualViewer.findItem(parentPath);
+ if (parentVItem != null) {
+ int index = -1;
+ TreeItem parentItem = selection[i].getParentItem();
+ if (parentItem != null) {
+ index = parentItem.indexOf(selection[i]);
+ } else {
+ Tree parentTree = selection[i].getParent();
+ index = parentTree.indexOf(selection[i]);
+ }
+ index = ((ITreeModelContentProvider)clientViewer.getContentProvider()).viewToModelIndex(parentPath, index);
+ vSelection.add( parentVItem.getItem(new Index(index)) );
+ }
+ }
+ validator.setItemsToCopy(vSelection);
listener.fItemsToUpdate = new HashSet<>(vSelection);
- virtualViewer.getTree().validate();
- return virtualViewer;
+ virtualViewer.getTree().validate();
+ return virtualViewer;
}
protected TreeItem[] getSelectedItems(TreeModelViewer clientViewer) {
- return clientViewer.getTree().getSelection();
+ return clientViewer.getTree().getSelection();
}
/**
@@ -254,9 +254,9 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
*/
@Override
public void run(final IAction action) {
- if (fClientViewer.getSelection().isEmpty()) {
- return;
- }
+ if (fClientViewer.getSelection().isEmpty()) {
+ return;
+ }
final VirtualViewerListener listener = new VirtualViewerListener();
ItemsToCopyVirtualItemValidator validator = new ItemsToCopyVirtualItemValidator();
@@ -270,17 +270,17 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException {
- synchronized(listener) {
- listener.fProgressMonitor = m;
- listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getAction().getText()), listener.fItemsToUpdate.size());
- }
-
- while (!listener.fItemsToUpdate.isEmpty() && !listener.fProgressMonitor.isCanceled()) {
- Thread.sleep(1);
- }
- synchronized(listener) {
- listener.fProgressMonitor = null;
- }
+ synchronized(listener) {
+ listener.fProgressMonitor = m;
+ listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getAction().getText()), listener.fItemsToUpdate.size());
+ }
+
+ while (!listener.fItemsToUpdate.isEmpty() && !listener.fProgressMonitor.isCanceled()) {
+ Thread.sleep(1);
+ }
+ synchronized(listener) {
+ listener.fProgressMonitor = null;
+ }
}
};
try {
@@ -293,24 +293,24 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
}
if (!monitor.isCanceled()) {
- copySelectionToClipboard(virtualViewer, validator.fItemsToCopy, listener.fSelectionRootDepth);
+ copySelectionToClipboard(virtualViewer, validator.fItemsToCopy, listener.fSelectionRootDepth);
}
- virtualViewer.removeLabelUpdateListener(listener);
- virtualViewer.getTree().removeItemListener(listener);
+ virtualViewer.removeLabelUpdateListener(listener);
+ virtualViewer.getTree().removeItemListener(listener);
virtualViewer.dispose();
}
private void copySelectionToClipboard(VirtualTreeModelViewer virtualViewer, Set<VirtualItem> itemsToCopy, int selectionRootDepth) {
- StringBuffer buffer = new StringBuffer();
- writeItemToBuffer (virtualViewer.getTree(), itemsToCopy, buffer, -selectionRootDepth);
- writeBufferToClipboard(buffer);
+ StringBuffer buffer = new StringBuffer();
+ writeItemToBuffer (virtualViewer.getTree(), itemsToCopy, buffer, -selectionRootDepth);
+ writeBufferToClipboard(buffer);
}
protected void writeItemToBuffer(VirtualItem item, Set<VirtualItem> itemsToCopy, StringBuffer buffer, int indent) {
- if (itemsToCopy.contains(item)) {
- append(item, buffer, indent);
- }
+ if (itemsToCopy.contains(item)) {
+ append(item, buffer, indent);
+ }
VirtualItem[] children = item.getItems();
if (children != null) {
for (int i = 0; i < children.length; i++) {
@@ -324,8 +324,8 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
return;
}
- TextTransfer plainTextTransfer = TextTransfer.getInstance();
- Clipboard clipboard= new Clipboard(fClientViewer.getControl().getDisplay());
+ TextTransfer plainTextTransfer = TextTransfer.getInstance();
+ Clipboard clipboard= new Clipboard(fClientViewer.getControl().getDisplay());
try {
clipboard.setContents(
new String[]{buffer.toString()},
@@ -338,7 +338,7 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
writeBufferToClipboard(buffer);
}
} finally {
- clipboard.dispose();
+ clipboard.dispose();
}
}
@@ -359,11 +359,11 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
@Override
protected boolean getEnableStateForSelection(IStructuredSelection selection) {
- if (selection.isEmpty()) {
- return true;
- } else {
- return super.getEnableStateForSelection(selection);
- }
+ if (selection.isEmpty()) {
+ return true;
+ } else {
+ return super.getEnableStateForSelection(selection);
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java
index ba26f4622..8a9d49627 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java
@@ -62,69 +62,69 @@ import com.ibm.icu.text.MessageFormat;
*/
public class VirtualFindAction extends Action implements IUpdate {
- private TreeModelViewer fClientViewer;
+ private TreeModelViewer fClientViewer;
private class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
- private boolean fViewerUpdatesComplete = false;
- private boolean fLabelUpdatesComplete = false;
- private IProgressMonitor fProgressMonitor;
- private int fRemainingUpdatesCount = 0;
+ private boolean fViewerUpdatesComplete = false;
+ private boolean fLabelUpdatesComplete = false;
+ private IProgressMonitor fProgressMonitor;
+ private int fRemainingUpdatesCount = 0;
- @Override
+ @Override
public void labelUpdateStarted(ILabelUpdate update) {}
- @Override
+ @Override
public void labelUpdateComplete(ILabelUpdate update) {
- incrementProgress(1);
- }
- @Override
+ incrementProgress(1);
+ }
+ @Override
public void labelUpdatesBegin() {
- fLabelUpdatesComplete = false;
- }
- @Override
+ fLabelUpdatesComplete = false;
+ }
+ @Override
public void labelUpdatesComplete() {
- fLabelUpdatesComplete = true;
- completeProgress();
- }
+ fLabelUpdatesComplete = true;
+ completeProgress();
+ }
- @Override
+ @Override
public void updateStarted(IViewerUpdate update) {}
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {
- if (update instanceof IChildrenUpdate) {
- incrementProgress(((IChildrenUpdate)update).getLength());
- }
- }
- @Override
+ if (update instanceof IChildrenUpdate) {
+ incrementProgress(((IChildrenUpdate)update).getLength());
+ }
+ }
+ @Override
public void viewerUpdatesBegin() {
- fViewerUpdatesComplete = false;
- }
- @Override
+ fViewerUpdatesComplete = false;
+ }
+ @Override
public void viewerUpdatesComplete() {
- fViewerUpdatesComplete = true;
- completeProgress();
- }
-
- private void completeProgress() {
- IProgressMonitor pm;
- synchronized (this) {
- pm = fProgressMonitor;
- }
- if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
- pm.done();
- }
- }
-
- private void incrementProgress(int count) {
- IProgressMonitor pm;
- synchronized (this) {
- pm = fProgressMonitor;
- fRemainingUpdatesCount -= count;
- }
- if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
- pm.worked(count);
- }
- }
+ fViewerUpdatesComplete = true;
+ completeProgress();
+ }
+
+ private void completeProgress() {
+ IProgressMonitor pm;
+ synchronized (this) {
+ pm = fProgressMonitor;
+ }
+ if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
+ pm.done();
+ }
+ }
+
+ private void incrementProgress(int count) {
+ IProgressMonitor pm;
+ synchronized (this) {
+ pm = fProgressMonitor;
+ fRemainingUpdatesCount -= count;
+ }
+ if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
+ pm.worked(count);
+ }
+ }
}
@@ -133,26 +133,26 @@ public class VirtualFindAction extends Action implements IUpdate {
private Map<VirtualItem, String> fTextCache = new HashMap<>();
public FindLabelProvider(VirtualTreeModelViewer viewer, List<VirtualItem> items) {
- fVirtualViewer = viewer;
- for (int i = 0; i < items.size(); i++) {
- VirtualItem item = items.get(i);
- fTextCache.put(item, fVirtualViewer.getText(item, 0));
- }
+ fVirtualViewer = viewer;
+ for (int i = 0; i < items.size(); i++) {
+ VirtualItem item = items.get(i);
+ fTextCache.put(item, fVirtualViewer.getText(item, 0));
+ }
}
@Override
public Image getImage(Object element) {
- return fVirtualViewer.getImage((VirtualItem) element, 0);
+ return fVirtualViewer.getImage((VirtualItem) element, 0);
}
@Override
public String getText(Object element) {
- return fTextCache.get(element);
+ return fTextCache.get(element);
}
}
public VirtualFindAction(TreeModelViewer viewer) {
- fClientViewer = viewer;
+ fClientViewer = viewer;
setText(ActionMessages.FindAction_0);
setId(DebugUIPlugin.getUniqueIdentifier() + ".FindElementAction"); //$NON-NLS-1$
@@ -162,31 +162,31 @@ public class VirtualFindAction extends Action implements IUpdate {
}
private VirtualTreeModelViewer initVirtualViewer(TreeModelViewer clientViewer, VirtualViewerListener listener) {
- Object input = clientViewer.getInput();
- ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
- clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
- listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta);
- VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(
- clientViewer.getDisplay(),
- SWT.NONE,
- clientViewer.getPresentationContext());
- fVirtualViewer.setFilters(clientViewer.getFilters());
- fVirtualViewer.addViewerUpdateListener(listener);
- fVirtualViewer.addLabelUpdateListener(listener);
- String[] columns = clientViewer.getPresentationContext().getColumns();
- fVirtualViewer.setInput(input);
- if (fVirtualViewer.canToggleColumns()) {
- fVirtualViewer.setShowColumns(clientViewer.isShowColumns());
- fVirtualViewer.setVisibleColumns(columns);
- }
- fVirtualViewer.updateViewer(stateDelta);
- return fVirtualViewer;
+ Object input = clientViewer.getInput();
+ ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
+ clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
+ listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta);
+ VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(
+ clientViewer.getDisplay(),
+ SWT.NONE,
+ clientViewer.getPresentationContext());
+ fVirtualViewer.setFilters(clientViewer.getFilters());
+ fVirtualViewer.addViewerUpdateListener(listener);
+ fVirtualViewer.addLabelUpdateListener(listener);
+ String[] columns = clientViewer.getPresentationContext().getColumns();
+ fVirtualViewer.setInput(input);
+ if (fVirtualViewer.canToggleColumns()) {
+ fVirtualViewer.setShowColumns(clientViewer.isShowColumns());
+ fVirtualViewer.setVisibleColumns(columns);
+ }
+ fVirtualViewer.updateViewer(stateDelta);
+ return fVirtualViewer;
}
@Override
public void run() {
- final VirtualViewerListener listener = new VirtualViewerListener();
- VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);
+ final VirtualViewerListener listener = new VirtualViewerListener();
+ VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);
ProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(fClientViewer.getControl().getShell(), 500);
final IProgressMonitor monitor = dialog.getProgressMonitor();
@@ -194,23 +194,23 @@ public class VirtualFindAction extends Action implements IUpdate {
try {
dialog.run(
- true, true,
- new IRunnableWithProgress() {
- @Override
+ true, true,
+ new IRunnableWithProgress() {
+ @Override
public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException {
- synchronized(listener) {
- listener.fProgressMonitor = m;
- listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
- }
-
- while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) {
- Thread.sleep(1);
- }
- synchronized(listener) {
- listener.fProgressMonitor = null;
- }
- }
- });
+ synchronized(listener) {
+ listener.fProgressMonitor = m;
+ listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
+ }
+
+ while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) {
+ Thread.sleep(1);
+ }
+ synchronized(listener) {
+ listener.fProgressMonitor = null;
+ }
+ }
+ });
} catch (InvocationTargetException e) {
DebugUIPlugin.log(e);
return;
@@ -225,30 +225,30 @@ public class VirtualFindAction extends Action implements IUpdate {
FindLabelProvider labelProvider = new FindLabelProvider(virtualViewer, list);
VirtualItem result = performFind(list, labelProvider);
if (result != null) {
- setSelectionToClient(virtualViewer, labelProvider, result);
+ setSelectionToClient(virtualViewer, labelProvider, result);
}
}
- virtualViewer.removeLabelUpdateListener(listener);
- virtualViewer.removeViewerUpdateListener(listener);
- virtualViewer.dispose();
+ virtualViewer.removeLabelUpdateListener(listener);
+ virtualViewer.removeViewerUpdateListener(listener);
+ virtualViewer.dispose();
}
private int calcUpdatesCount(IModelDelta stateDelta) {
- final int[] count = new int[] {0};
- stateDelta.accept( new IModelDeltaVisitor() {
- @Override
+ final int[] count = new int[] {0};
+ stateDelta.accept( new IModelDeltaVisitor() {
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
- count[0] += delta.getChildCount();
- return true;
- }
- return false;
- }
- });
-
- // Double it to account for separate element and label update ticks.
- return count[0] * 2;
+ if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
+ count[0] += delta.getChildCount();
+ return true;
+ }
+ return false;
+ }
+ });
+
+ // Double it to account for separate element and label update ticks.
+ return count[0] * 2;
}
private void collectAllChildren(VirtualItem element, List<VirtualItem> collect) {
@@ -265,52 +265,52 @@ public class VirtualFindAction extends Action implements IUpdate {
protected VirtualItem performFind(List<VirtualItem> items, FindLabelProvider labelProvider) {
FindElementDialog dialog = new FindElementDialog(
- fClientViewer.getControl().getShell(),
- labelProvider,
- items.toArray());
+ fClientViewer.getControl().getShell(),
+ labelProvider,
+ items.toArray());
dialog.setTitle(ActionMessages.FindDialog_3);
dialog.setMessage(ActionMessages.FindDialog_1);
if (dialog.open() == Window.OK) {
Object[] elements = dialog.getResult();
if (elements.length == 1) {
- return (VirtualItem)elements[0];
+ return (VirtualItem)elements[0];
}
}
return null;
}
protected void setSelectionToClient(VirtualTreeModelViewer virtualViewer, ILabelProvider labelProvider, VirtualItem findItem) {
- virtualViewer.getTree().setSelection(new VirtualItem[] { findItem } );
- ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
- virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
- // Set the force flag to all select delta in order to override model's selection policy.
- stateDelta.accept(new IModelDeltaVisitor() {
- @Override
+ virtualViewer.getTree().setSelection(new VirtualItem[] { findItem } );
+ ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
+ virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
+ // Set the force flag to all select delta in order to override model's selection policy.
+ stateDelta.accept(new IModelDeltaVisitor() {
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- if ((delta.getFlags() & IModelDelta.SELECT) != 0) {
- ((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.FORCE);
- }
- return true;
- }
- });
- fClientViewer.updateViewer(stateDelta);
-
- ISelection selection = fClientViewer.getSelection();
- if (!selection.isEmpty() &&
- selection instanceof IStructuredSelection &&
- ((IStructuredSelection)selection).getFirstElement().equals(findItem.getData()) ) {
- } else {
- DebugUIPlugin.errorDialog(
- fClientViewer.getControl().getShell(),
- ActionMessages.VirtualFindAction_0,
+ if ((delta.getFlags() & IModelDelta.SELECT) != 0) {
+ ((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.FORCE);
+ }
+ return true;
+ }
+ });
+ fClientViewer.updateViewer(stateDelta);
+
+ ISelection selection = fClientViewer.getSelection();
+ if (!selection.isEmpty() &&
+ selection instanceof IStructuredSelection &&
+ ((IStructuredSelection)selection).getFirstElement().equals(findItem.getData()) ) {
+ } else {
+ DebugUIPlugin.errorDialog(
+ fClientViewer.getControl().getShell(),
+ ActionMessages.VirtualFindAction_0,
MessageFormat.format(ActionMessages.VirtualFindAction_1, new Object[] { labelProvider.getText(findItem) }),
- new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), ActionMessages.VirtualFindAction_1));
- }
+ new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), ActionMessages.VirtualFindAction_1));
+ }
}
@Override
public void update() {
- setEnabled( fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0 );
+ setEnabled( fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0 );
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
index 4be545f67..14afa964f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
@@ -22,18 +22,18 @@ package org.eclipse.debug.internal.ui.viewers.model.provisional;
*/
public interface ICheckUpdate extends ILabelUpdate {
- /**
- * Property of the presentation context which indicates that the viewer
- * has the check box style.
- */
- String PROP_CHECK = "org.eclipse.debug.ui.check"; //$NON-NLS-1$
+ /**
+ * Property of the presentation context which indicates that the viewer
+ * has the check box style.
+ */
+ String PROP_CHECK = "org.eclipse.debug.ui.check"; //$NON-NLS-1$
- /**
- * Sets the check state of the tree node.
- *
- * @param checked Whether element should be checked.
- * @param grayed Whether element should be grayed out.
- */
- void setChecked(boolean checked, boolean grayed);
+ /**
+ * Sets the check state of the tree node.
+ *
+ * @param checked Whether element should be checked.
+ * @param grayed Whether element should be grayed out.
+ */
+ void setChecked(boolean checked, boolean grayed);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
index c85c55220..d8c9f3c99 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
@@ -26,22 +26,22 @@ import org.eclipse.jface.viewers.TreePath;
*/
public interface ICheckboxModelProxy {
- /**
- * Notifies the receiver that the given element has had its
- * checked state modified in the viewer.
- * <p>
- * This method is called in the UI thread. Clients that execute long running operations or
- * communicate with a potentially unreliable or blocking model should run those operations
- * asynchronously.
- * </p>
- *
- * @param context Presentation context in which the element was updated.
- * @param viewerInput The root element of the viewer where the check
- * selection took place.
- * @param path Path of the element that had its checked state changed
- * @param checked The new checked state of the element
- * @return false if the check state should not change
- */
- boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked);
+ /**
+ * Notifies the receiver that the given element has had its
+ * checked state modified in the viewer.
+ * <p>
+ * This method is called in the UI thread. Clients that execute long running operations or
+ * communicate with a potentially unreliable or blocking model should run those operations
+ * asynchronously.
+ * </p>
+ *
+ * @param context Presentation context in which the element was updated.
+ * @param viewerInput The root element of the viewer where the check
+ * selection took place.
+ * @param path Path of the element that had its checked state changed
+ * @param checked The new checked state of the element
+ * @return false if the check state should not change
+ */
+ boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java
index 67c0b8bbf..6d43b485a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java
@@ -42,7 +42,7 @@ public interface IElementContentProvider {
*
* @param updates Each update specifies children to update and stores results.
* The update array is guaranteed to have at least one element, and for
- * all updates to have the same presentation context.
+ * all updates to have the same presentation context.
*/
void update(IChildrenUpdate[] updates);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java
index 8ab79d3ad..93bbd0c0e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java
@@ -35,7 +35,7 @@ public interface IElementMementoProvider {
*
* @param requests Specifies elements and provides memento stores.
* The requests array is guaranteed to have at least one element, and for
- * all requests to have the same presentation context.
+ * all requests to have the same presentation context.
*/
void encodeElements(IElementMementoRequest[] requests);
@@ -44,7 +44,7 @@ public interface IElementMementoProvider {
*
* @param requests Specifies each element and previously created memento.
* The requests array is guaranteed to have at least one element, and for
- * all requests to have the same presentation context.
+ * all requests to have the same presentation context.
*/
void compareElements(IElementCompareRequest[] requests);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java
index cee30bef4..351a5db90 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java
@@ -41,37 +41,37 @@ public interface ILabelUpdate extends IViewerUpdate {
* @param text to set to viewer
* @param columnIndex column index (0 when no columns)
*/
- void setLabel(String text, int columnIndex);
+ void setLabel(String text, int columnIndex);
- /**
- * Sets the font of the label.
- *
- * @param fontData to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setFontData(FontData fontData, int columnIndex);
+ /**
+ * Sets the font of the label.
+ *
+ * @param fontData to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setFontData(FontData fontData, int columnIndex);
- /**
- * Sets the image of the label.
- *
- * @param image to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setImageDescriptor(ImageDescriptor image, int columnIndex);
+ /**
+ * Sets the image of the label.
+ *
+ * @param image to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setImageDescriptor(ImageDescriptor image, int columnIndex);
- /**
- * Sets the foreground color of the label.
- *
- * @param foreground to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setForeground(RGB foreground, int columnIndex);
+ /**
+ * Sets the foreground color of the label.
+ *
+ * @param foreground to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setForeground(RGB foreground, int columnIndex);
- /**
- * Sets the background color of the label.
- *
- * @param background to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setBackground(RGB background, int columnIndex);
+ /**
+ * Sets the background color of the label.
+ *
+ * @param background to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setBackground(RGB background, int columnIndex);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
index 975081ff1..5fd7ca553 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
@@ -69,8 +69,8 @@ public interface IModelProxy {
* This method is called by the asynchronous viewer framework and should not
* be called by clients.
* </p>
- * @param viewer viewer
- * @see IModelProxy2#initialize(ITreeModelViewer)
+ * @param viewer viewer
+ * @see IModelProxy2#initialize(ITreeModelViewer)
* @since 3.3
*/
void installed(Viewer viewer);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java
index c6eb135ab..eaeccfd63 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java
@@ -26,20 +26,20 @@ import org.eclipse.jface.viewers.Viewer;
*/
public interface IModelProxy2 extends IModelProxy {
- /**
- * Initialize model proxy with given tree model viewer. This method is
- * called on the viewer's Display thread and is guaranteed to be called
- * before the dispose() method is called on the same proxy. The default
- * implementation of this method calls {@link #init(IPresentationContext)}
- * and {@link #installed(Viewer)} asynchornously and not in the Display
- * thread.
- * <p>
- * This method is called by the asynchronous viewer framework and should
- * not be called by clients.
- * </p>
- * @param viewer Viewer that is installing this model proxy.
- *
- */
- void initialize(ITreeModelViewer viewer);
+ /**
+ * Initialize model proxy with given tree model viewer. This method is
+ * called on the viewer's Display thread and is guaranteed to be called
+ * before the dispose() method is called on the same proxy. The default
+ * implementation of this method calls {@link #init(IPresentationContext)}
+ * and {@link #installed(Viewer)} asynchornously and not in the Display
+ * thread.
+ * <p>
+ * This method is called by the asynchronous viewer framework and should
+ * not be called by clients.
+ * </p>
+ * @param viewer Viewer that is installing this model proxy.
+ *
+ */
+ void initialize(ITreeModelViewer viewer);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java
index 9107eecc9..cf846b64f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java
@@ -85,5 +85,5 @@ public interface IModelSelectionPolicy {
* the selection after the update, or <code>null</code> if none
* @return new selection or <code>null</code> if none
*/
- ISelection replaceInvalidSelection(ISelection invalidSelection, ISelection newSelection);
+ ISelection replaceInvalidSelection(ISelection invalidSelection, ISelection newSelection);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java
index 4cc72bfe2..bc411b429 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java
@@ -44,91 +44,91 @@ public interface IPresentationContext {
*/
String PROPERTY_DISPOSED = "PROPERTY_DISPOSED"; //$NON-NLS-1$
- /**
- * Returns identifiers of the visible columns in the order
- * labels should be provided, or <code>null</code> if columns
- * are not being displayed. Label providers use this
- * information.
- *
- * @return visible column identifiers or <code>null</code>
- * @see IColumnPresentation
- */
- String[] getColumns();
+ /**
+ * Returns identifiers of the visible columns in the order
+ * labels should be provided, or <code>null</code> if columns
+ * are not being displayed. Label providers use this
+ * information.
+ *
+ * @return visible column identifiers or <code>null</code>
+ * @see IColumnPresentation
+ */
+ String[] getColumns();
- /**
- * Registers the given listener for property change notification.
- *
- * @param listener property listener
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Registers the given listener for property change notification.
+ *
+ * @param listener property listener
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Unregisters the given listener from property change notification.
- *
- * @param listener property listener.
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Unregisters the given listener from property change notification.
+ *
+ * @param listener property listener.
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Returns the id of this presentation context. Usually this is the id of
- * the associated part. However, when no part is associated with this context,
- * the id may exist on its own. Allows for a context that is not tied to a part.
- *
- * @return id
- * @since 3.3
- */
- String getId();
+ /**
+ * Returns the id of this presentation context. Usually this is the id of
+ * the associated part. However, when no part is associated with this context,
+ * the id may exist on its own. Allows for a context that is not tied to a part.
+ *
+ * @return id
+ * @since 3.3
+ */
+ String getId();
- /**
- * Sets the specified property and notifies listeners of changes.
- *
- * @param property property name
- * @param value property value
- */
- void setProperty(String property, Object value);
+ /**
+ * Sets the specified property and notifies listeners of changes.
+ *
+ * @param property property name
+ * @param value property value
+ */
+ void setProperty(String property, Object value);
- /**
- * Returns the property with the specified name or <code>null</code>
- * if none.
- *
- * @param property property name
- * @return property value or <code>null</code>
- */
- Object getProperty(String property);
+ /**
+ * Returns the property with the specified name or <code>null</code>
+ * if none.
+ *
+ * @param property property name
+ * @return property value or <code>null</code>
+ */
+ Object getProperty(String property);
- /**
- * Disposes this presentation context. Called by the framework
- * when the associated viewer is disposed.
- */
- void dispose();
+ /**
+ * Disposes this presentation context. Called by the framework
+ * when the associated viewer is disposed.
+ */
+ void dispose();
- /**
- * Returns all keys of properties currently set in this context,
- * possibly an empty collection
- *
- * @return keys of all current properties
- * @since 3.4
- */
- String[] getProperties();
+ /**
+ * Returns all keys of properties currently set in this context,
+ * possibly an empty collection
+ *
+ * @return keys of all current properties
+ * @since 3.4
+ */
+ String[] getProperties();
- /**
- * Returns the part that this presentation context is associated with.
- * May return <code>null</code> if the presentation is not associated
- * with a part.
- *
- * @return IWorkbenchPart or <code>null</code>
- * @since 3.6
- */
- IWorkbenchPart getPart();
+ /**
+ * Returns the part that this presentation context is associated with.
+ * May return <code>null</code> if the presentation is not associated
+ * with a part.
+ *
+ * @return IWorkbenchPart or <code>null</code>
+ * @since 3.6
+ */
+ IWorkbenchPart getPart();
- /**
- * Returns the window that this presentation context is associated with.
- * May return <code>null</code> if the presentation is not associated
- * with a window.
- *
- * @return IWorkbenchWindow or <code>null</code>
- * @since 3.6
- */
- IWorkbenchWindow getWindow();
+ /**
+ * Returns the window that this presentation context is associated with.
+ * May return <code>null</code> if the presentation is not associated
+ * with a window.
+ *
+ * @return IWorkbenchWindow or <code>null</code>
+ * @since 3.6
+ */
+ IWorkbenchWindow getWindow();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java
index 198b97a0e..fddacb5cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java
@@ -32,30 +32,30 @@ public interface IStateUpdateListener {
* Notification that viewer updates are complete. Corresponds to
* a <code>viewerUpdatesBegin()</code> notification.
*
- * @param input Input object for the state operation.
+ * @param input Input object for the state operation.
*/
void stateSaveUpdatesComplete(Object input);
/**
- * Notification that a sequence of viewer updates are starting.
- *
- * @param input Input object for the state operation.
- */
- void stateRestoreUpdatesBegin(Object input);
+ * Notification that a sequence of viewer updates are starting.
+ *
+ * @param input Input object for the state operation.
+ */
+ void stateRestoreUpdatesBegin(Object input);
- /**
- * Notification that viewer updates are complete. Corresponds to
- * a <code>viewerUpdatesBegin()</code> notification.
- *
- * @param input Input object for the state operation.
- */
- void stateRestoreUpdatesComplete(Object input);
+ /**
+ * Notification that viewer updates are complete. Corresponds to
+ * a <code>viewerUpdatesBegin()</code> notification.
+ *
+ * @param input Input object for the state operation.
+ */
+ void stateRestoreUpdatesComplete(Object input);
/**
* Notification that a specific update has started within
* a sequence of updates.
*
- * @param input Input object for the state operation.
+ * @param input Input object for the state operation.
* @param update update
*/
void stateUpdateStarted(Object input, IViewerUpdate update);
@@ -64,7 +64,7 @@ public interface IStateUpdateListener {
* Notification that a specific update has completed within a
* sequence of updates.
*
- * @param input Input object for the state operation.
+ * @param input Input object for the state operation.
* @param update update
*/
void stateUpdateComplete(Object input, IViewerUpdate update);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java
index 6e63beb16..5c7b18f74 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java
@@ -42,20 +42,20 @@ import org.eclipse.core.runtime.IStatus;
*/
public interface IStatusMonitor extends IProgressMonitor {
- /**
- * Sets the status for a request, possibly <code>null</code>.
- * When a request fails, the status indicates why the request failed.
- * A <code>null</code> status is considered to be successful.
- *
- * @param status request status
- */
- void setStatus(IStatus status);
+ /**
+ * Sets the status for a request, possibly <code>null</code>.
+ * When a request fails, the status indicates why the request failed.
+ * A <code>null</code> status is considered to be successful.
+ *
+ * @param status request status
+ */
+ void setStatus(IStatus status);
- /**
- * Returns the status of this request, or <code>null</code>.
- *
- * @return request status - <code>null</code> is equivalent
- * to an OK status
- */
- IStatus getStatus();
+ /**
+ * Returns the status of this request, or <code>null</code>.
+ *
+ * @return request status - <code>null</code> is equivalent
+ * to an OK status
+ */
+ IStatus getStatus();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java
index 8c0dc9887..b7ba38a9a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java
@@ -31,251 +31,251 @@ import org.eclipse.swt.widgets.Display;
*/
public interface ITreeModelViewer extends ISelectionProvider {
- /**
- * Constant indicating that all levels of the tree should be expanded or
- * collapsed.
- *
- * @see #setAutoExpandLevel(int)
- * @see #getAutoExpandLevel()
- */
- int ALL_LEVELS = -1;
+ /**
+ * Constant indicating that all levels of the tree should be expanded or
+ * collapsed.
+ *
+ * @see #setAutoExpandLevel(int)
+ * @see #getAutoExpandLevel()
+ */
+ int ALL_LEVELS = -1;
- /**
- * Returns the Display object that this viewer is in. The
- * display object can be used by clients to access the display thread
- * to call the viewer methods.
- *
- * @return The display.
- */
- Display getDisplay();
+ /**
+ * Returns the Display object that this viewer is in. The
+ * display object can be used by clients to access the display thread
+ * to call the viewer methods.
+ *
+ * @return The display.
+ */
+ Display getDisplay();
- /**
- * Returns this viewer's presentation context.
- *
- * @return presentation context
- */
- IPresentationContext getPresentationContext();
+ /**
+ * Returns this viewer's presentation context.
+ *
+ * @return presentation context
+ */
+ IPresentationContext getPresentationContext();
- /**
- * Returns the current input of this viewer, or <code>null</code>
- * if none. The viewer's input provides the "model" for the viewer's
- * content.
- *
- * @return Input object
- */
- Object getInput();
+ /**
+ * Returns the current input of this viewer, or <code>null</code>
+ * if none. The viewer's input provides the "model" for the viewer's
+ * content.
+ *
+ * @return Input object
+ */
+ Object getInput();
- /**
- * Sets the input of this viewer. Setting the input resets the
- * viewer's contents and triggers an update starting at the input
- * element.
- *
- * @param object Input element, or <code>null</code> if none.
- */
- void setInput(Object object);
+ /**
+ * Sets the input of this viewer. Setting the input resets the
+ * viewer's contents and triggers an update starting at the input
+ * element.
+ *
+ * @param object Input element, or <code>null</code> if none.
+ */
+ void setInput(Object object);
- /**
- * Returns the current selection in viewer.
- *
- * @return selection object
- */
- @Override ISelection getSelection();
+ /**
+ * Returns the current selection in viewer.
+ *
+ * @return selection object
+ */
+ @Override ISelection getSelection();
- /**
- * Sets a new selection for this viewer and optionally makes it visible.
- * The selection is not set if the model selection policy overrides the
- * attempt to set the selection.
- *
- * @param selection the new selection
- * @param reveal <code>true</code> if the selection is to be made
- * visible, and <code>false</code> otherwise
- * @param force <code>true</code> if the selection should override the
- * model selection policy
- */
- void setSelection(ISelection selection, boolean reveal, boolean force);
+ /**
+ * Sets a new selection for this viewer and optionally makes it visible.
+ * The selection is not set if the model selection policy overrides the
+ * attempt to set the selection.
+ *
+ * @param selection the new selection
+ * @param reveal <code>true</code> if the selection is to be made
+ * visible, and <code>false</code> otherwise
+ * @param force <code>true</code> if the selection should override the
+ * model selection policy
+ */
+ void setSelection(ISelection selection, boolean reveal, boolean force);
- /**
- * Attempts to set the selection for this viewer and optionally makes it visible.
- * The selection is not set if the model selection policy overrides the
- * attempt to set the selection.
- *
- * @param selection the new selection
- * @param reveal whether to make the selection visible after successfully setting
- * the selection
- * @param force whether to force the selection (override the model selection policy)
- * @return <code>true</code> if the selection was set and <code>false</code> if the
- * model selection policy overrides the selection attempt
- */
- boolean trySelection(ISelection selection, boolean reveal, boolean force);
+ /**
+ * Attempts to set the selection for this viewer and optionally makes it visible.
+ * The selection is not set if the model selection policy overrides the
+ * attempt to set the selection.
+ *
+ * @param selection the new selection
+ * @param reveal whether to make the selection visible after successfully setting
+ * the selection
+ * @param force whether to force the selection (override the model selection policy)
+ * @return <code>true</code> if the selection was set and <code>false</code> if the
+ * model selection policy overrides the selection attempt
+ */
+ boolean trySelection(ISelection selection, boolean reveal, boolean force);
- /**
- * Returns the auto-expand level.
- *
- * @return non-negative level, or <code>ALL_LEVELS</code> if all levels of
- * the tree are expanded automatically
- * @see #setAutoExpandLevel
- */
- int getAutoExpandLevel();
+ /**
+ * Returns the auto-expand level.
+ *
+ * @return non-negative level, or <code>ALL_LEVELS</code> if all levels of
+ * the tree are expanded automatically
+ * @see #setAutoExpandLevel
+ */
+ int getAutoExpandLevel();
- /**
- * Sets the auto-expand level to be used when the input of the viewer is set
- * using {@link #setInput(Object)}. The value 0 means that there is no
- * auto-expand; 1 means that the invisible root element is expanded (since
- * most concrete implementations do not show the root element, there is usually
- * no practical difference between using the values 0 and 1); 2 means that
- * top-level elements are expanded, but not their children; 3 means that
- * top-level elements are expanded, and their children, but not
- * grandchildren; and so on.
- * <p>
- * The value <code>ALL_LEVELS</code> means that all subtrees should be
- * expanded.
- * </p>
- *
- * @param level
- * non-negative level, or <code>ALL_LEVELS</code> to expand all
- * levels of the tree
- */
- void setAutoExpandLevel(int level);
+ /**
+ * Sets the auto-expand level to be used when the input of the viewer is set
+ * using {@link #setInput(Object)}. The value 0 means that there is no
+ * auto-expand; 1 means that the invisible root element is expanded (since
+ * most concrete implementations do not show the root element, there is usually
+ * no practical difference between using the values 0 and 1); 2 means that
+ * top-level elements are expanded, but not their children; 3 means that
+ * top-level elements are expanded, and their children, but not
+ * grandchildren; and so on.
+ * <p>
+ * The value <code>ALL_LEVELS</code> means that all subtrees should be
+ * expanded.
+ * </p>
+ *
+ * @param level
+ * non-negative level, or <code>ALL_LEVELS</code> to expand all
+ * levels of the tree
+ */
+ void setAutoExpandLevel(int level);
- /**
- * Returns the label data for the given element and for the given column,
- * Returns <code>null</code> if the given element is not found or is not
- * materialized in the virtual viewer. Clients may listen to label update
- * events to be notified when element labels are updated.
- *
- * @param path Path of the element.
- * @param columnId ID of the column for which to return the label data.
- * @return Label object containing the label information. Can be
- * <code>null</code> if the given element is not found or is not
- * materialized in the virtual viewer.
- */
- ViewerLabel getElementLabel(TreePath path, String columnId);
+ /**
+ * Returns the label data for the given element and for the given column,
+ * Returns <code>null</code> if the given element is not found or is not
+ * materialized in the virtual viewer. Clients may listen to label update
+ * events to be notified when element labels are updated.
+ *
+ * @param path Path of the element.
+ * @param columnId ID of the column for which to return the label data.
+ * @return Label object containing the label information. Can be
+ * <code>null</code> if the given element is not found or is not
+ * materialized in the virtual viewer.
+ */
+ ViewerLabel getElementLabel(TreePath path, String columnId);
- /**
- * Registers the specified listener for view update notifications.
- *
- * @param listener Listener to add
- */
- void addViewerUpdateListener(IViewerUpdateListener listener);
+ /**
+ * Registers the specified listener for view update notifications.
+ *
+ * @param listener Listener to add
+ */
+ void addViewerUpdateListener(IViewerUpdateListener listener);
- /**
- * Removes the specified listener from update notifications.
- *
- * @param listener Listener to remove
- */
- void removeViewerUpdateListener(IViewerUpdateListener listener);
+ /**
+ * Removes the specified listener from update notifications.
+ *
+ * @param listener Listener to remove
+ */
+ void removeViewerUpdateListener(IViewerUpdateListener listener);
- /**
- * Registers the specified listener for state update notifications.
- *
- * @param listener Listener to add
- */
- void addStateUpdateListener(IStateUpdateListener listener);
+ /**
+ * Registers the specified listener for state update notifications.
+ *
+ * @param listener Listener to add
+ */
+ void addStateUpdateListener(IStateUpdateListener listener);
- /**
- * Removes the specified listener from state update notifications.
- *
- * @param listener Listener to remove
- */
- void removeStateUpdateListener(IStateUpdateListener listener);
+ /**
+ * Removes the specified listener from state update notifications.
+ *
+ * @param listener Listener to remove
+ */
+ void removeStateUpdateListener(IStateUpdateListener listener);
- /**
- * Registers the specified listener for view label update notifications.
- *
- * @param listener Listener to add
- */
- void addLabelUpdateListener(ILabelUpdateListener listener);
+ /**
+ * Registers the specified listener for view label update notifications.
+ *
+ * @param listener Listener to add
+ */
+ void addLabelUpdateListener(ILabelUpdateListener listener);
- /**
- * Removes the specified listener from view label update notifications.
- *
- * @param listener Listener to remove
- */
- void removeLabelUpdateListener(ILabelUpdateListener listener);
+ /**
+ * Removes the specified listener from view label update notifications.
+ *
+ * @param listener Listener to remove
+ */
+ void removeLabelUpdateListener(ILabelUpdateListener listener);
- /**
- * Registers the given listener for model delta notification.
- * This listener is called immediately after the viewer processes
- * the delta.
- *
- * @param listener Listener to add
- */
- void addModelChangedListener(IModelChangedListener listener);
+ /**
+ * Registers the given listener for model delta notification.
+ * This listener is called immediately after the viewer processes
+ * the delta.
+ *
+ * @param listener Listener to add
+ */
+ void addModelChangedListener(IModelChangedListener listener);
- /**
- * Removes the given listener from model delta notification.
- *
- * @param listener Listener to remove
- */
- void removeModelChangedListener(IModelChangedListener listener);
+ /**
+ * Removes the given listener from model delta notification.
+ *
+ * @param listener Listener to remove
+ */
+ void removeModelChangedListener(IModelChangedListener listener);
- /**
- * Writes state information into a delta for the sub-tree at the given
- * path. It adds delta nodes and IModelDelta.EXPAND and IModelDelta.SELECT
- * as it parses the sub-tree.
- *
- * @param path Path where to start saving the state.
- * @param delta The delta where the state is to be saved.
- * @param flagsToSave The flags to preserve during the state save. The
- * supported flags are <code>IModelDelta.SELECT</code>,
- * <code>IModelDelta.EXPAND</code>, <code>IModelDelta.COLLAPSE</code>.
- * @return Returns whether the state was saved for the given path. Will
- * return <code>false</code> if an element at the given path cannot
- * be found.
- */
- boolean saveElementState(TreePath path, ModelDelta delta, int flagsToSave);
+ /**
+ * Writes state information into a delta for the sub-tree at the given
+ * path. It adds delta nodes and IModelDelta.EXPAND and IModelDelta.SELECT
+ * as it parses the sub-tree.
+ *
+ * @param path Path where to start saving the state.
+ * @param delta The delta where the state is to be saved.
+ * @param flagsToSave The flags to preserve during the state save. The
+ * supported flags are <code>IModelDelta.SELECT</code>,
+ * <code>IModelDelta.EXPAND</code>, <code>IModelDelta.COLLAPSE</code>.
+ * @return Returns whether the state was saved for the given path. Will
+ * return <code>false</code> if an element at the given path cannot
+ * be found.
+ */
+ boolean saveElementState(TreePath path, ModelDelta delta, int flagsToSave);
- /**
- * Causes the viewer to process the given delta as if it came from a
- * model proxy. This method is intended to be used to restore state
- * saved using {@link #saveElementState(TreePath, ModelDelta, int)}.
- *
- * @param delta Delta to process.
- */
- void updateViewer(IModelDelta delta);
+ /**
+ * Causes the viewer to process the given delta as if it came from a
+ * model proxy. This method is intended to be used to restore state
+ * saved using {@link #saveElementState(TreePath, ModelDelta, int)}.
+ *
+ * @param delta Delta to process.
+ */
+ void updateViewer(IModelDelta delta);
- /**
- * Triggers an update of the given element and its children. If
- * multiple instances of the given element are found in the tree,
- * they will all be updated.
- *
- * @param element Element to update.
- */
- void refresh(Object element);
+ /**
+ * Triggers an update of the given element and its children. If
+ * multiple instances of the given element are found in the tree,
+ * they will all be updated.
+ *
+ * @param element Element to update.
+ */
+ void refresh(Object element);
- /**
- * Triggers a full update of all the elements in the tree.
- */
- void refresh();
+ /**
+ * Triggers a full update of all the elements in the tree.
+ */
+ void refresh();
- /**
- * Returns the paths at which the given element is found realized in viewer
- * or an empty array if not found.
- *
- * @param element Element to find.
- * @return Array of paths for given element.
- */
- TreePath[] getElementPaths(Object element);
+ /**
+ * Returns the paths at which the given element is found realized in viewer
+ * or an empty array if not found.
+ *
+ * @param element Element to find.
+ * @return Array of paths for given element.
+ */
+ TreePath[] getElementPaths(Object element);
- /**
- * Returns filters currently configured in viewer.
- *
- * @return filter array in viewer.
- */
- ViewerFilter[] getFilters();
+ /**
+ * Returns filters currently configured in viewer.
+ *
+ * @return filter array in viewer.
+ */
+ ViewerFilter[] getFilters();
- /**
- * Add a new filter to use in viewer.
- *
- * @param filter Filter to add.
- */
- void addFilter(ViewerFilter filter);
+ /**
+ * Add a new filter to use in viewer.
+ *
+ * @param filter Filter to add.
+ */
+ void addFilter(ViewerFilter filter);
- /**
- * Sets viewer filters to the filters in array.
- *
- * @param filters New filter array to use.
- */
+ /**
+ * Sets viewer filters to the filters in array.
+ *
+ * @param filters New filter array to use.
+ */
void setFilters(ViewerFilter... filters);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java
index a7141a47e..dda5ce605 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java
@@ -31,27 +31,27 @@ public interface IViewerUpdate extends IRequest {
*/
IPresentationContext getPresentationContext();
- /**
- * Returns the model element associated with this request.
- *
- * @return associated model element
- */
- Object getElement();
+ /**
+ * Returns the model element associated with this request.
+ *
+ * @return associated model element
+ */
+ Object getElement();
- /**
- * Returns the viewer tree path to the model element associated with this
- * request. An empty path indicates a root element.
- *
- * @return tree path, possibly empty
- */
- TreePath getElementPath();
+ /**
+ * Returns the viewer tree path to the model element associated with this
+ * request. An empty path indicates a root element.
+ *
+ * @return tree path, possibly empty
+ */
+ TreePath getElementPath();
- /**
- * Returns the element that was the viewer input at the time the
- * request was made, possibly <code>null</code>.
- *
- * @return viewer input element, possibly <code>null</code>
- * @since 3.4
- */
- Object getViewerInput();
+ /**
+ * Returns the element that was the viewer input at the time the
+ * request was made, possibly <code>null</code>.
+ *
+ * @return viewer input element, possibly <code>null</code>
+ * @since 3.4
+ */
+ Object getViewerInput();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java
index 41d449be7..bee1e2b4c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java
@@ -22,20 +22,20 @@ package org.eclipse.debug.internal.ui.viewers.model.provisional;
*/
public interface IVirtualItemListener {
- /**
- * Called when the item has been shown in the virtual viewer's
- * view-port. This indicates to the viewer that it should check
- * the item's status and request needed data.
- *
- * @param item The item that was revealed.
- */
- void revealed(VirtualItem item);
+ /**
+ * Called when the item has been shown in the virtual viewer's
+ * view-port. This indicates to the viewer that it should check
+ * the item's status and request needed data.
+ *
+ * @param item The item that was revealed.
+ */
+ void revealed(VirtualItem item);
- /**
- * Called when an item is disposed. It tells the viewer to
- * clean up any remaining mappings and cached data of this item.
- *
- * @param item The itam that was disposed.
- */
- void disposed(VirtualItem item);
+ /**
+ * Called when an item is disposed. It tells the viewer to
+ * clean up any remaining mappings and cached data of this item.
+ *
+ * @param item The itam that was disposed.
+ */
+ void disposed(VirtualItem item);
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java
index d0054865b..981a842e0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java
@@ -23,19 +23,19 @@ package org.eclipse.debug.internal.ui.viewers.model.provisional;
*/
public interface IVirtualItemValidator {
- /**
- * Allows the validator to determine whether the given item is to be deemed
- * visible in the virtual tree.
- *
- * @param item Item to be tested.
- * @return returns true if the item should be considered visible.
- */
- boolean isItemVisible(VirtualItem item);
+ /**
+ * Allows the validator to determine whether the given item is to be deemed
+ * visible in the virtual tree.
+ *
+ * @param item Item to be tested.
+ * @return returns true if the item should be considered visible.
+ */
+ boolean isItemVisible(VirtualItem item);
- /**
- * Indicates that the viewer requested to reveal the given item in viewer.
- *
- * @param item Item to show.
- */
- void showItem(VirtualItem item);
+ /**
+ * Indicates that the viewer requested to reveal the given item in viewer.
+ *
+ * @param item Item to show.
+ */
+ void showItem(VirtualItem item);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
index 369307a8f..cb147026e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
@@ -64,8 +64,8 @@ public class ModelDelta implements IModelDelta {
*/
public ModelDelta(Object element, Object replacement, int flags) {
this(element, flags);
- fReplacement = replacement;
- }
+ fReplacement = replacement;
+ }
/**
* Constructs a new delta for the given element to be inserted at
@@ -75,10 +75,10 @@ public class ModelDelta implements IModelDelta {
* @param index insertion position
* @param flags change flags
*/
- public ModelDelta(Object element, int index, int flags) {
+ public ModelDelta(Object element, int index, int flags) {
this(element, flags);
- fIndex = index;
- }
+ fIndex = index;
+ }
/**
* Constructs a new delta for the given element at the specified index
@@ -89,12 +89,12 @@ public class ModelDelta implements IModelDelta {
* @param flags change flags
* @param childCount number of children this node has
*/
- public ModelDelta(Object element, int index, int flags, int childCount) {
+ public ModelDelta(Object element, int index, int flags, int childCount) {
this(element, index, flags);
- fChildCount = childCount;
- }
+ fChildCount = childCount;
+ }
- @Override
+ @Override
public Object getElement() {
return fElement;
}
@@ -126,74 +126,74 @@ public class ModelDelta implements IModelDelta {
* @return corresponding delta node, or <code>null</code>
*/
public ModelDelta getChildDelta(Object element) {
- if (fNodesMap == null) {
- mapNodes();
- }
- Object nodeOrNodes = fNodesMap.get(element);
- if (nodeOrNodes instanceof ModelDelta) {
- return (ModelDelta)nodeOrNodes;
- } else if (nodeOrNodes instanceof ModelDelta[]) {
- return ((ModelDelta[])nodeOrNodes)[0];
- }
- return null;
+ if (fNodesMap == null) {
+ mapNodes();
+ }
+ Object nodeOrNodes = fNodesMap.get(element);
+ if (nodeOrNodes instanceof ModelDelta) {
+ return (ModelDelta)nodeOrNodes;
+ } else if (nodeOrNodes instanceof ModelDelta[]) {
+ return ((ModelDelta[])nodeOrNodes)[0];
+ }
+ return null;
}
/**
- * Returns the child delta for the given element and index, or <code>null</code> if none.
- *
- * @param element Element of the child delta to find
- * @param index Index of the child delta to find.
- * @return corresponding delta node, or <code>null</code>
- *
- * @since 3.8
- */
- public ModelDelta getChildDelta(Object element, int index) {
- if (fNodesMap == null) {
- mapNodes();
- }
- Object nodeOrNodes = fNodesMap.get(element);
- if (nodeOrNodes instanceof ModelDelta) {
- ModelDelta node = (ModelDelta)nodeOrNodes;
- if (index == node.getIndex()) {
- return node;
- }
- } else if (nodeOrNodes instanceof ModelDelta[]) {
- ModelDelta[] nodes = (ModelDelta[])nodeOrNodes;
- for (int i = 0; i < nodes.length; i++) {
- if (index == nodes[i].getIndex()) {
- return nodes[i];
- }
- }
- }
- return null;
- }
+ * Returns the child delta for the given element and index, or <code>null</code> if none.
+ *
+ * @param element Element of the child delta to find
+ * @param index Index of the child delta to find.
+ * @return corresponding delta node, or <code>null</code>
+ *
+ * @since 3.8
+ */
+ public ModelDelta getChildDelta(Object element, int index) {
+ if (fNodesMap == null) {
+ mapNodes();
+ }
+ Object nodeOrNodes = fNodesMap.get(element);
+ if (nodeOrNodes instanceof ModelDelta) {
+ ModelDelta node = (ModelDelta)nodeOrNodes;
+ if (index == node.getIndex()) {
+ return node;
+ }
+ } else if (nodeOrNodes instanceof ModelDelta[]) {
+ ModelDelta[] nodes = (ModelDelta[])nodeOrNodes;
+ for (int i = 0; i < nodes.length; i++) {
+ if (index == nodes[i].getIndex()) {
+ return nodes[i];
+ }
+ }
+ }
+ return null;
+ }
private void mapNodes() {
- if (fNodesList == null) {
+ if (fNodesList == null) {
fNodesMap = new HashMap<>(1);
- return;
- }
- // Create a map with capacity for all child nodes.
+ return;
+ }
+ // Create a map with capacity for all child nodes.
fNodesMap = new HashMap<>(fNodesList.size() * 4 / 3);
- for (int i = 0; i < fNodesList.size(); i++) {
- mapNode( fNodesList.get(i) );
- }
+ for (int i = 0; i < fNodesList.size(); i++) {
+ mapNode( fNodesList.get(i) );
+ }
}
private void mapNode(ModelDelta node) {
- Object oldValue = fNodesMap.put(node.getElement(), node);
- if (oldValue instanceof ModelDelta) {
- // Edge case: already a node for given element was added.
- ModelDelta[] nodes = new ModelDelta[] { (ModelDelta)oldValue, node };
- fNodesMap.put(node.getElement(), nodes);
- } else if (oldValue instanceof ModelDelta[]) {
- // Even more remote case: multiple delta nodes for the same element were already added
- ModelDelta[] oldNodes = (ModelDelta[])oldValue;
- ModelDelta[] newNodes = new ModelDelta[oldNodes.length + 1];
- System.arraycopy(oldNodes, 0, newNodes, 0, oldNodes.length);
- newNodes[newNodes.length - 1] = node;
- fNodesMap.put(node.getElement(), newNodes);
- }
+ Object oldValue = fNodesMap.put(node.getElement(), node);
+ if (oldValue instanceof ModelDelta) {
+ // Edge case: already a node for given element was added.
+ ModelDelta[] nodes = new ModelDelta[] { (ModelDelta)oldValue, node };
+ fNodesMap.put(node.getElement(), nodes);
+ } else if (oldValue instanceof ModelDelta[]) {
+ // Even more remote case: multiple delta nodes for the same element were already added
+ ModelDelta[] oldNodes = (ModelDelta[])oldValue;
+ ModelDelta[] newNodes = new ModelDelta[oldNodes.length + 1];
+ System.arraycopy(oldNodes, 0, newNodes, 0, oldNodes.length);
+ newNodes[newNodes.length - 1] = node;
+ fNodesMap.put(node.getElement(), newNodes);
+ }
}
@@ -207,51 +207,51 @@ public class ModelDelta implements IModelDelta {
* @param flags change flags
* @return newly created child delta
*/
- public ModelDelta addNode(Object element, Object replacement, int flags) {
- ModelDelta node = new ModelDelta(element, replacement, flags);
- node.setParent(this);
- addDelta(node);
- return node;
- }
-
- /**
- * Adds a child delta to this delta to insert the specified element at
- * the given index, and returns the newly created child delta.
- *
- * @param element child element in insert
- * @param index index of insertion
- * @param flags change flags
- * @return newly created child delta
- */
- public ModelDelta addNode(Object element, int index, int flags) {
- ModelDelta node = new ModelDelta(element, index, flags);
- node.setParent(this);
- addDelta(node);
- return node;
- }
-
- /**
- * Adds a child delta to this delta at the specified index with the
- * given number of children, and returns the newly created child delta.
- *
- * @param element child element in insert
- * @param index index of the element relative to parent
- * @param flags change flags
- * @param numChildren the number of children the element has
- * @return newly created child delta
- */
- public ModelDelta addNode(Object element, int index, int flags, int numChildren) {
- ModelDelta node = new ModelDelta(element, index, flags, numChildren);
- node.setParent(this);
- addDelta(node);
- return node;
- }
-
- /**
- * Sets the parent delta of this delta
- *
- * @param node parent delta
- */
+ public ModelDelta addNode(Object element, Object replacement, int flags) {
+ ModelDelta node = new ModelDelta(element, replacement, flags);
+ node.setParent(this);
+ addDelta(node);
+ return node;
+ }
+
+ /**
+ * Adds a child delta to this delta to insert the specified element at
+ * the given index, and returns the newly created child delta.
+ *
+ * @param element child element in insert
+ * @param index index of insertion
+ * @param flags change flags
+ * @return newly created child delta
+ */
+ public ModelDelta addNode(Object element, int index, int flags) {
+ ModelDelta node = new ModelDelta(element, index, flags);
+ node.setParent(this);
+ addDelta(node);
+ return node;
+ }
+
+ /**
+ * Adds a child delta to this delta at the specified index with the
+ * given number of children, and returns the newly created child delta.
+ *
+ * @param element child element in insert
+ * @param index index of the element relative to parent
+ * @param flags change flags
+ * @param numChildren the number of children the element has
+ * @return newly created child delta
+ */
+ public ModelDelta addNode(Object element, int index, int flags, int numChildren) {
+ ModelDelta node = new ModelDelta(element, index, flags, numChildren);
+ node.setParent(this);
+ addDelta(node);
+ return node;
+ }
+
+ /**
+ * Sets the parent delta of this delta
+ *
+ * @param node parent delta
+ */
void setParent(ModelDelta node) {
fParent = node;
}
@@ -261,21 +261,21 @@ public class ModelDelta implements IModelDelta {
return fParent;
}
- @Override
+ @Override
public Object getReplacementElement() {
- return fReplacement;
- }
+ return fReplacement;
+ }
- @Override
+ @Override
public int getIndex() {
- return fIndex;
- }
+ return fIndex;
+ }
@Override
public IModelDelta[] getChildDeltas() {
- if (fNodes == null) {
- fNodes = fNodesList.toArray(new ModelDelta[fNodesList.size()]);
- }
+ if (fNodes == null) {
+ fNodes = fNodesList.toArray(new ModelDelta[fNodesList.size()]);
+ }
return fNodes;
}
@@ -283,11 +283,11 @@ public class ModelDelta implements IModelDelta {
if (fNodesList == null) {
fNodesList = new ArrayList<>(4);
}
- fNodesList.add(delta);
- fNodes = null;
- if (fNodesMap != null) {
- mapNode(delta);
- }
+ fNodesList.add(delta);
+ fNodes = null;
+ if (fNodesMap != null) {
+ mapNode(delta);
+ }
}
@Override
@@ -300,11 +300,11 @@ public class ModelDelta implements IModelDelta {
}
private void appendDetail(String indent, StringBuffer buf, IModelDelta delta) {
- buf.append(indent);
+ buf.append(indent);
buf.append("Element: "); //$NON-NLS-1$
buf.append(delta.getElement());
buf.append('\n');
- buf.append(indent);
+ buf.append(indent);
buf.append(" Flags: "); //$NON-NLS-1$
int flags = delta.getFlags();
if (flags == 0) {
@@ -316,9 +316,9 @@ public class ModelDelta implements IModelDelta {
if ((flags & IModelDelta.CONTENT) > 0) {
buf.append("CONTENT | "); //$NON-NLS-1$
}
- if ((flags & IModelDelta.COLLAPSE) > 0) {
- buf.append("COLLAPSE | "); //$NON-NLS-1$
- }
+ if ((flags & IModelDelta.COLLAPSE) > 0) {
+ buf.append("COLLAPSE | "); //$NON-NLS-1$
+ }
if ((flags & IModelDelta.EXPAND) > 0) {
buf.append("EXPAND | "); //$NON-NLS-1$
}
@@ -344,15 +344,15 @@ public class ModelDelta implements IModelDelta {
buf.append("UNINSTALL | "); //$NON-NLS-1$
}
if ((flags & IModelDelta.REVEAL) > 0) {
- buf.append("REVEAL | "); //$NON-NLS-1$
- }
- if ((flags & IModelDelta.FORCE) > 0) {
- buf.append("FORCE | "); //$NON-NLS-1$
- }
+ buf.append("REVEAL | "); //$NON-NLS-1$
+ }
+ if ((flags & IModelDelta.FORCE) > 0) {
+ buf.append("FORCE | "); //$NON-NLS-1$
+ }
}
buf.append('\n');
- buf.append(indent);
+ buf.append(indent);
buf.append(" Index: "); //$NON-NLS-1$
buf.append(delta.getIndex());
buf.append(" Child Count: "); //$NON-NLS-1$
@@ -401,23 +401,23 @@ public class ModelDelta implements IModelDelta {
fFlags = flags;
}
- /**
- * Sets this delta's index
- *
- * @param index new index to set
- * @since 3.6
- */
- public void setIndex(int index) {
- fIndex = index;
- }
+ /**
+ * Sets this delta's index
+ *
+ * @param index new index to set
+ * @since 3.6
+ */
+ public void setIndex(int index) {
+ fIndex = index;
+ }
/**
- * Sets this delta's child count.
- *
- * @param count new child count to set
- */
- public void setChildCount(int count) {
- fChildCount = count;
- }
+ * Sets this delta's child count.
+ *
+ * @param count new child count to set
+ */
+ public void setChildCount(int count) {
+ fChildCount = count;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
index 6cf38ac23..7fed0f718 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
@@ -40,63 +40,63 @@ import org.eclipse.ui.PlatformUI;
*/
public class PresentationContext implements IPresentationContext {
- private static final String PRESENTATION_CONTEXT_PROPERTIES = "PRESENTATION_CONTEXT_PROPERTIES"; //$NON-NLS-1$
- private static final String BOOLEAN = "BOOLEAN"; //$NON-NLS-1$
- private static final String STRING = "STRING"; //$NON-NLS-1$
- private static final String INTEGER = "INTEGER"; //$NON-NLS-1$
- private static final String PERSISTABLE = "PERSISTABLE"; //$NON-NLS-1$
+ private static final String PRESENTATION_CONTEXT_PROPERTIES = "PRESENTATION_CONTEXT_PROPERTIES"; //$NON-NLS-1$
+ private static final String BOOLEAN = "BOOLEAN"; //$NON-NLS-1$
+ private static final String STRING = "STRING"; //$NON-NLS-1$
+ private static final String INTEGER = "INTEGER"; //$NON-NLS-1$
+ private static final String PERSISTABLE = "PERSISTABLE"; //$NON-NLS-1$
- final private String fId;
+ final private String fId;
final private ListenerList<IPropertyChangeListener> fListeners = new ListenerList<>();
final private Map<String, Object> fProperties = new HashMap<>();
- private IWorkbenchWindow fWindow;
- private IWorkbenchPart fPart;
-
- /**
- * Constructs a presentation context for the given id.
- *
- * @param id presentation context id
- */
- public PresentationContext(String id) {
- this (id, null, null);
- }
-
- /**
- * Constructs a presentation context for the given id and window.
- *
- * @param id presentation context id
- * @param window presentation context window, may be <code>null</code>
- */
- public PresentationContext(String id, IWorkbenchWindow window) {
- this (id, window, null);
- }
-
- /**
- * Constructs a presentation context for the given id and part.
- * The presentation context window is derived from the part.
- *
- * @param id presentation context id
- * @param part presentation context part, may be <code>null</code>
- */
- public PresentationContext(String id, IWorkbenchPart part) {
- this (id, part == null ? null : part.getSite().getWorkbenchWindow(), part);
- }
-
- /**
- * Constructs a presentation context for the given id and part.
- * The presentation context id and window are derived from the part.
- *
- * @param part presentation context part, can NOT be <code>null</code>
- */
- public PresentationContext(IWorkbenchPart part) {
- this (part.getSite().getId(), part.getSite().getWorkbenchWindow(), part);
- }
-
- private PresentationContext(String id, IWorkbenchWindow window, IWorkbenchPart part) {
- fId = id;
- fWindow = window;
- fPart = part;
- }
+ private IWorkbenchWindow fWindow;
+ private IWorkbenchPart fPart;
+
+ /**
+ * Constructs a presentation context for the given id.
+ *
+ * @param id presentation context id
+ */
+ public PresentationContext(String id) {
+ this (id, null, null);
+ }
+
+ /**
+ * Constructs a presentation context for the given id and window.
+ *
+ * @param id presentation context id
+ * @param window presentation context window, may be <code>null</code>
+ */
+ public PresentationContext(String id, IWorkbenchWindow window) {
+ this (id, window, null);
+ }
+
+ /**
+ * Constructs a presentation context for the given id and part.
+ * The presentation context window is derived from the part.
+ *
+ * @param id presentation context id
+ * @param part presentation context part, may be <code>null</code>
+ */
+ public PresentationContext(String id, IWorkbenchPart part) {
+ this (id, part == null ? null : part.getSite().getWorkbenchWindow(), part);
+ }
+
+ /**
+ * Constructs a presentation context for the given id and part.
+ * The presentation context id and window are derived from the part.
+ *
+ * @param part presentation context part, can NOT be <code>null</code>
+ */
+ public PresentationContext(IWorkbenchPart part) {
+ this (part.getSite().getId(), part.getSite().getWorkbenchWindow(), part);
+ }
+
+ private PresentationContext(String id, IWorkbenchWindow window, IWorkbenchPart part) {
+ fId = id;
+ fWindow = window;
+ fPart = part;
+ }
@Override
public String[] getColumns() {
@@ -136,8 +136,8 @@ public class PresentationContext implements IPresentationContext {
@Override
public void dispose() {
- fProperties.clear();
- setProperty(PROPERTY_DISPOSED, Boolean.TRUE);
+ fProperties.clear();
+ setProperty(PROPERTY_DISPOSED, Boolean.TRUE);
fListeners.clear();
// Free the reference to fWindow (Bug 321658).
fWindow = null;
@@ -168,18 +168,18 @@ public class PresentationContext implements IPresentationContext {
@Override
public void setProperty(String property, Object value) {
- Object oldValue = null;
- boolean propertySet = false;
+ Object oldValue = null;
+ boolean propertySet = false;
synchronized (fProperties) {
oldValue = fProperties.get(property);
if (!isEqual(oldValue, value)) {
- propertySet = true;
+ propertySet = true;
fProperties.put(property, value);
}
}
if (propertySet) {
- firePropertyChange(property, oldValue, value);
+ firePropertyChange(property, oldValue, value);
}
}
@@ -188,46 +188,46 @@ public class PresentationContext implements IPresentationContext {
* @param memento Memento to restore from.
*/
public void initProperties(IMemento memento) {
- IMemento presentationMemento = null;
-
- IMemento[] mementos = memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES);
- for (int i = 0; i < mementos.length; i++) {
- if (getId().equals(mementos[i].getID())) {
- presentationMemento = mementos[i];
- break;
- }
- }
-
- if (presentationMemento != null) {
- IMemento[] stringProperties = presentationMemento.getChildren(STRING);
- for (int i = 0; i < stringProperties.length; i++) {
- fProperties.put(stringProperties[i].getID(), stringProperties[i].getString(STRING));
- }
-
- IMemento[] integerMementos = presentationMemento.getChildren(INTEGER);
- for (int i = 0; i < integerMementos.length; i++) {
- fProperties.put(integerMementos[i].getID(), integerMementos[i].getInteger(INTEGER));
- }
-
- IMemento[] booleanMementos = presentationMemento.getChildren(BOOLEAN);
- for (int i = 0; i < booleanMementos.length; i++) {
- fProperties.put(booleanMementos[i].getID(), booleanMementos[i].getBoolean(BOOLEAN));
- }
-
- IMemento[] persistableMementos = presentationMemento.getChildren(PERSISTABLE);
- for (int i = 0; i < persistableMementos.length; i++) {
- String factoryID = persistableMementos[i].getString(PERSISTABLE);
- if (factoryID != null) {
- IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
- if (factory != null) {
- Object element = factory.createElement(persistableMementos[i]);
- if (element != null) {
- fProperties.put(persistableMementos[i].getID(), element);
- }
- }
- }
- }
- }
+ IMemento presentationMemento = null;
+
+ IMemento[] mementos = memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES);
+ for (int i = 0; i < mementos.length; i++) {
+ if (getId().equals(mementos[i].getID())) {
+ presentationMemento = mementos[i];
+ break;
+ }
+ }
+
+ if (presentationMemento != null) {
+ IMemento[] stringProperties = presentationMemento.getChildren(STRING);
+ for (int i = 0; i < stringProperties.length; i++) {
+ fProperties.put(stringProperties[i].getID(), stringProperties[i].getString(STRING));
+ }
+
+ IMemento[] integerMementos = presentationMemento.getChildren(INTEGER);
+ for (int i = 0; i < integerMementos.length; i++) {
+ fProperties.put(integerMementos[i].getID(), integerMementos[i].getInteger(INTEGER));
+ }
+
+ IMemento[] booleanMementos = presentationMemento.getChildren(BOOLEAN);
+ for (int i = 0; i < booleanMementos.length; i++) {
+ fProperties.put(booleanMementos[i].getID(), booleanMementos[i].getBoolean(BOOLEAN));
+ }
+
+ IMemento[] persistableMementos = presentationMemento.getChildren(PERSISTABLE);
+ for (int i = 0; i < persistableMementos.length; i++) {
+ String factoryID = persistableMementos[i].getString(PERSISTABLE);
+ if (factoryID != null) {
+ IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
+ if (factory != null) {
+ Object element = factory.createElement(persistableMementos[i]);
+ if (element != null) {
+ fProperties.put(persistableMementos[i].getID(), element);
+ }
+ }
+ }
+ }
+ }
}
/**
@@ -235,27 +235,27 @@ public class PresentationContext implements IPresentationContext {
* @param memento Memento to save to.
*/
public void saveProperites(IMemento memento) {
- if (fProperties.isEmpty()) {
- return;
- }
- IMemento properties = memento.createChild(PRESENTATION_CONTEXT_PROPERTIES, getId());
+ if (fProperties.isEmpty()) {
+ return;
+ }
+ IMemento properties = memento.createChild(PRESENTATION_CONTEXT_PROPERTIES, getId());
for (Entry<String, Object> entry : fProperties.entrySet()) {
- if (entry.getValue() instanceof String) {
- IMemento value = properties.createChild(STRING, entry.getKey());
- value.putString(STRING, (String)entry.getValue());
- } else if (entry.getValue() instanceof Integer) {
- IMemento value = properties.createChild(INTEGER, entry.getKey());
- value.putInteger(INTEGER, ((Integer)entry.getValue()).intValue());
- } else if (entry.getValue() instanceof Boolean) {
- IMemento value = properties.createChild(BOOLEAN, entry.getKey());
- value.putBoolean(BOOLEAN, ((Boolean)entry.getValue()).booleanValue());
- } else if (entry.getValue() instanceof IPersistableElement) {
- IPersistableElement persistable = (IPersistableElement)entry.getValue();
- IMemento value = properties.createChild(PERSISTABLE, entry.getKey());
- value.putString(PERSISTABLE, persistable.getFactoryId());
- persistable.saveState(value);
- }
- }
+ if (entry.getValue() instanceof String) {
+ IMemento value = properties.createChild(STRING, entry.getKey());
+ value.putString(STRING, (String)entry.getValue());
+ } else if (entry.getValue() instanceof Integer) {
+ IMemento value = properties.createChild(INTEGER, entry.getKey());
+ value.putInteger(INTEGER, ((Integer)entry.getValue()).intValue());
+ } else if (entry.getValue() instanceof Boolean) {
+ IMemento value = properties.createChild(BOOLEAN, entry.getKey());
+ value.putBoolean(BOOLEAN, ((Boolean)entry.getValue()).booleanValue());
+ } else if (entry.getValue() instanceof IPersistableElement) {
+ IPersistableElement persistable = (IPersistableElement)entry.getValue();
+ IMemento value = properties.createChild(PERSISTABLE, entry.getKey());
+ value.putString(PERSISTABLE, persistable.getFactoryId());
+ persistable.saveState(value);
+ }
+ }
}
private boolean isEqual(Object a, Object b) {
@@ -273,15 +273,15 @@ public class PresentationContext implements IPresentationContext {
}
}
- @Override
+ @Override
public IWorkbenchPart getPart() {
- return fPart;
- }
+ return fPart;
+ }
- @Override
+ @Override
public IWorkbenchWindow getWindow() {
- return fWindow;
- }
+ return fWindow;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java
index eb6492cd3..a1a498ecb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java
@@ -128,7 +128,7 @@ public class TreeModelViewer extends InternalTreeModelViewer {
/**
* Initializes viewer state from the memento
*
- * @param memento the {@link IMemento} to read from
+ * @param memento the {@link IMemento} to read from
*/
@Override
public void initState(IMemento memento) {
@@ -138,16 +138,16 @@ public class TreeModelViewer extends InternalTreeModelViewer {
/**
* Save viewer state into the given memento.
*
- * @param memento the {@link IMemento} to save to
+ * @param memento the {@link IMemento} to save to
*/
@Override
public void saveState(IMemento memento) {
super.saveState(memento);
}
- /**
- * @return Returns true if columns are being displayed currently.
- */
+ /**
+ * @return Returns true if columns are being displayed currently.
+ */
@Override
public boolean isShowColumns() {
return super.isShowColumns();
@@ -187,8 +187,8 @@ public class TreeModelViewer extends InternalTreeModelViewer {
super.setVisibleColumns(ids);
}
- @Override
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
- return super.getElementLabel(path, columnId);
- }
+ return super.getElementLabel(path, columnId);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java
index f48408a7b..54153c113 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java
@@ -30,12 +30,12 @@ import org.eclipse.jface.viewers.ViewerFilter;
*/
abstract public class TreeModelViewerFilter extends ViewerFilter {
- /**
- * Determines whether the filter applies to the given parent element.
- * @return Returns true if the viewer should use the given filter on the
- * given element.
- * @param viewer The viewer that is using this filter to select elements.
- * @param parentElement Parent element to check filter for.
- */
- abstract public boolean isApplicable(ITreeModelViewer viewer, Object parentElement);
+ /**
+ * Determines whether the filter applies to the given parent element.
+ * @return Returns true if the viewer should use the given filter on the
+ * given element.
+ * @param viewer The viewer that is using this filter to select elements.
+ * @param parentElement Parent element to check filter for.
+ */
+ abstract public boolean isApplicable(ITreeModelViewer viewer, Object parentElement);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
index 51e385737..a52928877 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
@@ -28,18 +28,18 @@ import org.eclipse.debug.internal.ui.viewers.model.ViewerInputUpdate;
*/
public class ViewerInputService {
- /**
- * An input object which will yield a null input element.
- *
- * @since 3.6
- */
- public final static Object NULL_INPUT = new IViewerInputProvider() {
- @Override
+ /**
+ * An input object which will yield a null input element.
+ *
+ * @since 3.6
+ */
+ public final static Object NULL_INPUT = new IViewerInputProvider() {
+ @Override
public void update(IViewerInputUpdate update) {
- update.setInputElement(null);
- update.done();
- }
- };
+ update.setInputElement(null);
+ update.done();
+ }
+ };
// previous update request, cancelled when a new request comes in
private IViewerInputUpdate fPendingUpdate = null;
@@ -63,7 +63,7 @@ public class ViewerInputService {
/**
* Constructs a viewer input service for the given requester and presentation context.
*
- * @param viewer for which inputs are required
+ * @param viewer for which inputs are required
* @param requestor client requesting viewer inputs
*/
public ViewerInputService(ITreeModelViewer viewer, IViewerInputRequestor requestor) {
@@ -90,7 +90,7 @@ public class ViewerInputService {
}
if (provdier == null) {
fPendingUpdate.setInputElement(source);
- fPendingUpdate.done();
+ fPendingUpdate.done();
} else {
provdier.update(fPendingUpdate);
}
@@ -100,9 +100,9 @@ public class ViewerInputService {
* Disposes this viewer input service, canceling any pending jobs.
*/
public synchronized void dispose() {
- if (fPendingUpdate != null) {
- fPendingUpdate.cancel();
- fPendingUpdate = null;
- }
+ if (fPendingUpdate != null) {
+ fPendingUpdate.cancel();
+ fPendingUpdate = null;
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java
index 0c817a971..0115e8b0a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java
@@ -31,534 +31,534 @@ import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
*/
public class VirtualItem {
- // Data keys for display attributes of an item.
- public static String LABEL_KEY = "LABEL_KEY"; //$NON-NLS-1$
- public static String IMAGE_KEY = "IMAGE_KEY"; //$NON-NLS-1$
- public static String FONT_KEY = "FONT_KEY"; //$NON-NLS-1$
- public static String FOREGROUND_KEY = "FOREGROUND_KEY"; //$NON-NLS-1$
- public static String BACKGROUND_KEY = "BACKGROUND_KEY"; //$NON-NLS-1$
-
- public static String ELEMENT_DATA_KEY = "element"; //$NON-NLS-1$
-
- /**
- * Index object of a tree item. It allows the indexes to be modified
- * as items are inserted and removed.
- */
+ // Data keys for display attributes of an item.
+ public static String LABEL_KEY = "LABEL_KEY"; //$NON-NLS-1$
+ public static String IMAGE_KEY = "IMAGE_KEY"; //$NON-NLS-1$
+ public static String FONT_KEY = "FONT_KEY"; //$NON-NLS-1$
+ public static String FOREGROUND_KEY = "FOREGROUND_KEY"; //$NON-NLS-1$
+ public static String BACKGROUND_KEY = "BACKGROUND_KEY"; //$NON-NLS-1$
+
+ public static String ELEMENT_DATA_KEY = "element"; //$NON-NLS-1$
+
+ /**
+ * Index object of a tree item. It allows the indexes to be modified
+ * as items are inserted and removed.
+ */
public static class Index implements Comparable<Object> {
- private Integer fIndexValue;
+ private Integer fIndexValue;
- public Index(int index) {
- fIndexValue = Integer.valueOf(index);
- }
+ public Index(int index) {
+ fIndexValue = Integer.valueOf(index);
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof Index && ((Index)obj).fIndexValue.equals(fIndexValue);
- }
+ return obj instanceof Index && ((Index)obj).fIndexValue.equals(fIndexValue);
+ }
- @Override
+ @Override
public int hashCode() {
- return fIndexValue.hashCode();
- }
+ return fIndexValue.hashCode();
+ }
- public void increment() {
- fIndexValue = Integer.valueOf(fIndexValue.intValue() + 1);
- }
+ public void increment() {
+ fIndexValue = Integer.valueOf(fIndexValue.intValue() + 1);
+ }
- public void decrement() {
- fIndexValue = Integer.valueOf(fIndexValue.intValue() - 1);
- }
+ public void decrement() {
+ fIndexValue = Integer.valueOf(fIndexValue.intValue() - 1);
+ }
- public int intValue() {
- return fIndexValue.intValue();
- }
+ public int intValue() {
+ return fIndexValue.intValue();
+ }
- @Override
+ @Override
public int compareTo(Object obj) {
- return obj instanceof Index ? fIndexValue.compareTo(((Index)obj).fIndexValue) : 0;
- }
+ return obj instanceof Index ? fIndexValue.compareTo(((Index)obj).fIndexValue) : 0;
+ }
- @Override
+ @Override
public String toString() {
- return fIndexValue.toString();
- }
- }
-
- /**
- * Parent items of this item.
- */
- final private VirtualItem fParent;
-
- /**
- * The index of this item.
- */
- final private Index fIndex;
-
- /**
- * Map of child items. The key to the map is the item's index, which
- * must be the same object instance as the index in the item. The tree map
- * keeps the items sorted while allowing indexes (keys) to be modified as
- * child items are inserted and removed.
- */
+ return fIndexValue.toString();
+ }
+ }
+
+ /**
+ * Parent items of this item.
+ */
+ final private VirtualItem fParent;
+
+ /**
+ * The index of this item.
+ */
+ final private Index fIndex;
+
+ /**
+ * Map of child items. The key to the map is the item's index, which
+ * must be the same object instance as the index in the item. The tree map
+ * keeps the items sorted while allowing indexes (keys) to be modified as
+ * child items are inserted and removed.
+ */
private Map<Index, VirtualItem> fItems = new TreeMap<>();
- /**
- * Flag indicating whether this item has child items.
- */
- private boolean fHasItems = false;
-
- /**
- * Indicates that this item has been expanded. It should only
- * be set to <code>true</code> if fHasItems is <code>true</code>.
- */
- private boolean fExpanded = false;
-
- /**
- * The count of child items. <code>-1</code> indicates that the count
- * is not known.
- */
- private int fItemCount = -1;
-
- /**
- * The data held by this item. It includes the element as well as the item
- * display attributes.
- */
+ /**
+ * Flag indicating whether this item has child items.
+ */
+ private boolean fHasItems = false;
+
+ /**
+ * Indicates that this item has been expanded. It should only
+ * be set to <code>true</code> if fHasItems is <code>true</code>.
+ */
+ private boolean fExpanded = false;
+
+ /**
+ * The count of child items. <code>-1</code> indicates that the count
+ * is not known.
+ */
+ private int fItemCount = -1;
+
+ /**
+ * The data held by this item. It includes the element as well as the item
+ * display attributes.
+ */
private Map<String, Object> fData = new HashMap<>(1);
- /**
- * Flag indicating that the item needs to have it's label updated.
- */
- private boolean fNeedsLabelUpdate = true;
-
- /**
- * Flag indicating that the item's count needs to be updated.
- */
- private boolean fNeedsCountUpdate = true;
-
- /**
- * Flag indicating that the item's element needs to be updated.
- */
- private boolean fNeedsDataUpdate = true;
-
- /**
- * Indicates that this item has been disposed.
- */
- private boolean fDisposed = false;
-
-
- /**
- * Virtual item constructor.
- * @param parent parent virtual item
- * @param index index of the item in the parent
- */
- public VirtualItem(VirtualItem parent, Index index) {
- fParent = parent;
- fIndex = index;
- }
-
- /**
- * Clears the child item at the given index.
- * @param index index of item to clear.
- */
- public void clear(Index index) {
- VirtualItem item = fItems.remove(index);
- if (item != null) {
- item.dispose();
- }
- }
-
- /**
- * Clears all child items.
- *
- * @since 3.9
- */
- public void clearAll() {
- fData.clear();
+ /**
+ * Flag indicating that the item needs to have it's label updated.
+ */
+ private boolean fNeedsLabelUpdate = true;
+
+ /**
+ * Flag indicating that the item's count needs to be updated.
+ */
+ private boolean fNeedsCountUpdate = true;
+
+ /**
+ * Flag indicating that the item's element needs to be updated.
+ */
+ private boolean fNeedsDataUpdate = true;
+
+ /**
+ * Indicates that this item has been disposed.
+ */
+ private boolean fDisposed = false;
+
+
+ /**
+ * Virtual item constructor.
+ * @param parent parent virtual item
+ * @param index index of the item in the parent
+ */
+ public VirtualItem(VirtualItem parent, Index index) {
+ fParent = parent;
+ fIndex = index;
+ }
+
+ /**
+ * Clears the child item at the given index.
+ * @param index index of item to clear.
+ */
+ public void clear(Index index) {
+ VirtualItem item = fItems.remove(index);
+ if (item != null) {
+ item.dispose();
+ }
+ }
+
+ /**
+ * Clears all child items.
+ *
+ * @since 3.9
+ */
+ public void clearAll() {
+ fData.clear();
for (VirtualItem item : fItems.values()) {
item.dispose();
- }
- fItems.clear();
- }
- /**
- * Returns the parent item.
- * @return parent item.
- */
- public VirtualItem getParent() {
- return fParent;
- }
-
- /**
- * @return Returns the index of this item.
- */
- public Index getIndex() {
- return fIndex;
- }
-
- /**
- * Finds the given item in the child items of this element.
- * @param element Data object of the item to be found.
- * @return Item if found, <code>null</code> if not.
- */
- public VirtualItem findItem(Object element) {
+ }
+ fItems.clear();
+ }
+ /**
+ * Returns the parent item.
+ * @return parent item.
+ */
+ public VirtualItem getParent() {
+ return fParent;
+ }
+
+ /**
+ * @return Returns the index of this item.
+ */
+ public Index getIndex() {
+ return fIndex;
+ }
+
+ /**
+ * Finds the given item in the child items of this element.
+ * @param element Data object of the item to be found.
+ * @return Item if found, <code>null</code> if not.
+ */
+ public VirtualItem findItem(Object element) {
for (VirtualItem item : fItems.values()) {
Object nextData = item.getData();
- if ( (element != null && element.equals(nextData)) || (element == null && nextData == null) ) {
+ if ( (element != null && element.equals(nextData)) || (element == null && nextData == null) ) {
return item;
- }
- }
- return null;
- }
-
- /**
- * @return Returns whether the data element of this item is stale.
- */
- public boolean needsDataUpdate() {
- return fNeedsDataUpdate;
- }
-
- /**
- * Marks the item as having a stale data item.
- */
- public void setNeedsDataUpdate() {
- fNeedsDataUpdate = true;
- }
-
- /**
- * Clears the stale status of the item's data element.
- */
- public void clearNeedsDataUpdate() {
- fNeedsDataUpdate = false;
- }
-
- /**
- * @return Returns whether the item has stale item count.
- */
- public boolean needsCountUpdate() {
- return fNeedsCountUpdate;
- }
-
- /**
- * Marks the item as having a stale child count.
- */
- public void setNeedsCountUpdate() {
- fNeedsCountUpdate = true;
- fItemCount = -1;
- }
-
- /**
- * Clears the stale status of the item's child count.
- */
- public void clearNeedsCountUpdate() {
- fNeedsCountUpdate = false;
- }
-
- /**
- * @return Returns whether the item has stale label.
- */
- public boolean needsLabelUpdate() {
- return fNeedsLabelUpdate;
- }
-
- /**
- * Marks the item as having a stale label data.
- */
- public void setNeedsLabelUpdate() {
- fNeedsLabelUpdate = true;
- }
-
- /**
- * Clears the stale status of the item's label.
- */
- public void clearNeedsLabelUpdate() {
- fNeedsLabelUpdate = false;
- }
-
- /**
- * @return Returns whether the item has been disposed.
- */
- public boolean isDisposed() {
- return fDisposed;
- }
-
- /**
- * Disposes the item.
- */
- public void dispose() {
- clearAll();
-
- fDisposed = true;
- findTree().fireItemDisposed(this);
- }
-
- /**
- * @param key Key to retrieve data for.
- * @return Returns item data corresponding to given key.
- */
- public Object getData (String key) {
- return fData.get(key);
- }
-
- /**
- * Sets given data element for given key.
- * @param key Key for data.
- * @param data Data value.
- */
- public void setData(String key, Object data) {
- fData.put(key, data);
- }
-
- /**
- * Sets the item's data element.
- * @param data Item's new element.
- */
- public void setData(Object data) {
- fData.put(ELEMENT_DATA_KEY, data);
- }
-
- /**
- * @return Returns item's data element.
- */
- public Object getData () {
- return fData.get(ELEMENT_DATA_KEY);
- }
-
- /**
- * Marks the given item as expanded or collapsed.
- * @param expanded If true, item will be marked as expanded.
- */
- public void setExpanded(boolean expanded) {
- if (fExpanded == expanded) {
- return;
- }
- fExpanded = expanded;
-
- if (fExpanded && getItemCount() == -1) {
- setNeedsCountUpdate();
- }
-
-
- Assert.isTrue(!fExpanded || hasItems());
-
- // If collapsed, make sure that all the children are collapsed as well.
- if (!fExpanded) {
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return Returns whether the data element of this item is stale.
+ */
+ public boolean needsDataUpdate() {
+ return fNeedsDataUpdate;
+ }
+
+ /**
+ * Marks the item as having a stale data item.
+ */
+ public void setNeedsDataUpdate() {
+ fNeedsDataUpdate = true;
+ }
+
+ /**
+ * Clears the stale status of the item's data element.
+ */
+ public void clearNeedsDataUpdate() {
+ fNeedsDataUpdate = false;
+ }
+
+ /**
+ * @return Returns whether the item has stale item count.
+ */
+ public boolean needsCountUpdate() {
+ return fNeedsCountUpdate;
+ }
+
+ /**
+ * Marks the item as having a stale child count.
+ */
+ public void setNeedsCountUpdate() {
+ fNeedsCountUpdate = true;
+ fItemCount = -1;
+ }
+
+ /**
+ * Clears the stale status of the item's child count.
+ */
+ public void clearNeedsCountUpdate() {
+ fNeedsCountUpdate = false;
+ }
+
+ /**
+ * @return Returns whether the item has stale label.
+ */
+ public boolean needsLabelUpdate() {
+ return fNeedsLabelUpdate;
+ }
+
+ /**
+ * Marks the item as having a stale label data.
+ */
+ public void setNeedsLabelUpdate() {
+ fNeedsLabelUpdate = true;
+ }
+
+ /**
+ * Clears the stale status of the item's label.
+ */
+ public void clearNeedsLabelUpdate() {
+ fNeedsLabelUpdate = false;
+ }
+
+ /**
+ * @return Returns whether the item has been disposed.
+ */
+ public boolean isDisposed() {
+ return fDisposed;
+ }
+
+ /**
+ * Disposes the item.
+ */
+ public void dispose() {
+ clearAll();
+
+ fDisposed = true;
+ findTree().fireItemDisposed(this);
+ }
+
+ /**
+ * @param key Key to retrieve data for.
+ * @return Returns item data corresponding to given key.
+ */
+ public Object getData (String key) {
+ return fData.get(key);
+ }
+
+ /**
+ * Sets given data element for given key.
+ * @param key Key for data.
+ * @param data Data value.
+ */
+ public void setData(String key, Object data) {
+ fData.put(key, data);
+ }
+
+ /**
+ * Sets the item's data element.
+ * @param data Item's new element.
+ */
+ public void setData(Object data) {
+ fData.put(ELEMENT_DATA_KEY, data);
+ }
+
+ /**
+ * @return Returns item's data element.
+ */
+ public Object getData () {
+ return fData.get(ELEMENT_DATA_KEY);
+ }
+
+ /**
+ * Marks the given item as expanded or collapsed.
+ * @param expanded If true, item will be marked as expanded.
+ */
+ public void setExpanded(boolean expanded) {
+ if (fExpanded == expanded) {
+ return;
+ }
+ fExpanded = expanded;
+
+ if (fExpanded && getItemCount() == -1) {
+ setNeedsCountUpdate();
+ }
+
+
+ Assert.isTrue(!fExpanded || hasItems());
+
+ // If collapsed, make sure that all the children are collapsed as well.
+ if (!fExpanded) {
for (VirtualItem item : fItems.values()) {
item.setExpanded(expanded);
- }
- }
- }
-
- /**
- * @return Returns item's expanded state.
- */
- public boolean getExpanded() {
- return fExpanded;
- }
-
- /**
- * Sets the flag indicating whether item has child items.
- * @param hasChildren Set to true if child has items.
- */
- public void setHasItems(boolean hasChildren) {
- fHasItems = hasChildren;
- if (!fHasItems) {
- if (getItemCount() != 0) {
- setItemCount(0);
- }
- } else if (getItemCount() == 0) {
- setItemCount(-1);
- }
- }
-
- /**
- * @return Returns true if item has child items.
- */
- public boolean hasItems() {
- return fHasItems;
- }
-
- /**
- * Sets the item's child count.
- * @param count Child count.
- */
- public void setItemCount(int count) {
- fItemCount = count;
+ }
+ }
+ }
+
+ /**
+ * @return Returns item's expanded state.
+ */
+ public boolean getExpanded() {
+ return fExpanded;
+ }
+
+ /**
+ * Sets the flag indicating whether item has child items.
+ * @param hasChildren Set to true if child has items.
+ */
+ public void setHasItems(boolean hasChildren) {
+ fHasItems = hasChildren;
+ if (!fHasItems) {
+ if (getItemCount() != 0) {
+ setItemCount(0);
+ }
+ } else if (getItemCount() == 0) {
+ setItemCount(-1);
+ }
+ }
+
+ /**
+ * @return Returns true if item has child items.
+ */
+ public boolean hasItems() {
+ return fHasItems;
+ }
+
+ /**
+ * Sets the item's child count.
+ * @param count Child count.
+ */
+ public void setItemCount(int count) {
+ fItemCount = count;
for (Iterator<Entry<Index, VirtualItem>> itr = fItems.entrySet().iterator(); itr.hasNext();) {
Entry<Index, VirtualItem> entry = itr.next();
- int index = entry.getKey().intValue();
- if (index >= count) {
- VirtualItem item = entry.getValue();
- item.dispose();
- itr.remove();
- }
- }
- if (fItemCount == 0) {
- if (hasItems()) {
- setHasItems(false);
- }
- if (getExpanded()) {
- setExpanded(false);
- }
- } else {
- if (!hasItems()) {
- setHasItems(true);
- }
- }
- }
-
- /**
- * @return Returns item's child count.
- */
- public int getItemCount() {
- return fItemCount;
- }
-
- /**
- * Returns the child item at given index. Child item is created if needed.
- *
- * @param index Index of the child item.
- * @return Child item.
- */
- public VirtualItem getItem(Index index) {
- ensureItems();
-
- VirtualItem item = fItems.get(index);
- if (item == null) {
- item = new VirtualItem(this, index);
- fItems.put(index, item);
- }
- return item;
- }
-
- /**
- * @return Returns true if any of the child items need a data update.
- */
- public boolean childrenNeedDataUpdate() {
- if (getItemCount() == 0) {
- return false;
- }
- if (fItems == null || fItems.size() != fItemCount) {
- return true;
- }
+ int index = entry.getKey().intValue();
+ if (index >= count) {
+ VirtualItem item = entry.getValue();
+ item.dispose();
+ itr.remove();
+ }
+ }
+ if (fItemCount == 0) {
+ if (hasItems()) {
+ setHasItems(false);
+ }
+ if (getExpanded()) {
+ setExpanded(false);
+ }
+ } else {
+ if (!hasItems()) {
+ setHasItems(true);
+ }
+ }
+ }
+
+ /**
+ * @return Returns item's child count.
+ */
+ public int getItemCount() {
+ return fItemCount;
+ }
+
+ /**
+ * Returns the child item at given index. Child item is created if needed.
+ *
+ * @param index Index of the child item.
+ * @return Child item.
+ */
+ public VirtualItem getItem(Index index) {
+ ensureItems();
+
+ VirtualItem item = fItems.get(index);
+ if (item == null) {
+ item = new VirtualItem(this, index);
+ fItems.put(index, item);
+ }
+ return item;
+ }
+
+ /**
+ * @return Returns true if any of the child items need a data update.
+ */
+ public boolean childrenNeedDataUpdate() {
+ if (getItemCount() == 0) {
+ return false;
+ }
+ if (fItems == null || fItems.size() != fItemCount) {
+ return true;
+ }
for (VirtualItem child : fItems.values()) {
- if (child.needsDataUpdate()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns an array of current child items. The returned array contains
- * only the items that have been created. It may not contain as many items as the
- * item count.
- *
- * @return Child items array.
- */
- public VirtualItem[] getItems() {
- return fItems.values().toArray(new VirtualItem[fItems.size()]);
- }
-
- /**
- * Adds a child item at the given index position.
- * @param position The index position to inser the new item at.
- * @return Returns the added item.
- */
- public VirtualItem addItem(int position) {
- if (!fHasItems) {
- fHasItems = true;
- }
- if (fItemCount < 0) {
- fItemCount = 0;
- }
-
- // Increment all items with an index higher than the given position.
- fItemCount++;
- ensureItems();
+ if (child.needsDataUpdate()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns an array of current child items. The returned array contains
+ * only the items that have been created. It may not contain as many items as the
+ * item count.
+ *
+ * @return Child items array.
+ */
+ public VirtualItem[] getItems() {
+ return fItems.values().toArray(new VirtualItem[fItems.size()]);
+ }
+
+ /**
+ * Adds a child item at the given index position.
+ * @param position The index position to inser the new item at.
+ * @return Returns the added item.
+ */
+ public VirtualItem addItem(int position) {
+ if (!fHasItems) {
+ fHasItems = true;
+ }
+ if (fItemCount < 0) {
+ fItemCount = 0;
+ }
+
+ // Increment all items with an index higher than the given position.
+ fItemCount++;
+ ensureItems();
for (Index childIndex : fItems.keySet()) {
- if (childIndex.intValue() >= position) {
- childIndex.increment();
- }
- }
-
- // Note: the same index object used to create the item has to
- // be used as the key into the map.
- Index childIndex = new Index(position);
- VirtualItem newChild = new VirtualItem(this, childIndex);
- fItems.put(childIndex, newChild);
- return newChild;
- }
-
- /**
- * Removes the item at the given index.
- * @param position Index of the item to remove.
- */
- public void remove(Index position) {
- fItemCount--;
- if (fItemCount < 0) {
- fHasItems = false;
- }
-
- ensureItems();
-
- VirtualItem removedItem = null;
+ if (childIndex.intValue() >= position) {
+ childIndex.increment();
+ }
+ }
+
+ // Note: the same index object used to create the item has to
+ // be used as the key into the map.
+ Index childIndex = new Index(position);
+ VirtualItem newChild = new VirtualItem(this, childIndex);
+ fItems.put(childIndex, newChild);
+ return newChild;
+ }
+
+ /**
+ * Removes the item at the given index.
+ * @param position Index of the item to remove.
+ */
+ public void remove(Index position) {
+ fItemCount--;
+ if (fItemCount < 0) {
+ fHasItems = false;
+ }
+
+ ensureItems();
+
+ VirtualItem removedItem = null;
for (Iterator<Entry<Index, VirtualItem>> itr = fItems.entrySet().iterator(); itr.hasNext();) {
Entry<Index, VirtualItem> entry = itr.next();
- Index childIndex = entry.getKey();
- if (childIndex.intValue() > position.intValue()) {
- childIndex.decrement();
- } else if (childIndex.intValue() == position.intValue()) {
- removedItem = entry.getValue();
- removedItem.dispose();
- itr.remove();
- }
- }
- }
-
- private void ensureItems() {
- if (fItems == null) {
+ Index childIndex = entry.getKey();
+ if (childIndex.intValue() > position.intValue()) {
+ childIndex.decrement();
+ } else if (childIndex.intValue() == position.intValue()) {
+ removedItem = entry.getValue();
+ removedItem.dispose();
+ itr.remove();
+ }
+ }
+ }
+
+ private void ensureItems() {
+ if (fItems == null) {
fItems = new HashMap<>(Math.max(1, Math.min(fItemCount, 16)));
- }
- }
-
- private VirtualTree findTree() {
- VirtualItem item = this;
- while (!(item instanceof VirtualTree)) {
- item = item.fParent;
- }
- return (VirtualTree)item;
- }
-
- @Override
+ }
+ }
+
+ private VirtualTree findTree() {
+ VirtualItem item = this;
+ while (!(item instanceof VirtualTree)) {
+ item = item.fParent;
+ }
+ return (VirtualTree)item;
+ }
+
+ @Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
- toStringItem(buffer, IInternalDebugCoreConstants.EMPTY_STRING);
- return buffer.toString();
- }
-
- void toStringItem(StringBuffer buffer, String indent) {
- buffer.append(indent);
- buffer.append(toStringElement());
- buffer.append("\n"); //$NON-NLS-1$
- indent = indent + " "; //$NON-NLS-1$
- for (int i = 0; i < fItemCount; i++) {
- VirtualItem item = fItems.get(new Index(i));
- if (item != null) {
- item.toStringItem(buffer, indent);
- } else {
- buffer.append("<no item>\n"); //$NON-NLS-1$
- }
- }
- }
-
- private String toStringElement() {
- String[] label = (String[])fData.get(LABEL_KEY);
- if (label != null && label.length != 0) {
- return label[0];
- }
- Object data = fData.get(ELEMENT_DATA_KEY);
- if (data != null) {
- return data.toString();
- }
- return "<no data>"; //$NON-NLS-1$
- }
+ StringBuffer buffer = new StringBuffer();
+ toStringItem(buffer, IInternalDebugCoreConstants.EMPTY_STRING);
+ return buffer.toString();
+ }
+
+ void toStringItem(StringBuffer buffer, String indent) {
+ buffer.append(indent);
+ buffer.append(toStringElement());
+ buffer.append("\n"); //$NON-NLS-1$
+ indent = indent + " "; //$NON-NLS-1$
+ for (int i = 0; i < fItemCount; i++) {
+ VirtualItem item = fItems.get(new Index(i));
+ if (item != null) {
+ item.toStringItem(buffer, indent);
+ } else {
+ buffer.append("<no item>\n"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private String toStringElement() {
+ String[] label = (String[])fData.get(LABEL_KEY);
+ if (label != null && label.length != 0) {
+ return label[0];
+ }
+ Object data = fData.get(ELEMENT_DATA_KEY);
+ if (data != null) {
+ return data.toString();
+ }
+ return "<no data>"; //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
index 6eca256f3..3395b071e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
@@ -29,193 +29,193 @@ import org.eclipse.swt.SWT;
*/
public class VirtualTree extends VirtualItem {
- /**
- * Lazy virtual tree does not retrieve elements or labels,
- * except for the selected elements.
- */
- private boolean fLazy;
+ /**
+ * Lazy virtual tree does not retrieve elements or labels,
+ * except for the selected elements.
+ */
+ private boolean fLazy;
- private IVirtualItemValidator fValidator;
+ private IVirtualItemValidator fValidator;
- private class SelectedItemValidator implements IVirtualItemValidator {
- @Override
+ private class SelectedItemValidator implements IVirtualItemValidator {
+ @Override
public boolean isItemVisible(VirtualItem item) {
- // visible items. For now only mark the selected items as visible.
- for (int i = 0; i < fSelection.length; i++) {
- VirtualItem selectionItem = fSelection[i];
- while (selectionItem != null) {
- if (item.equals(selectionItem)) {
- return true;
- }
- selectionItem = selectionItem.getParent();
- }
- }
- return false;
- }
-
- @Override
+ // visible items. For now only mark the selected items as visible.
+ for (int i = 0; i < fSelection.length; i++) {
+ VirtualItem selectionItem = fSelection[i];
+ while (selectionItem != null) {
+ if (item.equals(selectionItem)) {
+ return true;
+ }
+ selectionItem = selectionItem.getParent();
+ }
+ }
+ return false;
+ }
+
+ @Override
public void showItem(VirtualItem item) {
- }
- }
+ }
+ }
- /**
- * Set of listeners of the virtual tree.
- */
+ /**
+ * Set of listeners of the virtual tree.
+ */
private Set<IVirtualItemListener> fVirtualItemListeners = new HashSet<>(1);
- /**
- * The currently selected items. This array contains only
- * the leaf items which are selected.
- */
- private VirtualItem[] fSelection = new VirtualItem[0];
-
- /**
- * Constructs the virtual tree with the given style and validator.
- *
- * @param style The style flag. Only SWT.VIRTUAL flag is used.
- * @param validator Item validator used to determine item visibility.
- */
- public VirtualTree(int style, IVirtualItemValidator validator) {
- super(null, new VirtualItem.Index(0));
- fLazy = (style & SWT.VIRTUAL) != 0;
- if (fLazy && validator == null) {
- fValidator = new SelectedItemValidator();
- } else {
- fValidator = validator;
- }
- clearNeedsLabelUpdate();
- clearNeedsDataUpdate();
- }
-
- /**
- * Disposes the virtual tree.
- */
- @Override
+ /**
+ * The currently selected items. This array contains only
+ * the leaf items which are selected.
+ */
+ private VirtualItem[] fSelection = new VirtualItem[0];
+
+ /**
+ * Constructs the virtual tree with the given style and validator.
+ *
+ * @param style The style flag. Only SWT.VIRTUAL flag is used.
+ * @param validator Item validator used to determine item visibility.
+ */
+ public VirtualTree(int style, IVirtualItemValidator validator) {
+ super(null, new VirtualItem.Index(0));
+ fLazy = (style & SWT.VIRTUAL) != 0;
+ if (fLazy && validator == null) {
+ fValidator = new SelectedItemValidator();
+ } else {
+ fValidator = validator;
+ }
+ clearNeedsLabelUpdate();
+ clearNeedsDataUpdate();
+ }
+
+ /**
+ * Disposes the virtual tree.
+ */
+ @Override
public void dispose() {
- super.dispose();
- fVirtualItemListeners.clear();
- }
+ super.dispose();
+ fVirtualItemListeners.clear();
+ }
- @Override
+ @Override
public void setNeedsCountUpdate() {
- super.setNeedsCountUpdate();
- clearNeedsLabelUpdate();
- clearNeedsDataUpdate();
- }
+ super.setNeedsCountUpdate();
+ clearNeedsLabelUpdate();
+ clearNeedsDataUpdate();
+ }
- @Override
+ @Override
public void setNeedsLabelUpdate() {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public void setData(String key, Object data) {
- super.setData(key, data);
- if (data == null) {
- clearNeedsDataUpdate();
- }
- }
-
- /**
- * Adds a listener for when virtual items are revealed in the view.
- * @param listener Listener to add to list of listeners.
- */
- public void addItemListener(IVirtualItemListener listener) {
- fVirtualItemListeners.add(listener);
- }
-
- public void removeItemListener(IVirtualItemListener listener) {
- fVirtualItemListeners.remove(listener);
- }
-
- public VirtualItem[] getSelection() {
- return fSelection;
- }
-
- public void setSelection(VirtualItem[] items) {
- fSelection = items;
- }
-
- public void showItem(VirtualItem item) {
- if (fValidator != null) {
- fValidator.showItem(item);
- }
- }
-
- public void fireItemDisposed(VirtualItem item) {
+ super.setData(key, data);
+ if (data == null) {
+ clearNeedsDataUpdate();
+ }
+ }
+
+ /**
+ * Adds a listener for when virtual items are revealed in the view.
+ * @param listener Listener to add to list of listeners.
+ */
+ public void addItemListener(IVirtualItemListener listener) {
+ fVirtualItemListeners.add(listener);
+ }
+
+ public void removeItemListener(IVirtualItemListener listener) {
+ fVirtualItemListeners.remove(listener);
+ }
+
+ public VirtualItem[] getSelection() {
+ return fSelection;
+ }
+
+ public void setSelection(VirtualItem[] items) {
+ fSelection = items;
+ }
+
+ public void showItem(VirtualItem item) {
+ if (fValidator != null) {
+ fValidator.showItem(item);
+ }
+ }
+
+ public void fireItemDisposed(VirtualItem item) {
for (IVirtualItemListener listener : fVirtualItemListeners) {
listener.disposed(item);
- }
- }
+ }
+ }
- public void fireItemRevealed(VirtualItem item) {
+ public void fireItemRevealed(VirtualItem item) {
for (IVirtualItemListener listener : fVirtualItemListeners) {
listener.revealed(item);
- }
- }
+ }
+ }
- @Override
+ @Override
public void setData(Object data) {
- super.setData(data);
- // The root item always has children as long as the input is non-null,
- // so that it should be expanded.
- setHasItems(data != null);
- }
+ super.setData(data);
+ // The root item always has children as long as the input is non-null,
+ // so that it should be expanded.
+ setHasItems(data != null);
+ }
- @Override
+ @Override
public void setHasItems(boolean hasChildren) {
- super.setHasItems(hasChildren);
- // The root item is always expanded as long as it has children.
- if (hasChildren) {
- setExpanded(true);
- }
- }
-
- /**
- * Returns whether the given item is considered visible by the tree as
- * determined by its virtual item validator.
- *
- * @param item Item to check.
- * @return true if items is vislble.
- * @see IVirtualItemValidator
- */
- public boolean isItemVisible(VirtualItem item) {
- if (fLazy) {
- return fValidator.isItemVisible(item);
- }
- return true;
- }
-
- /**
- * Validates the entire tree.
- */
- public void validate() {
- validate(VirtualTree.this);
- }
-
- /**
- * Validates the item and its children, identifying children which were
- * revealed and need to be updated.
- *
- * @param item The item which to validate.
- */
- public void validate(VirtualItem item) {
- if (item.needsDataUpdate()) {
- if (isItemVisible(item)) {
- fireItemRevealed(item);
- }
- } else if (item.getData() != null) {
- if ( item.needsLabelUpdate() || (item.needsCountUpdate() && item.hasItems() && item.getExpanded()) ) {
- if (isItemVisible(item)) {
- fireItemRevealed(item);
- }
- }
-
- if (item.getData() != null && item.getItemCount() > 0 && item.getExpanded()) {
- for (int i = 0; i < item.getItemCount(); i++) {
- validate(item.getItem(new Index(i)));
- }
- }
- }
- }
+ super.setHasItems(hasChildren);
+ // The root item is always expanded as long as it has children.
+ if (hasChildren) {
+ setExpanded(true);
+ }
+ }
+
+ /**
+ * Returns whether the given item is considered visible by the tree as
+ * determined by its virtual item validator.
+ *
+ * @param item Item to check.
+ * @return true if items is vislble.
+ * @see IVirtualItemValidator
+ */
+ public boolean isItemVisible(VirtualItem item) {
+ if (fLazy) {
+ return fValidator.isItemVisible(item);
+ }
+ return true;
+ }
+
+ /**
+ * Validates the entire tree.
+ */
+ public void validate() {
+ validate(VirtualTree.this);
+ }
+
+ /**
+ * Validates the item and its children, identifying children which were
+ * revealed and need to be updated.
+ *
+ * @param item The item which to validate.
+ */
+ public void validate(VirtualItem item) {
+ if (item.needsDataUpdate()) {
+ if (isItemVisible(item)) {
+ fireItemRevealed(item);
+ }
+ } else if (item.getData() != null) {
+ if ( item.needsLabelUpdate() || (item.needsCountUpdate() && item.hasItems() && item.getExpanded()) ) {
+ if (isItemVisible(item)) {
+ fireItemRevealed(item);
+ }
+ }
+
+ if (item.getData() != null && item.getItemCount() > 0 && item.getExpanded()) {
+ for (int i = 0; i < item.getItemCount(); i++) {
+ validate(item.getItem(new Index(i)));
+ }
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java
index c822846f8..1913181ba 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java
@@ -39,187 +39,187 @@ import org.eclipse.ui.IMemento;
public class VirtualTreeModelViewer extends InternalVirtualTreeModelViewer {
- /**
- * Creates a virtual tree model viewer.
- * @param display Display used by the viewer to call the data providers
- * on the UI thread.
- * @param style Stlye flags.
- * @param context Viewer's presentation context.
- */
- public VirtualTreeModelViewer(Display display, int style, IPresentationContext context) {
- super(display, style, context, null);
- }
-
- /**
- * Creates a virtual tree model viewer.
- * @param display Display used by the viewer to call the data providers
- * on the UI thread.
- * @param style style flags.
- * @param context Viewer's presentation context.
- * @param validator Optional validator that is used to determine which items should be
- * considered visible when SWT.VIRTUAL style is used. If <code>null</code> then the
- * standard validator is used that updates only the selected items.
- *
- * @since 3.8
- */
- public VirtualTreeModelViewer(Display display, int style, IPresentationContext context, IVirtualItemValidator validator) {
- super(display, style, context, validator);
- }
-
- /**
- * Returns this viewer's presentation context.
- *
- * @return presentation context
- */
- @Override
+ /**
+ * Creates a virtual tree model viewer.
+ * @param display Display used by the viewer to call the data providers
+ * on the UI thread.
+ * @param style Stlye flags.
+ * @param context Viewer's presentation context.
+ */
+ public VirtualTreeModelViewer(Display display, int style, IPresentationContext context) {
+ super(display, style, context, null);
+ }
+
+ /**
+ * Creates a virtual tree model viewer.
+ * @param display Display used by the viewer to call the data providers
+ * on the UI thread.
+ * @param style style flags.
+ * @param context Viewer's presentation context.
+ * @param validator Optional validator that is used to determine which items should be
+ * considered visible when SWT.VIRTUAL style is used. If <code>null</code> then the
+ * standard validator is used that updates only the selected items.
+ *
+ * @since 3.8
+ */
+ public VirtualTreeModelViewer(Display display, int style, IPresentationContext context, IVirtualItemValidator validator) {
+ super(display, style, context, validator);
+ }
+
+ /**
+ * Returns this viewer's presentation context.
+ *
+ * @return presentation context
+ */
+ @Override
public IPresentationContext getPresentationContext() {
- return super.getPresentationContext();
- }
-
- /**
- * Registers the given listener for model delta notification.
- *
- * @param listener model delta listener
- */
- @Override
+ return super.getPresentationContext();
+ }
+
+ /**
+ * Registers the given listener for model delta notification.
+ *
+ * @param listener model delta listener
+ */
+ @Override
public void addModelChangedListener(IModelChangedListener listener) {
- super.addModelChangedListener(listener);
- }
-
- /**
- * Unregisters the given listener from model delta notification.
- *
- * @param listener model delta listener
- */
- @Override
+ super.addModelChangedListener(listener);
+ }
+
+ /**
+ * Unregisters the given listener from model delta notification.
+ *
+ * @param listener model delta listener
+ */
+ @Override
public void removeModelChangedListener(IModelChangedListener listener) {
- super.removeModelChangedListener(listener);
- }
-
- /**
- * Registers the specified listener for view update notifications.
- *
- * @param listener listener
- */
- @Override
+ super.removeModelChangedListener(listener);
+ }
+
+ /**
+ * Registers the specified listener for view update notifications.
+ *
+ * @param listener listener
+ */
+ @Override
public void addViewerUpdateListener(IViewerUpdateListener listener) {
- super.addViewerUpdateListener(listener);
- }
-
- /**
- * Removes the specified listener from update notifications.
- *
- * @param listener listener
- */
- @Override
+ super.addViewerUpdateListener(listener);
+ }
+
+ /**
+ * Removes the specified listener from update notifications.
+ *
+ * @param listener listener
+ */
+ @Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {
- super.removeViewerUpdateListener(listener);
- }
-
- /**
- * Returns whether columns can be toggled on/off for this viewer's current
- * input element.
- *
- * @return whether columns can be toggled on/off
- */
- @Override
+ super.removeViewerUpdateListener(listener);
+ }
+
+ /**
+ * Returns whether columns can be toggled on/off for this viewer's current
+ * input element.
+ *
+ * @return whether columns can be toggled on/off
+ */
+ @Override
public boolean canToggleColumns() {
- return super.canToggleColumns();
- }
-
- /**
- * Returns the current column presentation for this viewer, or <code>null</code>
- * if none.
- *
- * @return column presentation or <code>null</code>
- */
- @Override
+ return super.canToggleColumns();
+ }
+
+ /**
+ * Returns the current column presentation for this viewer, or <code>null</code>
+ * if none.
+ *
+ * @return column presentation or <code>null</code>
+ */
+ @Override
public IColumnPresentation getColumnPresentation() {
- return super.getColumnPresentation();
- }
-
- /**
- * Returns identifiers of the visible columns in this viewer, or <code>null</code>
- * if there are currently no columns.
- *
- * @return visible columns identifiers or <code>null</code>
- */
- @Override
+ return super.getColumnPresentation();
+ }
+
+ /**
+ * Returns identifiers of the visible columns in this viewer, or <code>null</code>
+ * if there are currently no columns.
+ *
+ * @return visible columns identifiers or <code>null</code>
+ */
+ @Override
public String[] getVisibleColumns() {
- return super.getVisibleColumns();
- }
-
- /**
- * Initializes viewer state from the memento
- *
- * @param memento the {@link IMemento} to read from
- */
- @Override
+ return super.getVisibleColumns();
+ }
+
+ /**
+ * Initializes viewer state from the memento
+ *
+ * @param memento the {@link IMemento} to read from
+ */
+ @Override
public void initState(IMemento memento) {
- super.initState(memento);
- }
-
- /**
- * Save viewer state into the given memento.
- *
- * @param memento the {@link IMemento} to save to
- */
- @Override
+ super.initState(memento);
+ }
+
+ /**
+ * Save viewer state into the given memento.
+ *
+ * @param memento the {@link IMemento} to save to
+ */
+ @Override
public void saveState(IMemento memento) {
- super.saveState(memento);
- }
+ super.saveState(memento);
+ }
- /**
- * @return Returns true if columns are being displayed currently.
- */
- @Override
+ /**
+ * @return Returns true if columns are being displayed currently.
+ */
+ @Override
public boolean isShowColumns() {
- return super.isShowColumns();
- }
-
- /**
- * Toggles columns on/off for the current column presentation, if any.
- *
- * @param show whether to show columns if the current input supports
- * columns
- */
- @Override
+ return super.isShowColumns();
+ }
+
+ /**
+ * Toggles columns on/off for the current column presentation, if any.
+ *
+ * @param show whether to show columns if the current input supports
+ * columns
+ */
+ @Override
public void setShowColumns(boolean show) {
- super.setShowColumns(show);
- }
-
- /**
- * Sets the visible columns for this viewer. Id's correspond to
- * column identifiers from a column presentation. Use <code>null</code>
- * or an empty collection to display default columns for the current
- * column presentation. Only affects the current column presentation.
- *
- * @param ids column identifiers or <code>null</code>
- */
- @Override
+ super.setShowColumns(show);
+ }
+
+ /**
+ * Sets the visible columns for this viewer. Id's correspond to
+ * column identifiers from a column presentation. Use <code>null</code>
+ * or an empty collection to display default columns for the current
+ * column presentation. Only affects the current column presentation.
+ *
+ * @param ids column identifiers or <code>null</code>
+ */
+ @Override
public void setVisibleColumns(String[] ids) {
- super.setVisibleColumns(ids);
- }
+ super.setVisibleColumns(ids);
+ }
- @Override
+ @Override
public void updateViewer(IModelDelta delta) {
- super.updateViewer(delta);
- }
+ super.updateViewer(delta);
+ }
- @Override
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
- return super.getElementLabel(path, columnId);
- }
+ return super.getElementLabel(path, columnId);
+ }
- @Override
+ @Override
public VirtualItem[] findItems(Object elementOrTreePath) {
- return super.findItems(elementOrTreePath);
- }
+ return super.findItems(elementOrTreePath);
+ }
- @Override
+ @Override
public VirtualItem findItem(TreePath path) {
- return super.findItem(path);
- }
+ return super.findItem(path);
+ }
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java
index 5ef47dc2a..6010cacff 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java
@@ -72,11 +72,11 @@ public abstract class AbstractModelProxy implements IModelProxy2 {
* @param delta model delta to broadcast
*/
public void fireModelChanged(IModelDelta delta) {
- synchronized(this) {
- if (!fInstalled || fDisposed) {
+ synchronized(this) {
+ if (!fInstalled || fDisposed) {
return;
}
- }
+ }
final IModelDelta root = getRootDelta(delta);
for (IModelChangedListener iModelChangedListener : getListeners()) {
@@ -93,7 +93,7 @@ public abstract class AbstractModelProxy implements IModelProxy2 {
}
};
- SafeRunner.run(safeRunnable);
+ SafeRunner.run(safeRunnable);
}
}
@@ -114,61 +114,61 @@ public abstract class AbstractModelProxy implements IModelProxy2 {
@Override
public synchronized void dispose() {
- if (fInstallJob != null) {
- fInstallJob.cancel();
- fInstallJob = null;
- }
+ if (fInstallJob != null) {
+ fInstallJob.cancel();
+ fInstallJob = null;
+ }
fDisposed = true;
fContext = null;
fViewer = null;
}
protected synchronized void setInstalled(boolean installed) {
- fInstalled = installed;
+ fInstalled = installed;
}
protected synchronized boolean isInstalled() {
- return fInstalled;
+ return fInstalled;
}
protected synchronized void setDisposed(boolean disposed) {
- fDisposed = disposed;
+ fDisposed = disposed;
}
@Override
public void initialize(ITreeModelViewer viewer) {
- setDisposed(false);
+ setDisposed(false);
- synchronized(this) {
- fViewer = viewer;
- fContext = viewer.getPresentationContext();
- fInstallJob = new Job("Model Proxy installed notification job") {//$NON-NLS-1$
- @Override
+ synchronized(this) {
+ fViewer = viewer;
+ fContext = viewer.getPresentationContext();
+ fInstallJob = new Job("Model Proxy installed notification job") {//$NON-NLS-1$
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- synchronized(this) {
- fInstallJob = null;
- }
- if (!monitor.isCanceled()) {
- init(getTreeModelViewer().getPresentationContext());
- setInstalled(true);
- installed(getViewer());
- }
- return Status.OK_STATUS;
- }
-
- @Override
+ synchronized(this) {
+ fInstallJob = null;
+ }
+ if (!monitor.isCanceled()) {
+ init(getTreeModelViewer().getPresentationContext());
+ setInstalled(true);
+ installed(getViewer());
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
public boolean belongsTo(Object family) {
return AbstractModelProxy.this == family;
}
@Override
public boolean shouldRun() {
- return !isDisposed();
- }
- };
- fInstallJob.setSystem(true);
- }
- fInstallJob.schedule();
+ return !isDisposed();
+ }
+ };
+ fInstallJob.setSystem(true);
+ }
+ fInstallJob.schedule();
}
/**
@@ -201,14 +201,14 @@ public abstract class AbstractModelProxy implements IModelProxy2 {
return (Viewer)fViewer;
}
- /**
- * Returns the viewer this proxy is installed in.
- *
- * @return viewer or <code>null</code> if not installed
- */
- protected ITreeModelViewer getTreeModelViewer() {
- return fViewer;
- }
+ /**
+ * Returns the viewer this proxy is installed in.
+ *
+ * @return viewer or <code>null</code> if not installed
+ */
+ protected ITreeModelViewer getTreeModelViewer() {
+ return fViewer;
+ }
@Override
public synchronized boolean isDisposed() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java
index fd4ca97a2..08f426ca7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousContentAdapter.java
@@ -34,7 +34,7 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent
protected static final Object[] EMPTY = new Object[0];
- @Override
+ @Override
public void retrieveChildren(final Object parent, final IPresentationContext context, final IChildrenRequestMonitor result) {
Job job = new Job("Retrieving Children") { //$NON-NLS-1$
@Override
@@ -50,19 +50,19 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent
job.schedule();
}
- /**
- * Returns the scheduling rule for jobs retrieving children.
- *
- * @param parent the parent
- * @param context the presentation context
- * @return scheduling rule or <code>null</code>
- */
- protected ISchedulingRule getRetrieveChildrenRule(Object parent, IPresentationContext context) {
- return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context);
- }
+ /**
+ * Returns the scheduling rule for jobs retrieving children.
+ *
+ * @param parent the parent
+ * @param context the presentation context
+ * @return scheduling rule or <code>null</code>
+ */
+ protected ISchedulingRule getRetrieveChildrenRule(Object parent, IPresentationContext context) {
+ return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context);
+ }
- @Override
+ @Override
public void isContainer(final Object element, final IPresentationContext context, final IContainerRequestMonitor result) {
Job job = new Job("Computing hasChildren") { //$NON-NLS-1$
@Override
@@ -78,25 +78,25 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent
job.schedule();
}
- /**
- * Returns the scheduling rule for jobs determining if an element is a container.
- *
- * @param parent the parent
- * @param context the presentation context
- * @return scheduling rule or <code>null</code>
- */
- protected ISchedulingRule getIsContainerRule(Object parent, IPresentationContext context) {
- return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context);
- }
+ /**
+ * Returns the scheduling rule for jobs determining if an element is a container.
+ *
+ * @param parent the parent
+ * @param context the presentation context
+ * @return scheduling rule or <code>null</code>
+ */
+ protected ISchedulingRule getIsContainerRule(Object parent, IPresentationContext context) {
+ return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context);
+ }
- /**
- * Computes the children for the given parent in the specified context.
- *
- * @param parent parent to retrieve children for
- * @param context presentation context
- * @param monitor result to report to
- */
- protected void computeChildren(Object parent, IPresentationContext context, IChildrenRequestMonitor monitor) {
+ /**
+ * Computes the children for the given parent in the specified context.
+ *
+ * @param parent parent to retrieve children for
+ * @param context presentation context
+ * @param monitor result to report to
+ */
+ protected void computeChildren(Object parent, IPresentationContext context, IChildrenRequestMonitor monitor) {
if (!monitor.isCanceled()) {
IStatus status = Status.OK_STATUS;
try {
@@ -109,16 +109,16 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent
monitor.setStatus(status);
monitor.done();
}
- }
+ }
- /**
- * Computes whether the given element is a container.
- *
- * @param parent potential parent
- * @param context presentation context
- * @param monitor result to report to
- */
- protected void computeIsContainer(Object parent, IPresentationContext context, IContainerRequestMonitor monitor) {
+ /**
+ * Computes whether the given element is a container.
+ *
+ * @param parent potential parent
+ * @param context presentation context
+ * @param monitor result to report to
+ */
+ protected void computeIsContainer(Object parent, IPresentationContext context, IContainerRequestMonitor monitor) {
if (!monitor.isCanceled()) {
IStatus status = Status.OK_STATUS;
try {
@@ -129,44 +129,44 @@ public abstract class AsynchronousContentAdapter implements IAsynchronousContent
monitor.setStatus(status);
monitor.done();
}
- }
+ }
- /**
- * Returns the children for the given parent in the specified context.
- *
- * @param parent element to retrieve children for
- * @param context context children will be presented in
- * @return children
- * @throws CoreException if an exception occurs retrieving children
- */
- protected abstract Object[] getChildren(Object parent, IPresentationContext context) throws CoreException;
+ /**
+ * Returns the children for the given parent in the specified context.
+ *
+ * @param parent element to retrieve children for
+ * @param context context children will be presented in
+ * @return children
+ * @throws CoreException if an exception occurs retrieving children
+ */
+ protected abstract Object[] getChildren(Object parent, IPresentationContext context) throws CoreException;
- /**
- * Returns whether the given element has children in the specified context.
- *
- * @param element element that may have children
- * @param context context element will be presented in
- * @return whether the given element has children in the specified context
- * @throws CoreException if an exception occurs determining whether the
- * element has children
- */
- protected abstract boolean hasChildren(Object element, IPresentationContext context) throws CoreException;
+ /**
+ * Returns whether the given element has children in the specified context.
+ *
+ * @param element element that may have children
+ * @param context context element will be presented in
+ * @return whether the given element has children in the specified context
+ * @throws CoreException if an exception occurs determining whether the
+ * element has children
+ */
+ protected abstract boolean hasChildren(Object element, IPresentationContext context) throws CoreException;
- /**
- * Returns whether this adapter supports the given context.
- *
- * @param context the presentation context
- * @return whether this adapter supports the given context
- */
- protected boolean supportsContext(IPresentationContext context) {
+ /**
+ * Returns whether this adapter supports the given context.
+ *
+ * @param context the presentation context
+ * @return whether this adapter supports the given context
+ */
+ protected boolean supportsContext(IPresentationContext context) {
return supportsPartId(context.getId());
- }
+ }
- /**
- * Returns whether this adapter provides content in the specified part.
- *
- * @param id part id
- * @return whether this adapter provides content in the specified part
- */
- protected abstract boolean supportsPartId(String id);
+ /**
+ * Returns whether this adapter provides content in the specified part.
+ *
+ * @param id part id
+ * @return whether this adapter provides content in the specified part
+ */
+ protected abstract boolean supportsPartId(String id);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java
index ff6929a9c..5abc88886 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AsynchronousLabelAdapter.java
@@ -62,16 +62,16 @@ public abstract class AsynchronousLabelAdapter implements IAsynchronousLabelAdap
job.schedule();
}
- /**
- * Returns the scheduling rule for label jobs.
- *
- * @param element the element context
- * @param context the presentation context
- * @return scheduling rule or <code>null</code>
- */
- protected ISchedulingRule getLabelRule(Object element, IPresentationContext context) {
- return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context);
- }
+ /**
+ * Returns the scheduling rule for label jobs.
+ *
+ * @param element the element context
+ * @param context the presentation context
+ * @return scheduling rule or <code>null</code>
+ */
+ protected ISchedulingRule getLabelRule(Object element, IPresentationContext context) {
+ return AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(context);
+ }
/**
* Returns whether this label adapter requires to be run in the UI thread.
@@ -127,49 +127,49 @@ public abstract class AsynchronousLabelAdapter implements IAsynchronousLabelAdap
* @return label
* @exception CoreException if an exception occurs computing label
*/
- protected abstract String[] getLabels(Object element, IPresentationContext context) throws CoreException;
+ protected abstract String[] getLabels(Object element, IPresentationContext context) throws CoreException;
- /**
- * Returns an image descriptor for the given element in the specified context
- * or <code>null</code>.
- *
- * @param element element to compute image descriptor for
- * @param context presentation context
- * @return image descriptor or <code>null</code>
- * @throws CoreException if an exception occurs computing image descriptor
- */
- protected abstract ImageDescriptor[] getImageDescriptors(Object element, IPresentationContext context) throws CoreException;
+ /**
+ * Returns an image descriptor for the given element in the specified context
+ * or <code>null</code>.
+ *
+ * @param element element to compute image descriptor for
+ * @param context presentation context
+ * @return image descriptor or <code>null</code>
+ * @throws CoreException if an exception occurs computing image descriptor
+ */
+ protected abstract ImageDescriptor[] getImageDescriptors(Object element, IPresentationContext context) throws CoreException;
- /**
- * Returns font data for the given element in the specified context or <code>null</code>
- * to use the default font.
- *
- * @param element element to compute font data for
- * @param context presentation context
- * @return font data or <code>null</code>
- * @throws CoreException if an exception occurs computing font data
- */
- protected abstract FontData[] getFontDatas(Object element, IPresentationContext context) throws CoreException;
+ /**
+ * Returns font data for the given element in the specified context or <code>null</code>
+ * to use the default font.
+ *
+ * @param element element to compute font data for
+ * @param context presentation context
+ * @return font data or <code>null</code>
+ * @throws CoreException if an exception occurs computing font data
+ */
+ protected abstract FontData[] getFontDatas(Object element, IPresentationContext context) throws CoreException;
- /**
- * Returns a foreground color for the given element in the specified context or <code>null</code>
- * to use the default color.
- *
- * @param element element to compute color for
- * @param context presentation context
- * @return color or <code>null</code>
- * @throws CoreException if an exception occurs computing color
- */
- protected abstract RGB[] getForegrounds(Object element, IPresentationContext context) throws CoreException;
+ /**
+ * Returns a foreground color for the given element in the specified context or <code>null</code>
+ * to use the default color.
+ *
+ * @param element element to compute color for
+ * @param context presentation context
+ * @return color or <code>null</code>
+ * @throws CoreException if an exception occurs computing color
+ */
+ protected abstract RGB[] getForegrounds(Object element, IPresentationContext context) throws CoreException;
- /**
- * Returns a background color for the given element in the specified context or <code>null</code>
- * to use the default color.
- *
- * @param element element to compute color for
- * @param context presentation context
- * @return color or <code>null</code>
- * @throws CoreException if an exception occurs computing color
- */
- protected abstract RGB[] getBackgrounds(Object element, IPresentationContext context) throws CoreException;
+ /**
+ * Returns a background color for the given element in the specified context or <code>null</code>
+ * to use the default color.
+ *
+ * @param element element to compute color for
+ * @param context presentation context
+ * @return color or <code>null</code>
+ * @throws CoreException if an exception occurs computing color
+ */
+ protected abstract RGB[] getBackgrounds(Object element, IPresentationContext context) throws CoreException;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousContentAdapter.java
index ddad3eba0..a639cd75b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousContentAdapter.java
@@ -25,27 +25,27 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
*/
public interface IAsynchronousContentAdapter {
- /**
- * Asynchronously retrieves the children of the given parent reporting to the
- * given monitor. If unable to retrieve children, an exception should be reported
- * to the monitor with an appropriate status.
- *
- * @param parent the element to retrieve children for
- * @param context the context in which children have been requested
- * @param monitor request monitor to report children to
- */
- void retrieveChildren(Object parent, IPresentationContext context, IChildrenRequestMonitor result);
+ /**
+ * Asynchronously retrieves the children of the given parent reporting to the
+ * given monitor. If unable to retrieve children, an exception should be reported
+ * to the monitor with an appropriate status.
+ *
+ * @param parent the element to retrieve children for
+ * @param context the context in which children have been requested
+ * @param monitor request monitor to report children to
+ */
+ void retrieveChildren(Object parent, IPresentationContext context, IChildrenRequestMonitor result);
- /**
- * Asynchronously determines whether the given element contains children in the specified
- * context reporting the result to the given monitor. If unable to determine
- * whether the element has children, an exception should be reported to the monitor
- * with an appropriate status.
- *
- * @param element the element on which children may exist
- * @param context the context in which children may exist
- * @param monitor request monitor to report the result to
- */
- void isContainer(Object element, IPresentationContext context, IContainerRequestMonitor result);
+ /**
+ * Asynchronously determines whether the given element contains children in the specified
+ * context reporting the result to the given monitor. If unable to determine
+ * whether the element has children, an exception should be reported to the monitor
+ * with an appropriate status.
+ *
+ * @param element the element on which children may exist
+ * @param context the context in which children may exist
+ * @param monitor request monitor to report the result to
+ */
+ void isContainer(Object element, IPresentationContext context, IContainerRequestMonitor result);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousLabelAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousLabelAdapter.java
index 5237a4031..50da68172 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousLabelAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IAsynchronousLabelAdapter.java
@@ -25,16 +25,16 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
*/
public interface IAsynchronousLabelAdapter {
- /**
- * Asynchronously retrieves the label of the given object reporting to
- * the given monitor. If unable to retrieve label information, an exception should be
- * reported to the monitor with an appropriate status.
- *
- * @param object the element for which a label is requested
- * @param context the context in which the label has been requested
- * @param monitor request monitor to report the result to
- */
- void retrieveLabel(Object object, IPresentationContext context, ILabelRequestMonitor result);
+ /**
+ * Asynchronously retrieves the label of the given object reporting to
+ * the given monitor. If unable to retrieve label information, an exception should be
+ * reported to the monitor with an appropriate status.
+ *
+ * @param object the element for which a label is requested
+ * @param context the context in which the label has been requested
+ * @param monitor request monitor to report the result to
+ */
+ void retrieveLabel(Object object, IPresentationContext context, ILabelRequestMonitor result);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IChildrenRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IChildrenRequestMonitor.java
index b29f3a19c..60fc8098b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IChildrenRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IChildrenRequestMonitor.java
@@ -29,12 +29,12 @@ public interface IChildrenRequestMonitor extends IStatusMonitor {
*
* @param child child to add
*/
- void addChild(Object child);
+ void addChild(Object child);
- /**
- * Adds the given children to this request.
- *
- * @param children children to add
- */
- void addChildren(Object[] children);
+ /**
+ * Adds the given children to this request.
+ *
+ * @param children children to add
+ */
+ void addChildren(Object[] children);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IContainerRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IContainerRequestMonitor.java
index 4be814f12..3ada47d14 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IContainerRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/IContainerRequestMonitor.java
@@ -30,6 +30,6 @@ public interface IContainerRequestMonitor extends IStatusMonitor {
*
* @param container whether an element contains children
*/
- void setIsContainer(boolean container);
+ void setIsContainer(boolean container);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/ILabelRequestMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/ILabelRequestMonitor.java
index 0ff3ffd8b..a25a8d1a1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/ILabelRequestMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/ILabelRequestMonitor.java
@@ -33,34 +33,34 @@ public interface ILabelRequestMonitor extends IStatusMonitor {
*
* @param text
*/
- void setLabels(String[] text);
+ void setLabels(String[] text);
- /**
- * Sets the font of the label.
- *
- * @param fontData
- */
- void setFontDatas(FontData[] fontData);
+ /**
+ * Sets the font of the label.
+ *
+ * @param fontData
+ */
+ void setFontDatas(FontData[] fontData);
- /**
- * Sets the image of the label.
- *
- * @param image
- */
- void setImageDescriptors(ImageDescriptor[] image);
+ /**
+ * Sets the image of the label.
+ *
+ * @param image
+ */
+ void setImageDescriptors(ImageDescriptor[] image);
- /**
- * Sets the foreground color of the label.
- *
- * @param foreground
- */
- void setForegrounds(RGB[] foreground);
+ /**
+ * Sets the foreground color of the label.
+ *
+ * @param foreground
+ */
+ void setForegrounds(RGB[] foreground);
- /**
- * Sets the background color of the label.
- *
- * @param background
- */
- void setBackgrounds(RGB[] background);
+ /**
+ * Sets the background color of the label.
+ *
+ * @param background
+ */
+ void setBackgrounds(RGB[] background);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
index 67d0b84d4..ffb00b1b4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
@@ -53,24 +53,24 @@ public class BreakpointManagerProxy extends AbstractModelProxy {
/**
* Job to fire posted deltas.
*/
- private Job fFireModelChangedJob;
-
- /**
- * Object used for describing a posted delta.
- */
- private static class DeltaInfo {
- final boolean fSelect;
- final IModelDelta fDelta;
-
- DeltaInfo(boolean selectDelta, IModelDelta delta) {
- fSelect = selectDelta;
- fDelta = delta;
- }
- }
-
- /**
- * List of posted deltas ready to be fired.
- */
+ private Job fFireModelChangedJob;
+
+ /**
+ * Object used for describing a posted delta.
+ */
+ private static class DeltaInfo {
+ final boolean fSelect;
+ final IModelDelta fDelta;
+
+ DeltaInfo(boolean selectDelta, IModelDelta delta) {
+ fSelect = selectDelta;
+ fDelta = delta;
+ }
+ }
+
+ /**
+ * List of posted deltas ready to be fired.
+ */
private List<DeltaInfo> fPendingDeltas = new LinkedList<>();
@@ -108,14 +108,14 @@ public class BreakpointManagerProxy extends AbstractModelProxy {
@Override
public void dispose() {
- fProvider.unregisterModelProxy(fInput, this);
- synchronized(this) {
- if (fFireModelChangedJob != null) {
- fFireModelChangedJob.cancel();
- fFireModelChangedJob = null;
- }
- fPendingDeltas.clear();
- }
+ fProvider.unregisterModelProxy(fInput, this);
+ synchronized(this) {
+ if (fFireModelChangedJob != null) {
+ fFireModelChangedJob.cancel();
+ fFireModelChangedJob = null;
+ }
+ fPendingDeltas.clear();
+ }
super.dispose();
}
@@ -134,48 +134,48 @@ public class BreakpointManagerProxy extends AbstractModelProxy {
* viewer selection.
*/
public synchronized void postModelChanged(IModelDelta delta, boolean select) {
- // Check for proxy being disposed.
- if (isDisposed()) {
- return;
- }
- // Check for viewer being disposed.
- Widget viewerControl = getViewer().getControl();
- if (viewerControl == null) {
- return;
- }
-
- // If we are processing a select delta, remove the previous select delta.
- if (select) {
+ // Check for proxy being disposed.
+ if (isDisposed()) {
+ return;
+ }
+ // Check for viewer being disposed.
+ Widget viewerControl = getViewer().getControl();
+ if (viewerControl == null) {
+ return;
+ }
+
+ // If we are processing a select delta, remove the previous select delta.
+ if (select) {
for (Iterator<DeltaInfo> itr = fPendingDeltas.iterator(); itr.hasNext();) {
- if ( itr.next().fSelect ) {
- itr.remove();
- }
- }
- }
- fPendingDeltas.add(new DeltaInfo(select, delta));
-
- if (fFireModelChangedJob == null) {
- fFireModelChangedJob = new WorkbenchJob(viewerControl.getDisplay(), "Select Breakpoint Job") { //$NON-NLS-1$
- {
- setSystem(true);
- }
-
- @Override
+ if ( itr.next().fSelect ) {
+ itr.remove();
+ }
+ }
+ }
+ fPendingDeltas.add(new DeltaInfo(select, delta));
+
+ if (fFireModelChangedJob == null) {
+ fFireModelChangedJob = new WorkbenchJob(viewerControl.getDisplay(), "Select Breakpoint Job") { //$NON-NLS-1$
+ {
+ setSystem(true);
+ }
+
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- Object[] deltas;
- synchronized(BreakpointManagerProxy.this) {
- deltas = fPendingDeltas.toArray();
- fPendingDeltas.clear();
- fFireModelChangedJob = null;
- }
- for (int i = 0; i < deltas.length; i++) {
- fireModelChanged( ((DeltaInfo)deltas[i]).fDelta );
- }
- return Status.OK_STATUS;
- }
- };
- fFireModelChangedJob.schedule();
- }
+ Object[] deltas;
+ synchronized(BreakpointManagerProxy.this) {
+ deltas = fPendingDeltas.toArray();
+ fPendingDeltas.clear();
+ fFireModelChangedJob = null;
+ }
+ for (int i = 0; i < deltas.length; i++) {
+ fireModelChanged( ((DeltaInfo)deltas[i]).fDelta );
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ fFireModelChangedJob.schedule();
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetEventHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetEventHandler.java
index 789d6b8bf..a9da9c74f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetEventHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetEventHandler.java
@@ -51,7 +51,7 @@ public class DebugTargetEventHandler extends DebugEventHandler {
@Override
protected void handleCreate(DebugEvent event) {
- fireDelta((IDebugTarget) event.getSource(), IModelDelta.EXPAND);
+ fireDelta((IDebugTarget) event.getSource(), IModelDelta.EXPAND);
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java
index 50b2459ec..a804e7c95 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DebugTargetProxy.java
@@ -34,11 +34,11 @@ import org.eclipse.jface.viewers.Viewer;
*/
public class DebugTargetProxy extends EventHandlerModelProxy {
- private IDebugTarget fDebugTarget;
+ private IDebugTarget fDebugTarget;
- public DebugTargetProxy(IDebugTarget target) {
- fDebugTarget = target;
- }
+ public DebugTargetProxy(IDebugTarget target) {
+ fDebugTarget = target;
+ }
@Override
public synchronized void dispose() {
@@ -48,23 +48,23 @@ public class DebugTargetProxy extends EventHandlerModelProxy {
@Override
protected boolean containsEvent(DebugEvent event) {
- Object source = event.getSource();
- if (source instanceof IDebugElement) {
- IDebugTarget debugTarget = ((IDebugElement) source).getDebugTarget();
- // an expression can return null for debug target
- if (debugTarget != null) {
- return debugTarget.equals(fDebugTarget);
- }
- }
- return false;
- }
+ Object source = event.getSource();
+ if (source instanceof IDebugElement) {
+ IDebugTarget debugTarget = ((IDebugElement) source).getDebugTarget();
+ // an expression can return null for debug target
+ if (debugTarget != null) {
+ return debugTarget.equals(fDebugTarget);
+ }
+ }
+ return false;
+ }
- @Override
+ @Override
protected DebugEventHandler[] createEventHandlers() {
- ThreadEventHandler threadEventHandler = new ThreadEventHandler(this);
+ ThreadEventHandler threadEventHandler = new ThreadEventHandler(this);
return new DebugEventHandler[] { new DebugTargetEventHandler(this), threadEventHandler,
new StackFrameEventHandler(this, threadEventHandler) };
- }
+ }
@Override
public void installed(Viewer viewer) {
@@ -73,75 +73,75 @@ public class DebugTargetProxy extends EventHandlerModelProxy {
if (target != null) {
ModelDelta delta = getNextSuspendedThreadDelta(null, false);
if (delta == null) {
- try {
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- ILaunch launch = target.getLaunch();
- int launchIndex = getLaunchIndex(launch);
- int targetIndex = getTargetIndex(target);
- delta = new ModelDelta(manager, IModelDelta.NO_CHANGE);
- ModelDelta node = delta.addNode(launch, launchIndex, IModelDelta.NO_CHANGE, target.getLaunch().getChildren().length);
- node = node.addNode(target, targetIndex, IModelDelta.EXPAND | IModelDelta.SELECT, target.getThreads().length);
- } catch (DebugException e) {
- // In case of exception do not fire delta
- return;
- }
+ try {
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunch launch = target.getLaunch();
+ int launchIndex = getLaunchIndex(launch);
+ int targetIndex = getTargetIndex(target);
+ delta = new ModelDelta(manager, IModelDelta.NO_CHANGE);
+ ModelDelta node = delta.addNode(launch, launchIndex, IModelDelta.NO_CHANGE, target.getLaunch().getChildren().length);
+ node = node.addNode(target, targetIndex, IModelDelta.EXPAND | IModelDelta.SELECT, target.getThreads().length);
+ } catch (DebugException e) {
+ // In case of exception do not fire delta
+ return;
+ }
}
// expand the target if no suspended thread
fireModelChanged(delta);
}
}
- protected ModelDelta getNextSuspendedThreadDelta(IThread currentThread, boolean reverse) {
- IDebugTarget target = fDebugTarget;
- if (target != null) {
- try {
- IThread[] threads = target.getThreads();
- IThread chosen = null;
- int threadIndex = -1;
- // select the first thread with a breakpoint, or the first suspended thread
- // if none have breakpoints
- boolean takeNext = currentThread == null;
- int startIdx = reverse ? threads.length - 1 : 0;
- int endIdx = reverse ? -1 : threads.length;
- int increment = reverse ? -1 : 1;
- for (int i = startIdx; i != endIdx; i = i + increment) {
- IThread thread = threads[i];
- if (takeNext && thread.isSuspended()) {
- IBreakpoint[] bps = thread.getBreakpoints();
- if (bps != null && bps.length > 0) {
- chosen = thread;
- threadIndex = i;
- break;
- } else {
- if (chosen == null) {
- chosen = thread;
- threadIndex = i;
- }
- }
- }
- takeNext = takeNext || thread.equals(currentThread);
- }
- if (chosen != null) {
- IStackFrame frame = chosen.getTopStackFrame();
- if (frame != null) {
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- ILaunch launch = target.getLaunch();
- int launchIndex = getLaunchIndex(launch);
- int targetIndex = getTargetIndex(target);
- int stackFrameIndex = getStackFrameIndex(frame);
- ModelDelta delta = new ModelDelta(manager, IModelDelta.NO_CHANGE);
- ModelDelta node = delta.addNode(launch, launchIndex, IModelDelta.NO_CHANGE, target.getLaunch().getChildren().length);
- node = node.addNode(target, targetIndex, IModelDelta.NO_CHANGE, threads.length);
- node = node.addNode(chosen, threadIndex, IModelDelta.NO_CHANGE | IModelDelta.EXPAND, chosen.getStackFrames().length);
- node = node.addNode(frame, stackFrameIndex, IModelDelta.NO_CHANGE | IModelDelta.SELECT, 0);
- return delta;
- }
- }
- } catch (DebugException e) {
- }
- }
- return null;
- }
+ protected ModelDelta getNextSuspendedThreadDelta(IThread currentThread, boolean reverse) {
+ IDebugTarget target = fDebugTarget;
+ if (target != null) {
+ try {
+ IThread[] threads = target.getThreads();
+ IThread chosen = null;
+ int threadIndex = -1;
+ // select the first thread with a breakpoint, or the first suspended thread
+ // if none have breakpoints
+ boolean takeNext = currentThread == null;
+ int startIdx = reverse ? threads.length - 1 : 0;
+ int endIdx = reverse ? -1 : threads.length;
+ int increment = reverse ? -1 : 1;
+ for (int i = startIdx; i != endIdx; i = i + increment) {
+ IThread thread = threads[i];
+ if (takeNext && thread.isSuspended()) {
+ IBreakpoint[] bps = thread.getBreakpoints();
+ if (bps != null && bps.length > 0) {
+ chosen = thread;
+ threadIndex = i;
+ break;
+ } else {
+ if (chosen == null) {
+ chosen = thread;
+ threadIndex = i;
+ }
+ }
+ }
+ takeNext = takeNext || thread.equals(currentThread);
+ }
+ if (chosen != null) {
+ IStackFrame frame = chosen.getTopStackFrame();
+ if (frame != null) {
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunch launch = target.getLaunch();
+ int launchIndex = getLaunchIndex(launch);
+ int targetIndex = getTargetIndex(target);
+ int stackFrameIndex = getStackFrameIndex(frame);
+ ModelDelta delta = new ModelDelta(manager, IModelDelta.NO_CHANGE);
+ ModelDelta node = delta.addNode(launch, launchIndex, IModelDelta.NO_CHANGE, target.getLaunch().getChildren().length);
+ node = node.addNode(target, targetIndex, IModelDelta.NO_CHANGE, threads.length);
+ node = node.addNode(chosen, threadIndex, IModelDelta.NO_CHANGE | IModelDelta.EXPAND, chosen.getStackFrames().length);
+ node = node.addNode(frame, stackFrameIndex, IModelDelta.NO_CHANGE | IModelDelta.SELECT, 0);
+ return delta;
+ }
+ }
+ } catch (DebugException e) {
+ }
+ }
+ return null;
+ }
/**
* Computes the index of a launch at top level in the {@code Debug View} tree.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java
index 03d6dd7b2..04feb11ba 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultSelectionPolicy.java
@@ -109,25 +109,25 @@ public class DefaultSelectionPolicy implements IModelSelectionPolicy {
return false;
}
- /**
- * If an attempt is made to select an invalid element, it usually indicates that the
- * currently selected element was removed from the model. Instead of leaving the
- * selection empty, attempt to select the parent element instead.
- *
- * @param selection the selection to replace
- * @param newSelection the selection to use if the given selection is not an {@link ITreeSelection}
- * @return the replaced selection or <code>newSelection</code> if the given selection is not an {@link ITreeSelection}
- *
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy#replaceInvalidSelection(ISelection, ISelection)
- */
- @Override
+ /**
+ * If an attempt is made to select an invalid element, it usually indicates that the
+ * currently selected element was removed from the model. Instead of leaving the
+ * selection empty, attempt to select the parent element instead.
+ *
+ * @param selection the selection to replace
+ * @param newSelection the selection to use if the given selection is not an {@link ITreeSelection}
+ * @return the replaced selection or <code>newSelection</code> if the given selection is not an {@link ITreeSelection}
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy#replaceInvalidSelection(ISelection, ISelection)
+ */
+ @Override
public ISelection replaceInvalidSelection(ISelection selection, ISelection newSelection) {
- if (selection instanceof ITreeSelection) {
- TreePath[] paths = ((ITreeSelection)selection).getPaths();
- if (paths.length > 0 && paths[0].getSegmentCount() > 1) {
- return new TreeSelection(paths[0].getParentPath());
- }
- }
- return newSelection;
- }
+ if (selection instanceof ITreeSelection) {
+ TreePath[] paths = ((ITreeSelection)selection).getPaths();
+ if (paths.length > 0 && paths[0].getSegmentCount() > 1) {
+ return new TreeSelection(paths[0].getParentPath());
+ }
+ }
+ return newSelection;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultVariableViewModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultVariableViewModelProxy.java
index 599ab597f..109d86aac 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultVariableViewModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultVariableViewModelProxy.java
@@ -54,16 +54,16 @@ public class DefaultVariableViewModelProxy extends EventHandlerModelProxy {
@Override
protected synchronized boolean containsEvent(DebugEvent event) {
if (!isDisposed()) {
- Object source = event.getSource();
- if (source instanceof IDebugElement) {
- IDebugTarget debugTarget = ((IDebugElement) source).getDebugTarget();
- if (debugTarget != null) {
- // a debug target can be null for an IExpression
- return debugTarget.equals(fFrame.getDebugTarget());
- }
- }
+ Object source = event.getSource();
+ if (source instanceof IDebugElement) {
+ IDebugTarget debugTarget = ((IDebugElement) source).getDebugTarget();
+ if (debugTarget != null) {
+ // a debug target can be null for an IExpression
+ return debugTarget.equals(fFrame.getDebugTarget());
+ }
+ }
}
- return false;
- }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java
index b303ff888..ee7f58541 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java
@@ -56,27 +56,27 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
UIJob job = new UIJob("install watch expression model proxy") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (!isDisposed()) {
- IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
- // Virtual viewer may have a null control.
- Control control = viewer.getControl();
- if (control != null && control.getShell().equals(window.getShell())) {
- fWindow = window;
- break;
- }
- }
- if (fWindow == null) {
- fWindow = DebugUIPlugin.getActiveWorkbenchWindow();
- }
- IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
- contextService.addDebugContextListener(DefaultWatchExpressionModelProxy.this);
- ISelection activeContext = contextService.getActiveContext();
- if (activeContext != null) {
- contextActivated(activeContext);
- }
- }
+ if (!isDisposed()) {
+ IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ for (int i = 0; i < workbenchWindows.length; i++) {
+ IWorkbenchWindow window = workbenchWindows[i];
+ // Virtual viewer may have a null control.
+ Control control = viewer.getControl();
+ if (control != null && control.getShell().equals(window.getShell())) {
+ fWindow = window;
+ break;
+ }
+ }
+ if (fWindow == null) {
+ fWindow = DebugUIPlugin.getActiveWorkbenchWindow();
+ }
+ IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
+ contextService.addDebugContextListener(DefaultWatchExpressionModelProxy.this);
+ ISelection activeContext = contextService.getActiveContext();
+ if (activeContext != null) {
+ contextActivated(activeContext);
+ }
+ }
return Status.OK_STATUS;
}
@@ -89,8 +89,8 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
public synchronized void dispose() {
super.dispose();
if (fWindow != null) {
- DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(this);
- fWindow = null;
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removeDebugContextListener(this);
+ fWindow = null;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java
index cedf4fad9..68eec9df9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java
@@ -29,240 +29,240 @@ import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
*/
public abstract class EventHandlerModelProxy extends AbstractModelProxy implements IDebugEventSetListener {
- /**
- * Map of elements to timer tasks
- */
+ /**
+ * Map of elements to timer tasks
+ */
private Map<Object, PendingSuspendTask> fTimerTasks = new HashMap<>();
- /**
- * Timer for timer tasks
- */
- private Timer fTimer = new Timer(true);
+ /**
+ * Timer for timer tasks
+ */
+ private Timer fTimer = new Timer(true);
- /**
- * Map of event source to resume events with a pending suspend that timed
- * out.
- */
+ /**
+ * Map of event source to resume events with a pending suspend that timed
+ * out.
+ */
private Map<Object, DebugEvent> fPendingSuspends = new HashMap<>();
- /**
- * Event handlers for specific elements
- */
- private DebugEventHandler[] fHandlers = new DebugEventHandler[0];
+ /**
+ * Event handlers for specific elements
+ */
+ private DebugEventHandler[] fHandlers = new DebugEventHandler[0];
- /**
- * Task used to update an element that resumed for a step or evaluation that
- * took too long to suspend.
- */
- private class PendingSuspendTask extends TimerTask {
+ /**
+ * Task used to update an element that resumed for a step or evaluation that
+ * took too long to suspend.
+ */
+ private class PendingSuspendTask extends TimerTask {
- private DebugEvent fEvent;
+ private DebugEvent fEvent;
- private DebugEventHandler fHandler;
+ private DebugEventHandler fHandler;
- /**
- * Resume event for which there is a pending suspend.
- *
- * @param resume
- * event
- */
- public PendingSuspendTask(DebugEventHandler handler, DebugEvent resume) {
- fHandler = handler;
- fEvent = resume;
- }
+ /**
+ * Resume event for which there is a pending suspend.
+ *
+ * @param resume
+ * event
+ */
+ public PendingSuspendTask(DebugEventHandler handler, DebugEvent resume) {
+ fHandler = handler;
+ fEvent = resume;
+ }
- @Override
+ @Override
public void run() {
- synchronized (fPendingSuspends) {
- fPendingSuspends.put(fEvent.getSource(), fEvent);
- }
- dispatchSuspendTimeout(fHandler, fEvent);
- }
+ synchronized (fPendingSuspends) {
+ fPendingSuspends.put(fEvent.getSource(), fEvent);
+ }
+ dispatchSuspendTimeout(fHandler, fEvent);
+ }
- }
+ }
- /**
- * Adds the given handler to this event update policy.
- *
- * @param handler
- */
- protected abstract DebugEventHandler[] createEventHandlers();
+ /**
+ * Adds the given handler to this event update policy.
+ *
+ * @param handler
+ */
+ protected abstract DebugEventHandler[] createEventHandlers();
- @Override
+ @Override
public synchronized void dispose() {
- super.dispose();
- fTimer.cancel();
- fTimerTasks.clear();
- DebugPlugin.getDefault().removeDebugEventListener(this);
- for (int i = 0; i < fHandlers.length; i++) {
- DebugEventHandler handler = fHandlers[i];
- handler.dispose();
- }
- }
+ super.dispose();
+ fTimer.cancel();
+ fTimerTasks.clear();
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ for (int i = 0; i < fHandlers.length; i++) {
+ DebugEventHandler handler = fHandlers[i];
+ handler.dispose();
+ }
+ }
- @Override
+ @Override
public void init(IPresentationContext context) {
- super.init(context);
- DebugPlugin.getDefault().addDebugEventListener(this);
- fHandlers = createEventHandlers();
- }
+ super.init(context);
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ fHandlers = createEventHandlers();
+ }
- @Override
+ @Override
public final void handleDebugEvents(DebugEvent[] events) {
- if (isDisposed()) {
- return;
- }
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (containsEvent(event)) {
- for (int j = 0; j < fHandlers.length; j++) {
- DebugEventHandler handler = fHandlers[j];
- if (isDisposed()) {
- return;
- }
- if (handler.handlesEvent(event)) {
- switch (event.getKind()) {
- case DebugEvent.CREATE:
- dispatchCreate(handler, event);
- break;
- case DebugEvent.TERMINATE:
- dispatchTerminate(handler, event);
- break;
- case DebugEvent.SUSPEND:
- dispatchSuspend(handler, event);
- break;
- case DebugEvent.RESUME:
- dispatchResume(handler, event);
- break;
- case DebugEvent.CHANGE:
- dispatchChange(handler, event);
- break;
- default:
- dispatchOther(handler, event);
- break;
- }
- }
- }
- }
- }
- }
+ if (isDisposed()) {
+ return;
+ }
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event = events[i];
+ if (containsEvent(event)) {
+ for (int j = 0; j < fHandlers.length; j++) {
+ DebugEventHandler handler = fHandlers[j];
+ if (isDisposed()) {
+ return;
+ }
+ if (handler.handlesEvent(event)) {
+ switch (event.getKind()) {
+ case DebugEvent.CREATE:
+ dispatchCreate(handler, event);
+ break;
+ case DebugEvent.TERMINATE:
+ dispatchTerminate(handler, event);
+ break;
+ case DebugEvent.SUSPEND:
+ dispatchSuspend(handler, event);
+ break;
+ case DebugEvent.RESUME:
+ dispatchResume(handler, event);
+ break;
+ case DebugEvent.CHANGE:
+ dispatchChange(handler, event);
+ break;
+ default:
+ dispatchOther(handler, event);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
- /**
- * Returns whether this event handler should process the event.
- *
- * @param event debug event
- * @return whether this event handler should process the event
- */
- protected boolean containsEvent(DebugEvent event) {
- return true;
- }
+ /**
+ * Returns whether this event handler should process the event.
+ *
+ * @param event debug event
+ * @return whether this event handler should process the event
+ */
+ protected boolean containsEvent(DebugEvent event) {
+ return true;
+ }
- /**
- * Dispatches a create event.
- *
- * @param event
- */
- protected void dispatchCreate(DebugEventHandler handler, DebugEvent event) {
- handler.handleCreate(event);
- }
+ /**
+ * Dispatches a create event.
+ *
+ * @param event
+ */
+ protected void dispatchCreate(DebugEventHandler handler, DebugEvent event) {
+ handler.handleCreate(event);
+ }
- /**
- * Dispatches a terminate event.
- *
- * @param event
- */
- protected void dispatchTerminate(DebugEventHandler handler, DebugEvent event) {
- handler.handleTerminate(event);
- }
+ /**
+ * Dispatches a terminate event.
+ *
+ * @param event
+ */
+ protected void dispatchTerminate(DebugEventHandler handler, DebugEvent event) {
+ handler.handleTerminate(event);
+ }
- /**
- * Dispatches a suspend event. Subclasses may override.
- *
- * @param event
- */
- protected void dispatchSuspend(DebugEventHandler handler, DebugEvent event) {
- // stop timer, if any
- synchronized (this) {
- TimerTask task = fTimerTasks.remove(event.getSource());
- if (task != null) {
- task.cancel();
- }
- }
- DebugEvent resume = null;
- synchronized (this) {
- resume = fPendingSuspends.remove(event.getSource());
- }
- if (resume == null) {
- handler.handleSuspend(event);
- } else {
- handler.handleLateSuspend(event, resume);
- }
- }
+ /**
+ * Dispatches a suspend event. Subclasses may override.
+ *
+ * @param event
+ */
+ protected void dispatchSuspend(DebugEventHandler handler, DebugEvent event) {
+ // stop timer, if any
+ synchronized (this) {
+ TimerTask task = fTimerTasks.remove(event.getSource());
+ if (task != null) {
+ task.cancel();
+ }
+ }
+ DebugEvent resume = null;
+ synchronized (this) {
+ resume = fPendingSuspends.remove(event.getSource());
+ }
+ if (resume == null) {
+ handler.handleSuspend(event);
+ } else {
+ handler.handleLateSuspend(event, resume);
+ }
+ }
- /**
- * Dispatches a resume event. By default, if the resume is for an evaluation
- * or a step, a timer is started to update the event source if the step or
- * evaluation takes more than 500ms. Otherwise the source is refreshed.
- * Subclasses may override.
- *
- * @param event
- */
- protected void dispatchResume(DebugEventHandler handler, DebugEvent event) {
- if (event.isEvaluation() || event.isStepStart()) {
- // start a timer to update if the corresponding suspend does not
- // come quickly
- synchronized (this) {
- if (!isDisposed()) {
- PendingSuspendTask task = new PendingSuspendTask(handler, event);
- fTimerTasks.put(event.getSource(), task);
- fTimer.schedule(task, 500);
- }
+ /**
+ * Dispatches a resume event. By default, if the resume is for an evaluation
+ * or a step, a timer is started to update the event source if the step or
+ * evaluation takes more than 500ms. Otherwise the source is refreshed.
+ * Subclasses may override.
+ *
+ * @param event
+ */
+ protected void dispatchResume(DebugEventHandler handler, DebugEvent event) {
+ if (event.isEvaluation() || event.isStepStart()) {
+ // start a timer to update if the corresponding suspend does not
+ // come quickly
+ synchronized (this) {
+ if (!isDisposed()) {
+ PendingSuspendTask task = new PendingSuspendTask(handler, event);
+ fTimerTasks.put(event.getSource(), task);
+ fTimer.schedule(task, 500);
+ }
}
- if (!isDisposed()) {
- handler.handleResumeExpectingSuspend(event);
- }
- } else {
- handler.handleResume(event);
- }
- }
+ if (!isDisposed()) {
+ handler.handleResumeExpectingSuspend(event);
+ }
+ } else {
+ handler.handleResume(event);
+ }
+ }
- /**
- * Dispatches a change event.
- *
- * @param event
- */
- protected void dispatchChange(DebugEventHandler handler, DebugEvent event) {
- handler.handleChange(event);
- }
+ /**
+ * Dispatches a change event.
+ *
+ * @param event
+ */
+ protected void dispatchChange(DebugEventHandler handler, DebugEvent event) {
+ handler.handleChange(event);
+ }
- /**
- * Dispatches an unknown event.
- *
- * @param event
- */
- protected void dispatchOther(DebugEventHandler handler, DebugEvent event) {
- handler.handleOther(event);
- }
+ /**
+ * Dispatches an unknown event.
+ *
+ * @param event
+ */
+ protected void dispatchOther(DebugEventHandler handler, DebugEvent event) {
+ handler.handleOther(event);
+ }
- /**
- * Notification that a pending suspend event was not received for the given
- * resume event and handler within the timeout period.
- *
- * @param resume
- * resume event with missing suspend event
- */
- protected void dispatchSuspendTimeout(DebugEventHandler handler, DebugEvent resume) {
- handler.handleSuspendTimeout(resume);
- }
+ /**
+ * Notification that a pending suspend event was not received for the given
+ * resume event and handler within the timeout period.
+ *
+ * @param resume
+ * resume event with missing suspend event
+ */
+ protected void dispatchSuspendTimeout(DebugEventHandler handler, DebugEvent resume) {
+ handler.handleSuspendTimeout(resume);
+ }
- /**
- * Returns the index of the given element in the list or -1 if
- * not present.
- *
- * @param list
- * @param element
- * @return index or -1 if not present
- */
+ /**
+ * Returns the index of the given element in the list or -1 if
+ * not present.
+ *
+ * @param list
+ * @param element
+ * @return index or -1 if not present
+ */
protected int indexOf(Object[] list, Object element) {
for (int i = 0; i < list.length; i++) {
if (element.equals(list[i])) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionEventHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionEventHandler.java
index b04f1b8ca..99d2b7dd8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionEventHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionEventHandler.java
@@ -31,46 +31,46 @@ import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
*/
public class ExpressionEventHandler extends DebugEventHandler {
- public ExpressionEventHandler(AbstractModelProxy proxy) {
- super(proxy);
- }
+ public ExpressionEventHandler(AbstractModelProxy proxy) {
+ super(proxy);
+ }
- @Override
+ @Override
protected boolean handlesEvent(DebugEvent event) {
- return event.getKind() == DebugEvent.CHANGE;
- }
+ return event.getKind() == DebugEvent.CHANGE;
+ }
- @Override
+ @Override
protected void handleChange(DebugEvent event) {
- ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getExpressionManager(), IModelDelta.NO_CHANGE);
+ ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getExpressionManager(), IModelDelta.NO_CHANGE);
IExpression expression = null;
- if (event.getSource() instanceof IExpression) {
- expression = (IExpression) event.getSource();
- int flags = IModelDelta.NO_CHANGE;
- if ((event.getDetail() & DebugEvent.STATE) != 0) {
- flags = flags | IModelDelta.STATE;
- }
- if ((event.getDetail() & DebugEvent.CONTENT) != 0) {
- flags = flags | IModelDelta.CONTENT;
- }
- delta.addNode(expression, flags);
+ if (event.getSource() instanceof IExpression) {
+ expression = (IExpression) event.getSource();
+ int flags = IModelDelta.NO_CHANGE;
+ if ((event.getDetail() & DebugEvent.STATE) != 0) {
+ flags = flags | IModelDelta.STATE;
+ }
+ if ((event.getDetail() & DebugEvent.CONTENT) != 0) {
+ flags = flags | IModelDelta.CONTENT;
+ }
+ delta.addNode(expression, flags);
fireDelta(delta);
}
- if (event.getSource() instanceof IVariable) {
- IVariable variable = (IVariable) event.getSource();
- int flags = IModelDelta.NO_CHANGE;
- if (event.getDetail()==DebugEvent.CONTENT) {
- flags = flags | IModelDelta.CONTENT;
- }
- delta.addNode(variable, flags);
+ if (event.getSource() instanceof IVariable) {
+ IVariable variable = (IVariable) event.getSource();
+ int flags = IModelDelta.NO_CHANGE;
+ if (event.getDetail()==DebugEvent.CONTENT) {
+ flags = flags | IModelDelta.CONTENT;
+ }
+ delta.addNode(variable, flags);
fireDelta(delta);
}
- }
+ }
- @Override
+ @Override
protected void refreshRoot(DebugEvent event) {
- ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getExpressionManager(), IModelDelta.CONTENT);
- fireDelta(delta);
- }
+ ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getExpressionManager(), IModelDelta.CONTENT);
+ fireDelta(delta);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java
index 91a2fadb8..b5317ed7a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java
@@ -56,7 +56,7 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
@Override
public synchronized void dispose() {
- getPresentationContext().removePropertyChangeListener(this);
+ getPresentationContext().removePropertyChangeListener(this);
super.dispose();
getExpressionManager().removeExpressionListener(this);
}
@@ -64,7 +64,7 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
@Override
public void expressionsMoved(IExpression[] expressions, int index){
int count = getElementsCount();
- ModelDelta delta = new ModelDelta(getExpressionManager(), -1, IModelDelta.NO_CHANGE, count);
+ ModelDelta delta = new ModelDelta(getExpressionManager(), -1, IModelDelta.NO_CHANGE, count);
for (int i = 0; i < expressions.length; i++) {
IExpression expression = expressions[i];
delta.addNode(expression, IModelDelta.REMOVED);
@@ -78,8 +78,8 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
@Override
public void expressionsInserted(IExpression[] expressions, int index){
- int count = getElementsCount();
- ModelDelta delta = new ModelDelta(getExpressionManager(), -1, IModelDelta.NO_CHANGE, count);
+ int count = getElementsCount();
+ ModelDelta delta = new ModelDelta(getExpressionManager(), -1, IModelDelta.NO_CHANGE, count);
for (int i = 0; i < expressions.length; i++) {
IExpression expression = expressions[i];
delta.addNode(expression, index+i, IModelDelta.ADDED | IModelDelta.INSTALL, -1);
@@ -89,14 +89,14 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
@Override
public void expressionsAdded(IExpression[] expressions) {
- int index = getExpressionManager().getExpressions().length - expressions.length;
- int count = getElementsCount();
- ModelDelta delta = new ModelDelta(getExpressionManager(), -1, IModelDelta.NO_CHANGE, count);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
- delta.addNode(expression, index+i, IModelDelta.ADDED | IModelDelta.INSTALL, -1);
- }
- fireModelChanged(delta);
+ int index = getExpressionManager().getExpressions().length - expressions.length;
+ int count = getElementsCount();
+ ModelDelta delta = new ModelDelta(getExpressionManager(), -1, IModelDelta.NO_CHANGE, count);
+ for (int i = 0; i < expressions.length; i++) {
+ IExpression expression = expressions[i];
+ delta.addNode(expression, index+i, IModelDelta.ADDED | IModelDelta.INSTALL, -1);
+ }
+ fireModelChanged(delta);
}
@Override
@@ -109,30 +109,30 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
updateExpressions(expressions, IModelDelta.CONTENT | IModelDelta.STATE);
}
- private void updateExpressions(IExpression[] expressions, int flags) {
+ private void updateExpressions(IExpression[] expressions, int flags) {
ModelDelta delta = new ModelDelta(getExpressionManager(), IModelDelta.NO_CHANGE);
for (int i = 0; i < expressions.length; i++) {
IExpression expression = expressions[i];
delta.addNode(expression, flags);
}
fireModelChanged(delta);
- }
+ }
- private int getElementsCount() {
- // Account for the "Add new expression" element only if columns are
- // displayed.
- return getExpressionManager().getExpressions().length +
- (getPresentationContext().getColumns() != null ? 1 : 0);
- }
+ private int getElementsCount() {
+ // Account for the "Add new expression" element only if columns are
+ // displayed.
+ return getExpressionManager().getExpressions().length +
+ (getPresentationContext().getColumns() != null ? 1 : 0);
+ }
- @Override
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- // If columns are turned on/off, refresh the view to account for the
- // "Add new expression" element.
- if (IPresentationContext.PROPERTY_COLUMNS.equals(event.getProperty())) {
- fireModelChanged(new ModelDelta(getExpressionManager(), IModelDelta.CONTENT));
- }
- }
+ // If columns are turned on/off, refresh the view to account for the
+ // "Add new expression" element.
+ if (IPresentationContext.PROPERTY_COLUMNS.equals(event.getProperty())) {
+ fireModelChanged(new ModelDelta(getExpressionManager(), IModelDelta.CONTENT));
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchProxy.java
index d85e179b0..d7e0e6ae3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchProxy.java
@@ -130,13 +130,13 @@ public class LaunchProxy extends AbstractModelProxy implements ILaunchesListener
}
List<Object> childrenList = Arrays.asList(children);
for (Iterator<Object> itr = fPrevChildren.iterator(); itr.hasNext();) {
- Object child = itr.next();
- if (!childrenList.contains(child)) {
- itr.remove();
- changes = true;
- launchDelta.addNode(child, IModelDelta.UNINSTALL);
- }
- }
+ Object child = itr.next();
+ if (!childrenList.contains(child)) {
+ itr.remove();
+ changes = true;
+ launchDelta.addNode(child, IModelDelta.UNINSTALL);
+ }
+ }
}
if (changes) {
fireModelChanged(root);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java
index 1b8132e76..27977d576 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ProcessProxy.java
@@ -24,23 +24,23 @@ import org.eclipse.jface.viewers.Viewer;
public class ProcessProxy extends EventHandlerModelProxy {
- private IProcess fProcess;
+ private IProcess fProcess;
- private DebugEventHandler fProcessEventHandler = new DebugEventHandler(this) {
- @Override
+ private DebugEventHandler fProcessEventHandler = new DebugEventHandler(this) {
+ @Override
protected boolean handlesEvent(DebugEvent event) {
- return event.getSource().equals(fProcess);
- }
+ return event.getSource().equals(fProcess);
+ }
@Override
protected void handleChange(DebugEvent event) {
fireProcessDelta(IModelDelta.STATE);
- }
+ }
- @Override
+ @Override
protected void handleCreate(DebugEvent event) {
- // do nothing - Launch change notification handles this
- }
+ // do nothing - Launch change notification handles this
+ }
@Override
protected void handleTerminate(DebugEvent event) {
@@ -48,22 +48,22 @@ public class ProcessProxy extends EventHandlerModelProxy {
}
- };
+ };
- private void fireProcessDelta(int flags) {
- ModelDelta delta = null;
- synchronized (ProcessProxy.this) {
- if (!isDisposed()) {
- delta = new ModelDelta(DebugPlugin.getDefault().getLaunchManager(), IModelDelta.NO_CHANGE);
- ModelDelta node = delta;
- node = node.addNode(fProcess.getLaunch(), IModelDelta.NO_CHANGE);
- node.addNode(fProcess, flags);
- }
- }
- if (delta != null && !isDisposed()) {
- fireModelChanged(delta);
- }
- }
+ private void fireProcessDelta(int flags) {
+ ModelDelta delta = null;
+ synchronized (ProcessProxy.this) {
+ if (!isDisposed()) {
+ delta = new ModelDelta(DebugPlugin.getDefault().getLaunchManager(), IModelDelta.NO_CHANGE);
+ ModelDelta node = delta;
+ node = node.addNode(fProcess.getLaunch(), IModelDelta.NO_CHANGE);
+ node.addNode(fProcess, flags);
+ }
+ }
+ if (delta != null && !isDisposed()) {
+ fireModelChanged(delta);
+ }
+ }
@Override
public synchronized void dispose() {
@@ -72,18 +72,18 @@ public class ProcessProxy extends EventHandlerModelProxy {
}
public ProcessProxy(IProcess process) {
- fProcess = process;
- }
+ fProcess = process;
+ }
- @Override
+ @Override
protected synchronized boolean containsEvent(DebugEvent event) {
- return event.getSource().equals(fProcess);
- }
+ return event.getSource().equals(fProcess);
+ }
- @Override
+ @Override
protected DebugEventHandler[] createEventHandlers() {
- return new DebugEventHandler[] {fProcessEventHandler};
- }
+ return new DebugEventHandler[] {fProcessEventHandler};
+ }
@Override
public void installed(Viewer viewer) {
@@ -91,18 +91,18 @@ public class ProcessProxy extends EventHandlerModelProxy {
// select process if in run mode
IProcess process = fProcess;
if (process != null) {
- if (process.isTerminated()) {
- fireProcessDelta(IModelDelta.UNINSTALL);
- } else {
- ILaunch launch = process.getLaunch();
- if (launch != null && ILaunchManager.RUN_MODE.equals(launch.getLaunchMode())) {
- // select the process
- ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getLaunchManager(), IModelDelta.NO_CHANGE);
- ModelDelta node = delta.addNode(process.getLaunch(), IModelDelta.NO_CHANGE);
- node = node.addNode(process, IModelDelta.SELECT);
- fireModelChanged(delta);
- }
- }
+ if (process.isTerminated()) {
+ fireProcessDelta(IModelDelta.UNINSTALL);
+ } else {
+ ILaunch launch = process.getLaunch();
+ if (launch != null && ILaunchManager.RUN_MODE.equals(launch.getLaunchMode())) {
+ // select the process
+ ModelDelta delta = new ModelDelta(DebugPlugin.getDefault().getLaunchManager(), IModelDelta.NO_CHANGE);
+ ModelDelta node = delta.addNode(process.getLaunch(), IModelDelta.NO_CHANGE);
+ node = node.addNode(process, IModelDelta.SELECT);
+ fireModelChanged(delta);
+ }
+ }
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java
index 07e80d2a2..a1f43d5a3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ThreadEventHandler.java
@@ -65,48 +65,48 @@ public class ThreadEventHandler extends DebugEventHandler {
@Override
protected void handleSuspend(DebugEvent event) {
- IThread thread = (IThread) event.getSource();
+ IThread thread = (IThread) event.getSource();
if (event.isEvaluation()) {
- ModelDelta delta = buildRootDelta();
- ModelDelta node = addPathToThread(delta, thread);
+ ModelDelta delta = buildRootDelta();
+ ModelDelta node = addPathToThread(delta, thread);
node = node.addNode(thread, IModelDelta.STATE);
try {
IStackFrame frame = thread.getTopStackFrame();
- if (frame != null) {
- int flag = IModelDelta.NO_CHANGE;
- if (event.getDetail() == DebugEvent.EVALUATION) {
- // explicit evaluations can change content
- flag = flag | IModelDelta.CONTENT;
- } else if (event.getDetail() == DebugEvent.EVALUATION_IMPLICIT) {
- // implicit evaluations can change state
- flag = flag | IModelDelta.STATE;
- }
- node.addNode(frame, flag);
- fireDelta(delta);
- }
+ if (frame != null) {
+ int flag = IModelDelta.NO_CHANGE;
+ if (event.getDetail() == DebugEvent.EVALUATION) {
+ // explicit evaluations can change content
+ flag = flag | IModelDelta.CONTENT;
+ } else if (event.getDetail() == DebugEvent.EVALUATION_IMPLICIT) {
+ // implicit evaluations can change state
+ flag = flag | IModelDelta.STATE;
+ }
+ node.addNode(frame, flag);
+ fireDelta(delta);
+ }
} catch (DebugException e) {
}
- } else {
- queueSuspendedThread(event);
- int extras = IModelDelta.STATE;
- switch (event.getDetail()) {
- case DebugEvent.BREAKPOINT:
- // on breakpoint also position thread to be top element
- extras = IModelDelta.EXPAND | IModelDelta.REVEAL;
- break;
- case DebugEvent.CLIENT_REQUEST:
- extras = IModelDelta.EXPAND;
- break;
+ } else {
+ queueSuspendedThread(event);
+ int extras = IModelDelta.STATE;
+ switch (event.getDetail()) {
+ case DebugEvent.BREAKPOINT:
+ // on breakpoint also position thread to be top element
+ extras = IModelDelta.EXPAND | IModelDelta.REVEAL;
+ break;
+ case DebugEvent.CLIENT_REQUEST:
+ extras = IModelDelta.EXPAND;
+ break;
default:
break;
- }
+ }
// wait until initialization is completed before sending suspend
// event, see bug 491174 comment 1
waitForProxyInitialization();
- fireDeltaUpdatingSelectedFrame(thread, IModelDelta.NO_CHANGE | extras, event);
- }
+ fireDeltaUpdatingSelectedFrame(thread, IModelDelta.NO_CHANGE | extras, event);
+ }
}
private void waitForProxyInitialization() {
@@ -175,20 +175,20 @@ public class ThreadEventHandler extends DebugEventHandler {
IThread thread = queueSuspendedThread(suspend);
if (suspend.isEvaluation() && suspend.getDetail() == DebugEvent.EVALUATION_IMPLICIT) {
// late implicit evaluation - update thread and frame
- ModelDelta delta = buildRootDelta();
- ModelDelta node = addPathToThread(delta, thread);
- node = node.addNode(thread, IModelDelta.STATE);
+ ModelDelta delta = buildRootDelta();
+ ModelDelta node = addPathToThread(delta, thread);
+ node = node.addNode(thread, IModelDelta.STATE);
try {
IStackFrame frame = thread.getTopStackFrame();
- if (frame != null) {
- node.addNode(frame, IModelDelta.STATE);
- fireDelta(delta);
- }
+ if (frame != null) {
+ node.addNode(frame, IModelDelta.STATE);
+ fireDelta(delta);
+ }
} catch (DebugException e) {
}
- } else {
- fireDeltaUpdatingSelectedFrame(thread, IModelDelta.STATE | IModelDelta.EXPAND, suspend);
- }
+ } else {
+ fireDeltaUpdatingSelectedFrame(thread, IModelDelta.STATE | IModelDelta.EXPAND, suspend);
+ }
}
@Override
@@ -244,11 +244,11 @@ public class ThreadEventHandler extends DebugEventHandler {
private void fireDeltaUpdatingSelectedFrame(IThread thread, int flags, DebugEvent event) {
ModelDelta delta = buildRootDelta();
ModelDelta node = addPathToThread(delta, thread);
- IStackFrame prev = null;
- synchronized (this) {
- prev = fLastTopFrame.get(thread);
+ IStackFrame prev = null;
+ synchronized (this) {
+ prev = fLastTopFrame.get(thread);
}
- IStackFrame frame = null;
+ IStackFrame frame = null;
try {
Object frameToSelect = event.getData();
if (frameToSelect == null || !(frameToSelect instanceof IStackFrame)) {
@@ -260,9 +260,9 @@ public class ThreadEventHandler extends DebugEventHandler {
}
int threadIndex = indexOf(thread);
int childCount = childCount(thread);
- if (isEqual(frame, prev)) {
- if (frame == null) {
- if (thread.isSuspended()) {
+ if (isEqual(frame, prev)) {
+ if (frame == null) {
+ if (thread.isSuspended()) {
// try retrieving the top frame again, in case we ran into an evaluation earlier
try {
frame = thread.getTopStackFrame();
@@ -275,31 +275,31 @@ public class ThreadEventHandler extends DebugEventHandler {
} else {
node = node.addNode(thread, threadIndex, flags, childCount);
}
- }
- } else {
- node = node.addNode(thread, threadIndex, flags, childCount);
- }
- } else {
- if (event.getDetail() == DebugEvent.STEP_END) {
- if (prev == null) {
- // see bug 166602 - expand the thread if this is a step end with no previous top frame
- flags = flags | IModelDelta.EXPAND;
- } else if (frame == null) {
- // there was a previous frame and current is null on a step: transient state
- return;
- }
- }
+ }
+ } else {
+ node = node.addNode(thread, threadIndex, flags, childCount);
+ }
+ } else {
+ if (event.getDetail() == DebugEvent.STEP_END) {
+ if (prev == null) {
+ // see bug 166602 - expand the thread if this is a step end with no previous top frame
+ flags = flags | IModelDelta.EXPAND;
+ } else if (frame == null) {
+ // there was a previous frame and current is null on a step: transient state
+ return;
+ }
+ }
node = node.addNode(thread, threadIndex, flags | IModelDelta.CONTENT, childCount);
- }
- if (frame != null) {
- node.addNode(frame, indexOf(frame), IModelDelta.STATE | IModelDelta.SELECT, childCount(frame));
- }
- synchronized (this) {
- if (!isDisposed()) {
- fLastTopFrame.put(thread, frame);
- }
}
- fireDelta(delta);
+ if (frame != null) {
+ node.addNode(frame, indexOf(frame), IModelDelta.STATE | IModelDelta.SELECT, childCount(frame));
+ }
+ synchronized (this) {
+ if (!isDisposed()) {
+ fLastTopFrame.put(thread, frame);
+ }
+ }
+ fireDelta(delta);
}
/**
@@ -357,8 +357,8 @@ public class ThreadEventHandler extends DebugEventHandler {
private void fireDeltaUpdatingThread(IThread thread, int flags) {
ModelDelta delta = buildRootDelta();
ModelDelta node = addPathToThread(delta, thread);
- node = node.addNode(thread, flags);
- fireDelta(delta);
+ node = node.addNode(thread, flags);
+ fireDelta(delta);
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
index 95297e202..614c027b5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
@@ -46,7 +46,7 @@ public class DebugUIViewsMessages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, DebugUIViewsMessages.class);
}
- public static String InspectPopupDialog_0;
+ public static String InspectPopupDialog_0;
- public static String InspectPopupDialog_1;
+ public static String InspectPopupDialog_1;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
index 62def7381..d779b026d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
@@ -95,11 +95,11 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
*/
private Set<String> fEnabledPerspectives = new HashSet<>();
- /**
- * Whether to ignore perspective change call backs (set to
- * true when this class is modifying views).
- */
- private boolean fIgnoreChanges = false;
+ /**
+ * Whether to ignore perspective change call backs (set to
+ * true when this class is modifying views).
+ */
+ private boolean fIgnoreChanges = false;
/**
* The window this service is working for
@@ -123,193 +123,193 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
private static final String ID_CONTEXT_VIEW_BINDINGS= "contextViewBindings"; //$NON-NLS-1$
// extension elements
- private static final String ELEM_CONTEXT_VIEW_BINDING= "contextViewBinding"; //$NON-NLS-1$
- private static final String ELEM_PERSPECTIVE= "perspective"; //$NON-NLS-1$
+ private static final String ELEM_CONTEXT_VIEW_BINDING= "contextViewBinding"; //$NON-NLS-1$
+ private static final String ELEM_PERSPECTIVE= "perspective"; //$NON-NLS-1$
// extension attributes
private static final String ATTR_CONTEXT_ID= "contextId"; //$NON-NLS-1$
private static final String ATTR_VIEW_ID= "viewId"; //$NON-NLS-1$
private static final String ATTR_AUTO_OPEN= "autoOpen"; //$NON-NLS-1$
private static final String ATTR_AUTO_CLOSE= "autoClose"; //$NON-NLS-1$
- private static final String ATTR_PERSPECTIVE_ID= "perspectiveId"; //$NON-NLS-1$
-
- // XML tags
- private static final String XML_ELEMENT_VIEW_BINDINGS ="viewBindings"; //$NON-NLS-1$
- private static final String XML_ELEMENT_PERSPECTIVE ="perspective"; //$NON-NLS-1$
- private static final String XML_ELEMENT_VIEW = "view"; //$NON-NLS-1$
- private static final String XML_ATTR_ID = "id"; //$NON-NLS-1$
- private static final String XML_ATTR_USER_ACTION = "userAction"; //$NON-NLS-1$
- private static final String XML_VALUE_OPENED = "opened"; //$NON-NLS-1$
- private static final String XML_VALUE_CLOSED = "closed"; //$NON-NLS-1$
-
- // ids of base debug views in debug perspective that should not be auto-closed
+ private static final String ATTR_PERSPECTIVE_ID= "perspectiveId"; //$NON-NLS-1$
+
+ // XML tags
+ private static final String XML_ELEMENT_VIEW_BINDINGS ="viewBindings"; //$NON-NLS-1$
+ private static final String XML_ELEMENT_PERSPECTIVE ="perspective"; //$NON-NLS-1$
+ private static final String XML_ELEMENT_VIEW = "view"; //$NON-NLS-1$
+ private static final String XML_ATTR_ID = "id"; //$NON-NLS-1$
+ private static final String XML_ATTR_USER_ACTION = "userAction"; //$NON-NLS-1$
+ private static final String XML_VALUE_OPENED = "opened"; //$NON-NLS-1$
+ private static final String XML_VALUE_CLOSED = "closed"; //$NON-NLS-1$
+
+ // ids of base debug views in debug perspective that should not be auto-closed
private static Set<String> fgBaseDebugViewIds = null;
- static {
+ static {
fgBaseDebugViewIds = new HashSet<>();
- fgBaseDebugViewIds.add(IDebugUIConstants.ID_DEBUG_VIEW);
- fgBaseDebugViewIds.add(IDebugUIConstants.ID_VARIABLE_VIEW);
- fgBaseDebugViewIds.add(IDebugUIConstants.ID_BREAKPOINT_VIEW);
- fgBaseDebugViewIds.add(IConsoleConstants.ID_CONSOLE_VIEW);
- }
+ fgBaseDebugViewIds.add(IDebugUIConstants.ID_DEBUG_VIEW);
+ fgBaseDebugViewIds.add(IDebugUIConstants.ID_VARIABLE_VIEW);
+ fgBaseDebugViewIds.add(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ fgBaseDebugViewIds.add(IConsoleConstants.ID_CONSOLE_VIEW);
+ }
- private static String[] EMPTY_IDS = new String[0];
+ private static String[] EMPTY_IDS = new String[0];
- /**
- * View bindings for a debug context
- */
- private class DebugContextViewBindings {
+ /**
+ * View bindings for a debug context
+ */
+ private class DebugContextViewBindings {
- // context id
- private final String fId;
+ // context id
+ private final String fId;
- // list of view bindings id's specific to this context
- private String[] fViewBindingIds = EMPTY_IDS;
+ // list of view bindings id's specific to this context
+ private String[] fViewBindingIds = EMPTY_IDS;
- // all bindings including inherited bindings, top down in activation order
- private String[] fAllViewBindingIds = null;
- // associated binding to activate
+ // all bindings including inherited bindings, top down in activation order
+ private String[] fAllViewBindingIds = null;
+ // associated binding to activate
private final Map<String, ViewBinding> fAllViewIdToBindings = new HashMap<>();
- // all context id's in this context hierarchy (top down order)
- private String[] fAllConetxtIds = null;
-
- // id of parent context
- private String fParentId;
-
- /**
- * Constructs an empty view binding for the given context.
- *
- * @param id context id
- */
- public DebugContextViewBindings(String id) {
- fId = id;
- }
-
- /**
- * Returns the context id for these view bindings
- *
- * @return context id
- */
- public String getId() {
- return fId;
- }
-
- /**
- * Adds the given view binding to this context
- *
- * @param binding view binding to add
- */
- public void addBinding(ViewBinding binding) {
- String[] newBindings = new String[fViewBindingIds.length + 1];
- System.arraycopy(fViewBindingIds, 0, newBindings, 0, fViewBindingIds.length);
- newBindings[fViewBindingIds.length] = binding.getViewId();
- fAllViewIdToBindings.put(binding.getViewId(), binding);
- fViewBindingIds = newBindings;
- }
-
- /**
- * Sets the parent id of this view bindings
- *
- * @param id parent context id
- */
- protected void setParentId(String id) {
- fParentId = id;
- }
-
- /**
- * Returns the id of parent context
- *
- * @return parent context id
- */
- public DebugContextViewBindings getParentContext() {
- if (fParentId == null) {
- return null;
- }
- return fContextIdsToBindings.get(fParentId);
- }
-
- /**
- * Activates the views in this context hierarchy. Views are activated top down, allowing
- * sub-contexts to override settings in a parent context.
- * @param page the page context
- * @param perspective the perspective description
- * @param allViewIds that are relevant to the chain activation.
- */
+ // all context id's in this context hierarchy (top down order)
+ private String[] fAllConetxtIds = null;
+
+ // id of parent context
+ private String fParentId;
+
+ /**
+ * Constructs an empty view binding for the given context.
+ *
+ * @param id context id
+ */
+ public DebugContextViewBindings(String id) {
+ fId = id;
+ }
+
+ /**
+ * Returns the context id for these view bindings
+ *
+ * @return context id
+ */
+ public String getId() {
+ return fId;
+ }
+
+ /**
+ * Adds the given view binding to this context
+ *
+ * @param binding view binding to add
+ */
+ public void addBinding(ViewBinding binding) {
+ String[] newBindings = new String[fViewBindingIds.length + 1];
+ System.arraycopy(fViewBindingIds, 0, newBindings, 0, fViewBindingIds.length);
+ newBindings[fViewBindingIds.length] = binding.getViewId();
+ fAllViewIdToBindings.put(binding.getViewId(), binding);
+ fViewBindingIds = newBindings;
+ }
+
+ /**
+ * Sets the parent id of this view bindings
+ *
+ * @param id parent context id
+ */
+ protected void setParentId(String id) {
+ fParentId = id;
+ }
+
+ /**
+ * Returns the id of parent context
+ *
+ * @return parent context id
+ */
+ public DebugContextViewBindings getParentContext() {
+ if (fParentId == null) {
+ return null;
+ }
+ return fContextIdsToBindings.get(fParentId);
+ }
+
+ /**
+ * Activates the views in this context hierarchy. Views are activated top down, allowing
+ * sub-contexts to override settings in a parent context.
+ * @param page the page context
+ * @param perspective the perspective description
+ * @param allViewIds that are relevant to the chain activation.
+ */
public void activateChain(IWorkbenchPage page, IPerspectiveDescriptor perspective, Set<String> allViewIds) {
- initializeChain();
- doActivation(page, perspective, allViewIds, fAllConetxtIds);
- }
-
- public String[] getAllViewBindingsIds() {
- initializeChain();
- return fAllViewBindingIds;
- }
-
- /**
- * Activates the view bindings for the specified views and the
- * specified contexts in the given page.
- *
- * @param page page to activate views in
- * @param perspective the perspective description
- * @param allViewIds id's of all the views that are relevant in this context activation
- * @param contextIds associated contexts that are activated
- */
+ initializeChain();
+ doActivation(page, perspective, allViewIds, fAllConetxtIds);
+ }
+
+ public String[] getAllViewBindingsIds() {
+ initializeChain();
+ return fAllViewBindingIds;
+ }
+
+ /**
+ * Activates the view bindings for the specified views and the
+ * specified contexts in the given page.
+ *
+ * @param page page to activate views in
+ * @param perspective the perspective description
+ * @param allViewIds id's of all the views that are relevant in this context activation
+ * @param contextIds associated contexts that are activated
+ */
private void doActivation(IWorkbenchPage page, IPerspectiveDescriptor perspective, Set<String> allViewIds, String[] contextIds) {
- // note activation of all the relevant contexts
- for (int i = 0; i < contextIds.length; i++) {
+ // note activation of all the relevant contexts
+ for (int i = 0; i < contextIds.length; i++) {
addActivated(contextIds[i]);
}
- // set the active context to be this
- setActive(perspective, getId());
- // activate the view bindings and bring most relevant views to top
- for (int i = 0; i < fAllViewBindingIds.length; i++) {
+ // set the active context to be this
+ setActive(perspective, getId());
+ // activate the view bindings and bring most relevant views to top
+ for (int i = 0; i < fAllViewBindingIds.length; i++) {
String viewId = fAllViewBindingIds[i];
ViewBinding binding = fAllViewIdToBindings.get(viewId);
binding.activated(page, perspective);
- binding.checkZOrder(page, allViewIds);
+ binding.checkZOrder(page, allViewIds);
}
- }
-
- /**
- * Builds the top down ordered list of bindings for this context allowing sub-contexts
- * to override parent settings.
- */
- private synchronized void initializeChain() {
- if (fAllViewBindingIds == null) {
+ }
+
+ /**
+ * Builds the top down ordered list of bindings for this context allowing sub-contexts
+ * to override parent settings.
+ */
+ private synchronized void initializeChain() {
+ if (fAllViewBindingIds == null) {
List<String> orderedIds = new ArrayList<>();
List<DebugContextViewBindings> contexts = new ArrayList<>();
- DebugContextViewBindings context = this;
- while (context != null) {
- contexts.add(0, context);
- context = context.getParentContext();
- }
- fAllConetxtIds = new String[contexts.size()];
- int pos = 0;
+ DebugContextViewBindings context = this;
+ while (context != null) {
+ contexts.add(0, context);
+ context = context.getParentContext();
+ }
+ fAllConetxtIds = new String[contexts.size()];
+ int pos = 0;
for (DebugContextViewBindings bindings : contexts) {
- fAllConetxtIds[pos] = bindings.getId();
- pos++;
- for (int i = 0; i < bindings.fViewBindingIds.length; i++) {
+ fAllConetxtIds[pos] = bindings.getId();
+ pos++;
+ for (int i = 0; i < bindings.fViewBindingIds.length; i++) {
String viewId = bindings.fViewBindingIds[i];
- if (bindings == this) {
- orderedIds.add(viewId);
- }
- if (!fAllViewIdToBindings.containsKey(viewId)) {
- orderedIds.add(viewId);
- fAllViewIdToBindings.put(viewId, bindings.fAllViewIdToBindings.get(viewId));
- }
+ if (bindings == this) {
+ orderedIds.add(viewId);
+ }
+ if (!fAllViewIdToBindings.containsKey(viewId)) {
+ orderedIds.add(viewId);
+ fAllViewIdToBindings.put(viewId, bindings.fAllViewIdToBindings.get(viewId));
+ }
}
- }
- fAllViewBindingIds = orderedIds.toArray(new String[orderedIds.size()]);
- }
- }
-
- /**
- * Deactivates this context only (not parents)
- *
- * @param page workbench page
- * @param perspective the perspective description
- */
- public void deactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ }
+ fAllViewBindingIds = orderedIds.toArray(new String[orderedIds.size()]);
+ }
+ }
+
+ /**
+ * Deactivates this context only (not parents)
+ *
+ * @param page workbench page
+ * @param perspective the perspective description
+ */
+ public void deactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
removeActivated(getId());
if (isActiveContext(getId())) {
setActive(page.getPerspective(), null);
@@ -319,211 +319,211 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
ViewBinding binding = fAllViewIdToBindings.get(viewId);
binding.deactivated(page, perspective);
}
- }
-
- /**
- * Notes when a view is opened/closed manually.
- *
- * @param opened opened or closed
- * @param viewId the view identifier
- */
- public void setViewOpened(boolean opened, String viewId) {
- initializeChain();
- ViewBinding binding = fAllViewIdToBindings.get(viewId);
- if (binding != null) {
- if (opened) {
- binding.userOpened();
- } else {
- binding.userClosed();
- }
- }
- }
-
- public void applyUserSettings(String viewId, Element viewElement) {
- initializeChain();
- ViewBinding binding = fAllViewIdToBindings.get(viewId);
- if (binding != null) {
- binding.applyUserSettings(viewElement);
- }
- }
-
- /**
- * Save view binding settings into XML document.
- *
- * @param document the document to save to
- * @param root the root XML element
- * @param alreadyDone views already done
- */
+ }
+
+ /**
+ * Notes when a view is opened/closed manually.
+ *
+ * @param opened opened or closed
+ * @param viewId the view identifier
+ */
+ public void setViewOpened(boolean opened, String viewId) {
+ initializeChain();
+ ViewBinding binding = fAllViewIdToBindings.get(viewId);
+ if (binding != null) {
+ if (opened) {
+ binding.userOpened();
+ } else {
+ binding.userClosed();
+ }
+ }
+ }
+
+ public void applyUserSettings(String viewId, Element viewElement) {
+ initializeChain();
+ ViewBinding binding = fAllViewIdToBindings.get(viewId);
+ if (binding != null) {
+ binding.applyUserSettings(viewElement);
+ }
+ }
+
+ /**
+ * Save view binding settings into XML document.
+ *
+ * @param document the document to save to
+ * @param root the root XML element
+ * @param alreadyDone views already done
+ */
public void saveBindings(Document document, Element root, Set<String> alreadyDone) {
- for (int i = 0; i < fViewBindingIds.length; i++) {
+ for (int i = 0; i < fViewBindingIds.length; i++) {
String viewId = fViewBindingIds[i];
- if (!alreadyDone.contains(viewId)) {
- alreadyDone.add(viewId);
- ViewBinding binding = fAllViewIdToBindings.get(viewId);
- binding.saveBindings(document, root);
- }
+ if (!alreadyDone.contains(viewId)) {
+ alreadyDone.add(viewId);
+ ViewBinding binding = fAllViewIdToBindings.get(viewId);
+ binding.saveBindings(document, root);
+ }
}
- }
- }
-
- /**
- * Information for a view
- */
- private class ViewBinding {
- private final IConfigurationElement fElement;
- /**
- * Set of perspectives this view was opened in by the user
- */
+ }
+ }
+
+ /**
+ * Information for a view
+ */
+ private class ViewBinding {
+ private final IConfigurationElement fElement;
+ /**
+ * Set of perspectives this view was opened in by the user
+ */
private final Set<String> fUserOpened = new HashSet<>();
- /**
- * Set of perspectives this view was closed in by the user
- */
+ /**
+ * Set of perspectives this view was closed in by the user
+ */
private final Set<String> fUserClosed = new HashSet<>();
- /**
- * Set of perspectives this view was auto-opened by view management.
- */
+ /**
+ * Set of perspectives this view was auto-opened by view management.
+ */
private final Set<String> fAutoOpened = new HashSet<>();
- public ViewBinding(IConfigurationElement element) {
- fElement = element;
- }
-
- /**
- * Returns the id of the view this binding pertains to.
- *
- * @return the id of the view
- */
- public String getViewId() {
- return fElement.getAttribute(ATTR_VIEW_ID);
- }
-
- /**
- * Returns whether this view binding is set for auto-open.
- *
- * @return if the view is set to auto-open
- */
- public boolean isAutoOpen() {
- String autoopen = fElement.getAttribute(ATTR_AUTO_OPEN);
- return autoopen == null || "true".equals(autoopen); //$NON-NLS-1$
- }
-
- /**
- * Returns whether this view binding is set for auto-close.
- *
- * @return if the view is set to auto-close
- */
- public boolean isAutoClose() {
- String autoclose = fElement.getAttribute(ATTR_AUTO_CLOSE);
- return autoclose == null || "true".equals(autoclose); //$NON-NLS-1$
- }
-
- /**
- * Returns whether this view was opened by the user in the active perspective.
- * @param perspective the perspective description
- * @return if this view was opened by the user
- */
- public boolean isUserOpened(IPerspectiveDescriptor perspective) {
- return fUserOpened.contains(perspective.getId());
- }
-
- /**
- * Returns whether this view was closed by the user in the active perspective
- * @param perspective the description of the perspective
- * @return if this view was closed by the user in the active perspective
- */
- public boolean isUserClosed(IPerspectiveDescriptor perspective) {
- return fUserClosed.contains(getActivePerspective().getId());
- }
-
- /**
- * Returns whether this view is part of the active perspective by default
- *
- * TODO: we really need an API to determine which views are
- * in a perspective by default, but it does not seem to exist.
- * @param perspective the description of the perspective
- * @return if this view is part of the active perspective by default
- */
- public boolean isDefault(IPerspectiveDescriptor perspective) {
- String id = perspective.getId();
- if (IDebugUIConstants.ID_DEBUG_PERSPECTIVE.equals(id)) {
- return fgBaseDebugViewIds.contains(getViewId());
- }
- return false;
- }
-
- protected void userOpened() {
- if (isTrackingViews()) {
- String id = getActivePerspective().getId();
- fAutoOpened.remove(id);
- fUserOpened.add(id);
- fUserClosed.remove(id);
- saveViewBindings();
- }
- }
-
- protected void userClosed() {
- if (isTrackingViews()) {
- String id = getActivePerspective().getId();
- fAutoOpened.remove(id);
- fUserClosed.add(id);
- fUserOpened.remove(id);
- saveViewBindings();
- }
- }
-
- /**
- * Returns whether the preference is set to track user view open/close.
- *
- * @return if the service is set to track user view open/close
- */
- protected boolean isTrackingViews() {
- return DebugUITools.getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TRACK_VIEWS);
- }
-
- /**
- * Context has been activated, open/show as required.
- *
- * @param page the workbench page
- * @param perspective the perspective description
- */
- public void activated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- if (!isUserClosed(perspective)) {
- if (isAutoOpen()) {
- try {
- fIgnoreChanges = true;
- // Remember whether the view was opened by view management.
- // (Bug 128065)
- if (page.findViewReference(getViewId()) == null) {
- fAutoOpened.add(perspective.getId());
- }
- page.showView(getViewId(), null, IWorkbenchPage.VIEW_CREATE);
- } catch (PartInitException e) {
- DebugUIPlugin.log(e);
- } finally {
- fIgnoreChanges = false;
- }
- }
- }
- }
-
- /**
- * Context has been activated. Check the view stack to see if this view
- * should be made visible.
- *
- * @param page the page to check
- * @param relevantViews the array of view identifiers
- */
+ public ViewBinding(IConfigurationElement element) {
+ fElement = element;
+ }
+
+ /**
+ * Returns the id of the view this binding pertains to.
+ *
+ * @return the id of the view
+ */
+ public String getViewId() {
+ return fElement.getAttribute(ATTR_VIEW_ID);
+ }
+
+ /**
+ * Returns whether this view binding is set for auto-open.
+ *
+ * @return if the view is set to auto-open
+ */
+ public boolean isAutoOpen() {
+ String autoopen = fElement.getAttribute(ATTR_AUTO_OPEN);
+ return autoopen == null || "true".equals(autoopen); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns whether this view binding is set for auto-close.
+ *
+ * @return if the view is set to auto-close
+ */
+ public boolean isAutoClose() {
+ String autoclose = fElement.getAttribute(ATTR_AUTO_CLOSE);
+ return autoclose == null || "true".equals(autoclose); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns whether this view was opened by the user in the active perspective.
+ * @param perspective the perspective description
+ * @return if this view was opened by the user
+ */
+ public boolean isUserOpened(IPerspectiveDescriptor perspective) {
+ return fUserOpened.contains(perspective.getId());
+ }
+
+ /**
+ * Returns whether this view was closed by the user in the active perspective
+ * @param perspective the description of the perspective
+ * @return if this view was closed by the user in the active perspective
+ */
+ public boolean isUserClosed(IPerspectiveDescriptor perspective) {
+ return fUserClosed.contains(getActivePerspective().getId());
+ }
+
+ /**
+ * Returns whether this view is part of the active perspective by default
+ *
+ * TODO: we really need an API to determine which views are
+ * in a perspective by default, but it does not seem to exist.
+ * @param perspective the description of the perspective
+ * @return if this view is part of the active perspective by default
+ */
+ public boolean isDefault(IPerspectiveDescriptor perspective) {
+ String id = perspective.getId();
+ if (IDebugUIConstants.ID_DEBUG_PERSPECTIVE.equals(id)) {
+ return fgBaseDebugViewIds.contains(getViewId());
+ }
+ return false;
+ }
+
+ protected void userOpened() {
+ if (isTrackingViews()) {
+ String id = getActivePerspective().getId();
+ fAutoOpened.remove(id);
+ fUserOpened.add(id);
+ fUserClosed.remove(id);
+ saveViewBindings();
+ }
+ }
+
+ protected void userClosed() {
+ if (isTrackingViews()) {
+ String id = getActivePerspective().getId();
+ fAutoOpened.remove(id);
+ fUserClosed.add(id);
+ fUserOpened.remove(id);
+ saveViewBindings();
+ }
+ }
+
+ /**
+ * Returns whether the preference is set to track user view open/close.
+ *
+ * @return if the service is set to track user view open/close
+ */
+ protected boolean isTrackingViews() {
+ return DebugUITools.getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TRACK_VIEWS);
+ }
+
+ /**
+ * Context has been activated, open/show as required.
+ *
+ * @param page the workbench page
+ * @param perspective the perspective description
+ */
+ public void activated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ if (!isUserClosed(perspective)) {
+ if (isAutoOpen()) {
+ try {
+ fIgnoreChanges = true;
+ // Remember whether the view was opened by view management.
+ // (Bug 128065)
+ if (page.findViewReference(getViewId()) == null) {
+ fAutoOpened.add(perspective.getId());
+ }
+ page.showView(getViewId(), null, IWorkbenchPage.VIEW_CREATE);
+ } catch (PartInitException e) {
+ DebugUIPlugin.log(e);
+ } finally {
+ fIgnoreChanges = false;
+ }
+ }
+ }
+ }
+
+ /**
+ * Context has been activated. Check the view stack to see if this view
+ * should be made visible.
+ *
+ * @param page the page to check
+ * @param relevantViews the array of view identifiers
+ */
public void checkZOrder(IWorkbenchPage page, Set<String> relevantViews) {
- // see if view is open already
- String viewId = getViewId();
+ // see if view is open already
+ String viewId = getViewId();
IViewPart part = page.findView(viewId);
- if (part != null) {
- IViewPart[] viewStack = page.getViewStack(part);
- if (viewStack != null && viewStack.length > 0) {
- String top = viewStack[0].getSite().getId();
- if (relevantViews.contains(top)) {
- return;
- }
+ if (part != null) {
+ IViewPart[] viewStack = page.getViewStack(part);
+ if (viewStack != null && viewStack.length > 0) {
+ String top = viewStack[0].getSite().getId();
+ if (relevantViews.contains(top)) {
+ return;
+ }
// Don't bring a minimized or fast view to front
IViewReference partRef = page.findViewReference(viewId);
@@ -531,93 +531,93 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
return;
}
- // an irrelevant view is visible
- try {
- fIgnoreChanges = true;
- page.bringToTop(part);
- } finally {
- fIgnoreChanges = false;
- }
- }
- }
- }
-
- /**
- * Context has been deactivated, close as required.
- *
- * @param page the workbench page
- * @param perspective the perspective description
- */
- public void deactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- if (!isUserOpened(perspective)) {
- if (fAutoOpened.remove(perspective.getId()) && isAutoClose() && !isDefault(perspective)) {
- IViewReference reference = page.findViewReference(getViewId());
- if (reference != null) {
- try {
- fIgnoreChanges = true;
- page.hideView(reference);
- } finally {
- fIgnoreChanges = false;
- }
- }
- }
- }
- }
-
- /**
- * Save view binding settings into XML document.
- *
- * @param document the document to save to
- * @param root the root XML element
- */
- public void saveBindings(Document document, Element root) {
- Element viewElement = document.createElement(XML_ELEMENT_VIEW);
- viewElement.setAttribute(XML_ATTR_ID, getViewId());
- appendPerspectives(document, viewElement, fUserOpened, XML_VALUE_OPENED);
- appendPerspectives(document, viewElement, fUserClosed, XML_VALUE_CLOSED);
- if (viewElement.hasChildNodes()) {
- root.appendChild(viewElement);
- }
- }
+ // an irrelevant view is visible
+ try {
+ fIgnoreChanges = true;
+ page.bringToTop(part);
+ } finally {
+ fIgnoreChanges = false;
+ }
+ }
+ }
+ }
+
+ /**
+ * Context has been deactivated, close as required.
+ *
+ * @param page the workbench page
+ * @param perspective the perspective description
+ */
+ public void deactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ if (!isUserOpened(perspective)) {
+ if (fAutoOpened.remove(perspective.getId()) && isAutoClose() && !isDefault(perspective)) {
+ IViewReference reference = page.findViewReference(getViewId());
+ if (reference != null) {
+ try {
+ fIgnoreChanges = true;
+ page.hideView(reference);
+ } finally {
+ fIgnoreChanges = false;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Save view binding settings into XML document.
+ *
+ * @param document the document to save to
+ * @param root the root XML element
+ */
+ public void saveBindings(Document document, Element root) {
+ Element viewElement = document.createElement(XML_ELEMENT_VIEW);
+ viewElement.setAttribute(XML_ATTR_ID, getViewId());
+ appendPerspectives(document, viewElement, fUserOpened, XML_VALUE_OPENED);
+ appendPerspectives(document, viewElement, fUserClosed, XML_VALUE_CLOSED);
+ if (viewElement.hasChildNodes()) {
+ root.appendChild(viewElement);
+ }
+ }
private void appendPerspectives(Document document, Element parent, Set<String> perpectives, String xmlValue) {
- String[] ids = perpectives.toArray(new String[perpectives.size()]);
- for (int i = 0; i < ids.length; i++) {
- String id = ids[i];
- Element element = document.createElement(XML_ELEMENT_PERSPECTIVE);
- element.setAttribute(XML_ATTR_ID, id);
- element.setAttribute(XML_ATTR_USER_ACTION, xmlValue);
- parent.appendChild(element);
- }
- }
-
- public void applyUserSettings(Element viewElement) {
- NodeList list = viewElement.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- if(entry.getNodeName().equalsIgnoreCase(XML_ELEMENT_PERSPECTIVE)){
- String id = entry.getAttribute(XML_ATTR_ID);
- String setting = entry.getAttribute(XML_ATTR_USER_ACTION);
- if (id != null) {
- if (XML_VALUE_CLOSED.equals(setting)) {
- fUserClosed.add(id);
- } else if (XML_VALUE_OPENED.equals(setting)) {
- fUserOpened.add(id);
- }
- }
- }
- }
- }
- }
- }
-
- private IDebugContextService getDebugContextService() {
- return fDebugContextService;
- }
+ String[] ids = perpectives.toArray(new String[perpectives.size()]);
+ for (int i = 0; i < ids.length; i++) {
+ String id = ids[i];
+ Element element = document.createElement(XML_ELEMENT_PERSPECTIVE);
+ element.setAttribute(XML_ATTR_ID, id);
+ element.setAttribute(XML_ATTR_USER_ACTION, xmlValue);
+ parent.appendChild(element);
+ }
+ }
+
+ public void applyUserSettings(Element viewElement) {
+ NodeList list = viewElement.getChildNodes();
+ int length = list.getLength();
+ for (int i = 0; i < length; ++i) {
+ Node node = list.item(i);
+ short type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ if(entry.getNodeName().equalsIgnoreCase(XML_ELEMENT_PERSPECTIVE)){
+ String id = entry.getAttribute(XML_ATTR_ID);
+ String setting = entry.getAttribute(XML_ATTR_USER_ACTION);
+ if (id != null) {
+ if (XML_VALUE_CLOSED.equals(setting)) {
+ fUserClosed.add(id);
+ } else if (XML_VALUE_OPENED.equals(setting)) {
+ fUserOpened.add(id);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private IDebugContextService getDebugContextService() {
+ return fDebugContextService;
+ }
/**
* Creates a service for the given window
@@ -627,9 +627,9 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
ViewContextService(IWorkbenchWindow window) {
fWindow = window;
fContextService = PlatformUI.getWorkbench().getAdapter(IContextService.class);
- fDebugContextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
+ fDebugContextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
loadContextToViewExtensions();
- applyUserViewBindings();
+ applyUserViewBindings();
loadPerspectives();
window.addPerspectiveListener(this);
getDebugContextService().addDebugContextListener(this);
@@ -639,10 +639,10 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
fContextService.addContextManagerListener(this);
if (fWindow != null) {
- IWorkbenchPage page = fWindow.getActivePage();
- if (page != null) {
- fActivePerspective = page.getPerspective();
- }
+ IWorkbenchPage page = fWindow.getActivePage();
+ if (page != null) {
+ fActivePerspective = page.getPerspective();
+ }
}
}
@@ -655,7 +655,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
node.removePreferenceChangeListener(this);
}
fContextService.removeContextManagerListener(this);
- fActivePerspective = null;
+ fActivePerspective = null;
}
/**
@@ -668,63 +668,63 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
for (int i = 0; i < configurationElements.length; i++) {
IConfigurationElement element = configurationElements[i];
if ( ELEM_CONTEXT_VIEW_BINDING.equals(element.getName()) ) {
- String viewId = element.getAttribute(ATTR_VIEW_ID);
- String contextId = element.getAttribute(ATTR_CONTEXT_ID);
- if (contextId == null || viewId == null) {
- continue;
- }
- ViewBinding info = new ViewBinding(element);
- DebugContextViewBindings bindings = fContextIdsToBindings.get(contextId);
- if (bindings == null) {
- bindings = new DebugContextViewBindings(contextId);
- fContextIdsToBindings.put(contextId, bindings);
- }
- bindings.addBinding(info);
+ String viewId = element.getAttribute(ATTR_VIEW_ID);
+ String contextId = element.getAttribute(ATTR_CONTEXT_ID);
+ if (contextId == null || viewId == null) {
+ continue;
+ }
+ ViewBinding info = new ViewBinding(element);
+ DebugContextViewBindings bindings = fContextIdsToBindings.get(contextId);
+ if (bindings == null) {
+ bindings = new DebugContextViewBindings(contextId);
+ fContextIdsToBindings.put(contextId, bindings);
+ }
+ bindings.addBinding(info);
}
}
linkParentContexts();
}
- /**
- * Applies user settings that modify view binding extensions.
- */
- private void applyUserViewBindings() {
- String xml = DebugUITools.getPreferenceStore().getString(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS);
- if (xml.length() > 0) {
- try {
- Element root = DebugPlugin.parseDocument(xml);
- NodeList list = root.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- if(entry.getNodeName().equalsIgnoreCase(XML_ELEMENT_VIEW)){
- String id = entry.getAttribute(XML_ATTR_ID);
+ /**
+ * Applies user settings that modify view binding extensions.
+ */
+ private void applyUserViewBindings() {
+ String xml = DebugUITools.getPreferenceStore().getString(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS);
+ if (xml.length() > 0) {
+ try {
+ Element root = DebugPlugin.parseDocument(xml);
+ NodeList list = root.getChildNodes();
+ int length = list.getLength();
+ for (int i = 0; i < length; ++i) {
+ Node node = list.item(i);
+ short type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ if(entry.getNodeName().equalsIgnoreCase(XML_ELEMENT_VIEW)){
+ String id = entry.getAttribute(XML_ATTR_ID);
for (DebugContextViewBindings binding : fContextIdsToBindings.values()) {
- binding.applyUserSettings(id, entry);
- }
- }
- }
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
+ binding.applyUserSettings(id, entry);
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ }
/**
* Load the collection of perspectives in which view management will occur from the preference store.
*/
private void loadPerspectives() {
- String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString(
- IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
- if (IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT.equals(preference)) {
- fEnabledPerspectives = getDefaultEnabledPerspectives();
- } else {
- fEnabledPerspectives = parseList(preference);
- }
+ String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString(
+ IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
+ if (IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT.equals(preference)) {
+ fEnabledPerspectives = getDefaultEnabledPerspectives();
+ } else {
+ fEnabledPerspectives = parseList(preference);
+ }
}
/**
@@ -746,11 +746,11 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
* @return active perspective or <code>null</code>
*/
private IPerspectiveDescriptor getActivePerspective() {
- if (fWindow == null) {
- return null;
- }
+ if (fWindow == null) {
+ return null;
+ }
- return fActivePerspective;
+ return fActivePerspective;
}
/**
@@ -770,29 +770,29 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
/**
- * Calculates the default set of perspectives enabled for view management
- * based on the contextViewBindings extension point.
- *
- * @return set of enabled perspectives.
- *
- * @since 3.5
- */
+ * Calculates the default set of perspectives enabled for view management
+ * based on the contextViewBindings extension point.
+ *
+ * @return set of enabled perspectives.
+ *
+ * @since 3.5
+ */
public static Set<String> getDefaultEnabledPerspectives() {
Set<String> perspectives = new HashSet<>(4);
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_CONTEXT_VIEW_BINDINGS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
- if ( ELEM_PERSPECTIVE.equals(element.getName()) ) {
- String perspectiveId = element.getAttribute(ATTR_PERSPECTIVE_ID);
- if (perspectiveId != null) {
- perspectives.add(perspectiveId);
- }
- }
- }
-
- return perspectives;
- }
+ IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_CONTEXT_VIEW_BINDINGS);
+ IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
+ for (int i = 0; i < configurationElements.length; i++) {
+ IConfigurationElement element = configurationElements[i];
+ if ( ELEM_PERSPECTIVE.equals(element.getName()) ) {
+ String perspectiveId = element.getAttribute(ATTR_PERSPECTIVE_ID);
+ if (perspectiveId != null) {
+ perspectives.add(perspectiveId);
+ }
+ }
+ }
+
+ return perspectives;
+ }
public void contextActivated(ISelection selection) {
if (isEnabledPerspective()) {
@@ -814,26 +814,26 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
List<String> workbenchContexts = DebugModelContextBindingManager.getDefault().getWorkbenchContextsForDebugContext(target);
// TODO: do we need to check if contexts are actually enabled in workbench first?
if (!workbenchContexts.isEmpty()) {
- // Quickly check if any contexts need activating
- boolean needToActivate = false;
- for (int i = 0; i < workbenchContexts.size(); i++) {
- if (!isActivated(workbenchContexts.get(i))) {
- needToActivate = true;
- break;
- }
- }
-
- if (needToActivate) {
+ // Quickly check if any contexts need activating
+ boolean needToActivate = false;
+ for (int i = 0; i < workbenchContexts.size(); i++) {
+ if (!isActivated(workbenchContexts.get(i))) {
+ needToActivate = true;
+ break;
+ }
+ }
+
+ if (needToActivate) {
Set<String> allViewIds = getAllContextsViewIDs(workbenchContexts);
- // if all contexts already activate and last context is already active context == done
- for (int i = 0; i < workbenchContexts.size(); i++) {
- String contextId = workbenchContexts.get(i);
- if (!isActivated(contextId)) {
- activateChain(contextId, getActivePerspective(), allViewIds);
- }
- }
- }
+ // if all contexts already activate and last context is already active context == done
+ for (int i = 0; i < workbenchContexts.size(); i++) {
+ String contextId = workbenchContexts.get(i);
+ if (!isActivated(contextId)) {
+ activateChain(contextId, getActivePerspective(), allViewIds);
+ }
+ }
+ }
}
}
} catch (CoreException e) {
@@ -942,26 +942,26 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) {
if (!fIgnoreChanges && page.getWorkbenchWindow().equals(fWindow)) {
if(partRef != null) {
- if (IWorkbenchPage.CHANGE_VIEW_SHOW == changeId || IWorkbenchPage.CHANGE_VIEW_HIDE == changeId) {
- // Update only the contexts which are currently active (Bug 128065)
+ if (IWorkbenchPage.CHANGE_VIEW_SHOW == changeId || IWorkbenchPage.CHANGE_VIEW_HIDE == changeId) {
+ // Update only the contexts which are currently active (Bug 128065)
Set<String> activatedContexts = fPerspectiveToActivatedContexts.get(perspective);
- if (activatedContexts != null) {
+ if (activatedContexts != null) {
for (String id : activatedContexts) {
DebugContextViewBindings bindings = fContextIdsToBindings.get(id);
- if (bindings != null) {
- bindings.setViewOpened(IWorkbenchPage.CHANGE_VIEW_SHOW == changeId, partRef.getId());
- }
- }
- }
- }
+ if (bindings != null) {
+ bindings.setViewOpened(IWorkbenchPage.CHANGE_VIEW_SHOW == changeId, partRef.getId());
+ }
+ }
+ }
+ }
}
- }
+ }
}
@Override
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
if (page.getWorkbenchWindow().equals(fWindow)) {
- fActivePerspective = perspective;
+ fActivePerspective = perspective;
ISelection activeContext = getDebugContextService().getActiveContext();
if (activeContext != null) {
contextActivated(activeContext);
@@ -999,16 +999,16 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
TreeSet<String> viewIds = new TreeSet<>();
- for (int i = 0; i < contextsIds.size(); i++) {
- DebugContextViewBindings bindings= fContextIdsToBindings.get(contextsIds.get(i));
- if (bindings != null) {
- String[] bindingViewIds = bindings.getAllViewBindingsIds();
- for (int j = 0; j < bindingViewIds.length; j++) {
- viewIds.add(bindingViewIds[j]);
- }
- }
- }
- return viewIds;
+ for (int i = 0; i < contextsIds.size(); i++) {
+ DebugContextViewBindings bindings= fContextIdsToBindings.get(contextsIds.get(i));
+ if (bindings != null) {
+ String[] bindingViewIds = bindings.getAllViewBindingsIds();
+ for (int j = 0; j < bindingViewIds.length; j++) {
+ viewIds.add(bindingViewIds[j]);
+ }
+ }
+ }
+ return viewIds;
}
/**
@@ -1062,7 +1062,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
private void deactivate(String contextId, IPerspectiveDescriptor perspective) {
- if (fWindow == null)
+ if (fWindow == null)
{
return; // disposed
}
@@ -1101,48 +1101,48 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
return fContextIdsToBindings.containsKey(id);
}
- /**
- * Save view binding settings that differ from extension settings
- */
- private void saveViewBindings() {
- try {
- Document document = DebugPlugin.newDocument();
- Element root = document.createElement(XML_ELEMENT_VIEW_BINDINGS);
- document.appendChild(root);
+ /**
+ * Save view binding settings that differ from extension settings
+ */
+ private void saveViewBindings() {
+ try {
+ Document document = DebugPlugin.newDocument();
+ Element root = document.createElement(XML_ELEMENT_VIEW_BINDINGS);
+ document.appendChild(root);
Set<String> done = new HashSet<>();
for (DebugContextViewBindings binding : fContextIdsToBindings.values()) {
- binding.saveBindings(document, root, done);
- }
- String prefValue = IInternalDebugCoreConstants.EMPTY_STRING;
- if (root.hasChildNodes()) {
- prefValue = DebugPlugin.serializeDocument(document);
- }
- fIgnoreChanges = true;
- DebugUITools.getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, prefValue);
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- } finally {
- fIgnoreChanges = false;
- }
-
- }
-
- /**
- * Returns the perspectives in which debugging is enabled.
- *
- * @return the array of perspective identifiers in which debugging is enabled
- */
- public String[] getEnabledPerspectives() {
- return fEnabledPerspectives.toArray(new String[fEnabledPerspectives.size()]);
- }
-
- /**
- * Show the view without effecting user preferences
- *
- * @param viewId the id of the view to show
- */
- public void showViewQuiet(String viewId) {
- if (fWindow == null)
+ binding.saveBindings(document, root, done);
+ }
+ String prefValue = IInternalDebugCoreConstants.EMPTY_STRING;
+ if (root.hasChildNodes()) {
+ prefValue = DebugPlugin.serializeDocument(document);
+ }
+ fIgnoreChanges = true;
+ DebugUITools.getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, prefValue);
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ } finally {
+ fIgnoreChanges = false;
+ }
+
+ }
+
+ /**
+ * Returns the perspectives in which debugging is enabled.
+ *
+ * @return the array of perspective identifiers in which debugging is enabled
+ */
+ public String[] getEnabledPerspectives() {
+ return fEnabledPerspectives.toArray(new String[fEnabledPerspectives.size()]);
+ }
+
+ /**
+ * Show the view without effecting user preferences
+ *
+ * @param viewId the id of the view to show
+ */
+ public void showViewQuiet(String viewId) {
+ if (fWindow == null)
{
return; // disposed;
}
@@ -1161,12 +1161,12 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
fIgnoreChanges = false;
}
}
- }
+ }
@Override
public void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
if (page.getWorkbenchWindow().equals(fWindow)) {
- fActivePerspective = null;
+ fActivePerspective = null;
clean(perspective);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
index 319dbb85f..a643263f8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
@@ -44,587 +44,587 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap
*/
final private List<IBreakpoint> fBreakpoints = new ArrayList<>();
- /**
- * Child containers - inserting new element into this container should use the insertChildContainer method
- */
+ /**
+ * Child containers - inserting new element into this container should use the insertChildContainer method
+ */
final private List<BreakpointContainer> fChildContainers = new ArrayList<>();
- /**
- * The category for this container
- */
- private IAdaptable fCategory;
-
- /**
- * The breakpoint organizer for this container
- */
- private IBreakpointOrganizer fOrganizer;
-
- /**
- * The nested breakpoint organizer
- */
- private IBreakpointOrganizer[] fNesting;
-
- /**
- * A flag to indicate this is the default container
- */
- private boolean fDefaultContainer;
-
- /**
- * Parent container
- */
- private BreakpointContainer fParent;
-
- /**
- * The comparator, will be use to compare the order for inserting new element into this container
- */
- private ElementComparator fComparator;
-
- /**
- * Constructor, intended to be call when creating the root container.
- *
- * @param organizers the breakpoint organizer for this container
- * @param comparator the element comparator, can be <code>null</code>. If <code>null</code> than new element
- * will be added to the end of the list.
- */
- public BreakpointContainer(IBreakpointOrganizer[] organizers, ElementComparator comparator) {
- fNesting = organizers;
- fComparator = comparator;
- }
-
- /**
- * Constructor, intended to be call within this class only.
- *
- * @param parent the parent breakpoint container
- * @param category the category for this container
- * @param organizer the organizer for this container
- * @param comparator the element comparator
- * @param nesting the nested breakpoint organizer
- */
- private BreakpointContainer(BreakpointContainer parent, IAdaptable category, IBreakpointOrganizer organizer,
- ElementComparator comparator, IBreakpointOrganizer[] nesting) {
- this(category, organizer, nesting);
- fParent = parent;
- fComparator = comparator;
- }
-
- /**
- * Constructor, intended to be call when reorganizing the content.
- *
- * @param category the breakpoint category
- * @param organizer the breakpoint organizer
- * @param nesting the nested breakpoint organizer
- */
- BreakpointContainer(IAdaptable category, IBreakpointOrganizer organizer, IBreakpointOrganizer[] nesting) {
- fCategory = category;
- fOrganizer = organizer;
- fNesting = nesting;
- }
-
- /**
- * Initialize the default containers.
- *
- * @param parentDelta the parent delta, addition child delta will be added to the parent
- */
- public void initDefaultContainers(ModelDelta parentDelta) {
- // seed with all nested categories
- if (fNesting != null && fNesting.length > 0) {
- IAdaptable[] emptyCategories = fNesting[0].getCategories();
- if (emptyCategories != null) {
- for (int i = 0; i < emptyCategories.length; i++) {
- IAdaptable empty = emptyCategories[i];
- BreakpointContainer container = findExistingContainer(fChildContainers, empty);
- if (container == null) {
- IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[fNesting.length - 1];
- System.arraycopy(fNesting, 1, siblings, 0, siblings.length);
- container = new BreakpointContainer(this, empty, fNesting[0], fComparator, siblings);
- insertChildContainer(container);
- container.fDefaultContainer = true;
-
- int size = container.getChildren().length;
- parentDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSTALL|IModelDelta.ADDED|IModelDelta.EXPAND, size);
-
- }
- }
- }
- }
- }
-
- /**
- * Insert the breakpoint to this container.
- *
- * @param breakpoint the new breakpoint
- * @return the index of the breakpoint in the cache, -1 if the breakpoint already exist
- */
- private int insertBreakpoint(IBreakpoint breakpoint) {
- if (fBreakpoints.contains(breakpoint) || breakpoint == null) {
- return -1;
- }
- int index = fBreakpoints.size();
- for (; fComparator != null && index > 0; index--) {
- if (fComparator.compare(fBreakpoints.get(index-1), breakpoint) < 0) {
+ /**
+ * The category for this container
+ */
+ private IAdaptable fCategory;
+
+ /**
+ * The breakpoint organizer for this container
+ */
+ private IBreakpointOrganizer fOrganizer;
+
+ /**
+ * The nested breakpoint organizer
+ */
+ private IBreakpointOrganizer[] fNesting;
+
+ /**
+ * A flag to indicate this is the default container
+ */
+ private boolean fDefaultContainer;
+
+ /**
+ * Parent container
+ */
+ private BreakpointContainer fParent;
+
+ /**
+ * The comparator, will be use to compare the order for inserting new element into this container
+ */
+ private ElementComparator fComparator;
+
+ /**
+ * Constructor, intended to be call when creating the root container.
+ *
+ * @param organizers the breakpoint organizer for this container
+ * @param comparator the element comparator, can be <code>null</code>. If <code>null</code> than new element
+ * will be added to the end of the list.
+ */
+ public BreakpointContainer(IBreakpointOrganizer[] organizers, ElementComparator comparator) {
+ fNesting = organizers;
+ fComparator = comparator;
+ }
+
+ /**
+ * Constructor, intended to be call within this class only.
+ *
+ * @param parent the parent breakpoint container
+ * @param category the category for this container
+ * @param organizer the organizer for this container
+ * @param comparator the element comparator
+ * @param nesting the nested breakpoint organizer
+ */
+ private BreakpointContainer(BreakpointContainer parent, IAdaptable category, IBreakpointOrganizer organizer,
+ ElementComparator comparator, IBreakpointOrganizer[] nesting) {
+ this(category, organizer, nesting);
+ fParent = parent;
+ fComparator = comparator;
+ }
+
+ /**
+ * Constructor, intended to be call when reorganizing the content.
+ *
+ * @param category the breakpoint category
+ * @param organizer the breakpoint organizer
+ * @param nesting the nested breakpoint organizer
+ */
+ BreakpointContainer(IAdaptable category, IBreakpointOrganizer organizer, IBreakpointOrganizer[] nesting) {
+ fCategory = category;
+ fOrganizer = organizer;
+ fNesting = nesting;
+ }
+
+ /**
+ * Initialize the default containers.
+ *
+ * @param parentDelta the parent delta, addition child delta will be added to the parent
+ */
+ public void initDefaultContainers(ModelDelta parentDelta) {
+ // seed with all nested categories
+ if (fNesting != null && fNesting.length > 0) {
+ IAdaptable[] emptyCategories = fNesting[0].getCategories();
+ if (emptyCategories != null) {
+ for (int i = 0; i < emptyCategories.length; i++) {
+ IAdaptable empty = emptyCategories[i];
+ BreakpointContainer container = findExistingContainer(fChildContainers, empty);
+ if (container == null) {
+ IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[fNesting.length - 1];
+ System.arraycopy(fNesting, 1, siblings, 0, siblings.length);
+ container = new BreakpointContainer(this, empty, fNesting[0], fComparator, siblings);
+ insertChildContainer(container);
+ container.fDefaultContainer = true;
+
+ int size = container.getChildren().length;
+ parentDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSTALL|IModelDelta.ADDED|IModelDelta.EXPAND, size);
+
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Insert the breakpoint to this container.
+ *
+ * @param breakpoint the new breakpoint
+ * @return the index of the breakpoint in the cache, -1 if the breakpoint already exist
+ */
+ private int insertBreakpoint(IBreakpoint breakpoint) {
+ if (fBreakpoints.contains(breakpoint) || breakpoint == null) {
+ return -1;
+ }
+ int index = fBreakpoints.size();
+ for (; fComparator != null && index > 0; index--) {
+ if (fComparator.compare(fBreakpoints.get(index-1), breakpoint) < 0) {
break;
}
- }
- if (index < 0) {
- index = 0;
- }
- fBreakpoints.add(index, breakpoint);
- return index;
- }
-
- /**
- * Insert the child container this container.
- *
- * @param container the child container
- * @return the index of the container in the cache, -1 if the child container already exist
- */
- private int insertChildContainer(BreakpointContainer container) {
- int index = fChildContainers.size();
- for (; fComparator != null && index > 0; index--) {
- if (fComparator.compare(fChildContainers.get(index-1), container) < 0) {
+ }
+ if (index < 0) {
+ index = 0;
+ }
+ fBreakpoints.add(index, breakpoint);
+ return index;
+ }
+
+ /**
+ * Insert the child container this container.
+ *
+ * @param container the child container
+ * @return the index of the container in the cache, -1 if the child container already exist
+ */
+ private int insertChildContainer(BreakpointContainer container) {
+ int index = fChildContainers.size();
+ for (; fComparator != null && index > 0; index--) {
+ if (fComparator.compare(fChildContainers.get(index-1), container) < 0) {
break;
}
- }
+ }
- if (index < 0) {
+ if (index < 0) {
index = 0;
}
- fChildContainers.add(index, container);
-
- return index;
- }
-
-
- /**
- * Returns the element comparator.
- *
- * @return the element comparator
- */
- public ElementComparator getElementComparator() {
- return fComparator;
- }
-
- /**
- * Returns the parent container, can be <code>null</code>.
- *
- * @return the parent container
- */
- public BreakpointContainer getParent() {
- return fParent;
- }
-
- /**
- * Determine whether there is any nested container.
- *
- * @return true if has nested container
- */
- private boolean hasNesting() {
- return fNesting != null && fNesting.length > 0;
- }
-
- /**
- * Get the categories for the breakpoint with the given organizer.
- *
- * @param breakpoint the breakpoint
- * @param organizer the organizer
- * @return the categories
- */
- private static IAdaptable[] getCategories(IBreakpoint breakpoint, IBreakpointOrganizer organizer) {
- IAdaptable[] categories = organizer.getCategories(breakpoint);
- if (categories == null || categories.length == 0) {
+ fChildContainers.add(index, container);
+
+ return index;
+ }
+
+
+ /**
+ * Returns the element comparator.
+ *
+ * @return the element comparator
+ */
+ public ElementComparator getElementComparator() {
+ return fComparator;
+ }
+
+ /**
+ * Returns the parent container, can be <code>null</code>.
+ *
+ * @return the parent container
+ */
+ public BreakpointContainer getParent() {
+ return fParent;
+ }
+
+ /**
+ * Determine whether there is any nested container.
+ *
+ * @return true if has nested container
+ */
+ private boolean hasNesting() {
+ return fNesting != null && fNesting.length > 0;
+ }
+
+ /**
+ * Get the categories for the breakpoint with the given organizer.
+ *
+ * @param breakpoint the breakpoint
+ * @param organizer the organizer
+ * @return the categories
+ */
+ private static IAdaptable[] getCategories(IBreakpoint breakpoint, IBreakpointOrganizer organizer) {
+ IAdaptable[] categories = organizer.getCategories(breakpoint);
+ if (categories == null || categories.length == 0) {
categories = OtherBreakpointCategory.getCategories(organizer);
}
- return categories;
- }
-
- /**
- * Find existing breakpoint container in the container array the given category.
- *
- * @param containers the container array
- * @param category the category
- * @return the breakpoint container, can be <code>null</code>.
- */
+ return categories;
+ }
+
+ /**
+ * Find existing breakpoint container in the container array the given category.
+ *
+ * @param containers the container array
+ * @param category the category
+ * @return the breakpoint container, can be <code>null</code>.
+ */
private static BreakpointContainer findExistingContainer(List<BreakpointContainer> containers, IAdaptable category) {
for (BreakpointContainer c : containers) {
- if (category.equals(c.getCategory())) {
+ if (category.equals(c.getCategory())) {
return c;
}
- }
- return null;
- }
-
- // TODO [pchuong]: can be remove if BreakpointsContentProvider no longer uses this class
- void addBreakpoint(IBreakpoint breakpoint) {
- addBreakpoint(breakpoint, new ModelDelta(null, IModelDelta.NO_CHANGE));
- }
-
- /**
- * Add a breakpoint to the container, additional delta will be added to the root delta.
- *
- * @param breakpoint the breakpoint to added
- * @param rootDelta the root delta of this container
- * @see #removeBreakpoint
- */
- public void addBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
- final int bpIndex = insertBreakpoint(breakpoint);
- if (bpIndex < 0) {
+ }
+ return null;
+ }
+
+ // TODO [pchuong]: can be remove if BreakpointsContentProvider no longer uses this class
+ void addBreakpoint(IBreakpoint breakpoint) {
+ addBreakpoint(breakpoint, new ModelDelta(null, IModelDelta.NO_CHANGE));
+ }
+
+ /**
+ * Add a breakpoint to the container, additional delta will be added to the root delta.
+ *
+ * @param breakpoint the breakpoint to added
+ * @param rootDelta the root delta of this container
+ * @see #removeBreakpoint
+ */
+ public void addBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
+ final int bpIndex = insertBreakpoint(breakpoint);
+ if (bpIndex < 0) {
return;
}
- if (hasNesting()) {
- IBreakpointOrganizer organizer = fNesting[0];
-
- // get the breakpoint categories from the organizer
- IAdaptable[] categories = getCategories(breakpoint, organizer);
-
- for (int i = 0; i < categories.length; ++i) {
- ModelDelta childDelta = null;
- IAdaptable category = categories[i];
- BreakpointContainer container = findExistingContainer(fChildContainers, category);
-
- // create a new container if it doesn't exist
- if (container == null) {
- IBreakpointOrganizer[] nesting = null;
- if (fNesting.length > 1) {
- nesting = new IBreakpointOrganizer[fNesting.length - 1];
- System.arraycopy(fNesting, 1, nesting, 0, nesting.length);
- }
- container = new BreakpointContainer(this, category, organizer, fComparator, nesting);
- insertChildContainer(container);
- childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSERTED|IModelDelta.INSTALL, -1);
-
- } else {
+ if (hasNesting()) {
+ IBreakpointOrganizer organizer = fNesting[0];
+
+ // get the breakpoint categories from the organizer
+ IAdaptable[] categories = getCategories(breakpoint, organizer);
+
+ for (int i = 0; i < categories.length; ++i) {
+ ModelDelta childDelta = null;
+ IAdaptable category = categories[i];
+ BreakpointContainer container = findExistingContainer(fChildContainers, category);
+
+ // create a new container if it doesn't exist
+ if (container == null) {
+ IBreakpointOrganizer[] nesting = null;
+ if (fNesting.length > 1) {
+ nesting = new IBreakpointOrganizer[fNesting.length - 1];
+ System.arraycopy(fNesting, 1, nesting, 0, nesting.length);
+ }
+ container = new BreakpointContainer(this, category, organizer, fComparator, nesting);
+ insertChildContainer(container);
+ childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSERTED|IModelDelta.INSTALL, -1);
+
+ } else {
childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.STATE, -1);
- }
-
- container.addBreakpoint(breakpoint, childDelta);
- childDelta.setChildCount(container.getChildren().length);
- }
-
- } else {
- // TODO [pchuong]: There seems to be some kind of problem when the INSERTED flag is used,
- // there is a additional checkbox added to the end of the tree.
- // Also the tree seems to have a strange visual effect when using the INSERTED
- // flag for the child node instead of ADDED flag. Note: all breakpoint delta
- // is using the ADDED flag in this class.
- rootDelta.addNode(breakpoint, bpIndex, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
- // rootDelta.addNode(breakpoint, bpIndex, IModelDelta.INSERTED|IModelDelta.INSTALL, 0);
-
- rootDelta.setFlags(rootDelta.getFlags() | IModelDelta.EXPAND);
- }
- }
-
- /**
- * Remove a breakpoint from the container, additional delta will be added to the root delta.
- *
- * @param breakpoint the breakpoint to remove
- * @param rootDelta the root delta of this container
- * @return if the breakpoint was successfully removed
- * @see #addBreakpoint
- */
- public boolean removeBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
- boolean removed = fBreakpoints.remove(breakpoint);
-
- if (removed) {
- boolean addRemoveBpDelta = getContainers().length == 0;
+ }
+
+ container.addBreakpoint(breakpoint, childDelta);
+ childDelta.setChildCount(container.getChildren().length);
+ }
+
+ } else {
+ // TODO [pchuong]: There seems to be some kind of problem when the INSERTED flag is used,
+ // there is a additional checkbox added to the end of the tree.
+ // Also the tree seems to have a strange visual effect when using the INSERTED
+ // flag for the child node instead of ADDED flag. Note: all breakpoint delta
+ // is using the ADDED flag in this class.
+ rootDelta.addNode(breakpoint, bpIndex, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
+ // rootDelta.addNode(breakpoint, bpIndex, IModelDelta.INSERTED|IModelDelta.INSTALL, 0);
+
+ rootDelta.setFlags(rootDelta.getFlags() | IModelDelta.EXPAND);
+ }
+ }
+
+ /**
+ * Remove a breakpoint from the container, additional delta will be added to the root delta.
+ *
+ * @param breakpoint the breakpoint to remove
+ * @param rootDelta the root delta of this container
+ * @return if the breakpoint was successfully removed
+ * @see #addBreakpoint
+ */
+ public boolean removeBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
+ boolean removed = fBreakpoints.remove(breakpoint);
+
+ if (removed) {
+ boolean addRemoveBpDelta = getContainers().length == 0;
Iterator<BreakpointContainer> it = fChildContainers.iterator();
- while (it.hasNext()) {
- BreakpointContainer container = it.next();
+ while (it.hasNext()) {
+ BreakpointContainer container = it.next();
// if the breakpoint contains in the container and it is the only breakpoint,
// than remove the container from the collection
- if (container.contains(breakpoint)) {
- ModelDelta childDelta = null;
- if ((!container.isDefaultContainer()) && (container.getBreakpoints().length <= 1)) {
- it.remove();
- childDelta = rootDelta.addNode(container, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
-
- } else {
- childDelta = rootDelta.addNode(container, IModelDelta.STATE);
- }
- // remove the breakpoint from the nested containers
- container.removeBreakpoint(breakpoint, childDelta);
- }
- }
-
- if (addRemoveBpDelta) {
- rootDelta.addNode(breakpoint, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
- }
- }
- return removed;
- }
-
- /**
- * A helper method to copy the organizers between two containers.
- *
- * @param destContainer the destination container
- * @param sourceContainer the source container
- */
- public static void copyOrganizers(BreakpointContainer destContainer, BreakpointContainer sourceContainer) {
- destContainer.fNesting = sourceContainer.fNesting;
- destContainer.fOrganizer = sourceContainer.fOrganizer;
+ if (container.contains(breakpoint)) {
+ ModelDelta childDelta = null;
+ if ((!container.isDefaultContainer()) && (container.getBreakpoints().length <= 1)) {
+ it.remove();
+ childDelta = rootDelta.addNode(container, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
+
+ } else {
+ childDelta = rootDelta.addNode(container, IModelDelta.STATE);
+ }
+ // remove the breakpoint from the nested containers
+ container.removeBreakpoint(breakpoint, childDelta);
+ }
+ }
+
+ if (addRemoveBpDelta) {
+ rootDelta.addNode(breakpoint, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
+ }
+ }
+ return removed;
+ }
+
+ /**
+ * A helper method to copy the organizers between two containers.
+ *
+ * @param destContainer the destination container
+ * @param sourceContainer the source container
+ */
+ public static void copyOrganizers(BreakpointContainer destContainer, BreakpointContainer sourceContainer) {
+ destContainer.fNesting = sourceContainer.fNesting;
+ destContainer.fOrganizer = sourceContainer.fOrganizer;
destContainer.fCategory = sourceContainer.fCategory;
- }
-
- /**
- * A helper method to update the breakpoint cache of the container and it's ancestors.
- *
- * @param container the breakpoint container
- * @param breakpoints the breakpoint to update
- * @param add true if breakpoint should be added to the cache, otherwise remove the breakpoint from the cache
- */
+ }
+
+ /**
+ * A helper method to update the breakpoint cache of the container and it's ancestors.
+ *
+ * @param container the breakpoint container
+ * @param breakpoints the breakpoint to update
+ * @param add true if breakpoint should be added to the cache, otherwise remove the breakpoint from the cache
+ */
private static void updateSelfAndAncestorsBreakpointCache(BreakpointContainer container, List<IBreakpoint> breakpoints, boolean add) {
- if (container != null) {
- container.fBreakpoints.removeAll(breakpoints);
- if (add) {
+ if (container != null) {
+ container.fBreakpoints.removeAll(breakpoints);
+ if (add) {
container.fBreakpoints.addAll(breakpoints);
}
- updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, add);
- }
- }
-
- /**
- * A helper method to add a breakpoint to an existing container.
- *
- * @param destContainer the destination container
- * @param breakpoint the breakpoint to add
- * @param destContainerDelta the destination container delta, additional delta will be added to this delta
- */
- static public void addBreakpoint(BreakpointContainer destContainer, IBreakpoint breakpoint, ModelDelta destContainerDelta) {
- int index = destContainer.insertBreakpoint(breakpoint);
- Assert.isTrue(index >= 0);
+ updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, add);
+ }
+ }
+
+ /**
+ * A helper method to add a breakpoint to an existing container.
+ *
+ * @param destContainer the destination container
+ * @param breakpoint the breakpoint to add
+ * @param destContainerDelta the destination container delta, additional delta will be added to this delta
+ */
+ static public void addBreakpoint(BreakpointContainer destContainer, IBreakpoint breakpoint, ModelDelta destContainerDelta) {
+ int index = destContainer.insertBreakpoint(breakpoint);
+ Assert.isTrue(index >= 0);
List<IBreakpoint> breakpoints = destContainer.fBreakpoints;
- destContainerDelta.addNode(breakpoint, index/*breakpoints.indexOf(breakpoint)*/, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
- destContainerDelta.setFlags(destContainerDelta.getFlags() | IModelDelta.EXPAND);
-
- // add the breakpoints to the parent containers.
- updateSelfAndAncestorsBreakpointCache(destContainer.getParent(), breakpoints, true);
- }
-
- /**
- * A helper method to add a child container to an existing container.
- *
- * @param destContainer the destination container
- * @param sourceContainer the source container
- * @param destContainerDelta the delta of the destination container, additional delta will be added to this delta
- */
- static public void addChildContainer(BreakpointContainer destContainer, BreakpointContainer sourceContainer, ModelDelta destContainerDelta) {
- destContainer.insertChildContainer(sourceContainer);
- sourceContainer.fParent = destContainer;
-
- // add the breakpoints to the parent containers.
+ destContainerDelta.addNode(breakpoint, index/*breakpoints.indexOf(breakpoint)*/, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
+ destContainerDelta.setFlags(destContainerDelta.getFlags() | IModelDelta.EXPAND);
+
+ // add the breakpoints to the parent containers.
+ updateSelfAndAncestorsBreakpointCache(destContainer.getParent(), breakpoints, true);
+ }
+
+ /**
+ * A helper method to add a child container to an existing container.
+ *
+ * @param destContainer the destination container
+ * @param sourceContainer the source container
+ * @param destContainerDelta the delta of the destination container, additional delta will be added to this delta
+ */
+ static public void addChildContainer(BreakpointContainer destContainer, BreakpointContainer sourceContainer, ModelDelta destContainerDelta) {
+ destContainer.insertChildContainer(sourceContainer);
+ sourceContainer.fParent = destContainer;
+
+ // add the breakpoints to the parent containers.
List<IBreakpoint> breakpoints = Arrays.asList(sourceContainer.getBreakpoints());
- updateSelfAndAncestorsBreakpointCache(destContainer, breakpoints, true);
-
- int index = destContainer.fChildContainers.indexOf(sourceContainer);
- int size = sourceContainer.getChildren().length;
- ModelDelta childDelta = destContainerDelta.addNode(sourceContainer, index, IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND, size);
-
- appendContainerDelta(sourceContainer, childDelta);
- }
-
- /**
- * A helper method to append delta to the breakpoint container. This method is used by addContainer only.
- *
- * @param container the container to append child delta
- * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
- */
- static private void appendContainerDelta(BreakpointContainer container, ModelDelta containerDelta) {
- Object[] children = container.getChildren();
- for (int i = 0; i < children.length; ++i) {
- boolean isBreakpoint = children[0] instanceof IBreakpoint;
- int numChild = isBreakpoint ? 0 : children.length;
- int flag = isBreakpoint ? IModelDelta.ADDED|IModelDelta.INSTALL
- : IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND;
- ModelDelta childDelta = containerDelta.addNode(children[i], i, flag, numChild);
-
- if (children[i] instanceof BreakpointContainer) {
- BreakpointContainer childContainer = (BreakpointContainer) children[i];
- appendContainerDelta(childContainer, childDelta);
- }
- }
- }
-
- /**
- * A helper method to remove the breakpoint from the container.
- *
- * @param container the container to remove the breakpoint
- * @param breakpoint the breakpoint to remove
- * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
- */
- static public void removeBreakpoint(BreakpointContainer container, IBreakpoint breakpoint, ModelDelta containerDelta) {
- container.removeBreakpoint(breakpoint, containerDelta);
+ updateSelfAndAncestorsBreakpointCache(destContainer, breakpoints, true);
+
+ int index = destContainer.fChildContainers.indexOf(sourceContainer);
+ int size = sourceContainer.getChildren().length;
+ ModelDelta childDelta = destContainerDelta.addNode(sourceContainer, index, IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND, size);
+
+ appendContainerDelta(sourceContainer, childDelta);
+ }
+
+ /**
+ * A helper method to append delta to the breakpoint container. This method is used by addContainer only.
+ *
+ * @param container the container to append child delta
+ * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
+ */
+ static private void appendContainerDelta(BreakpointContainer container, ModelDelta containerDelta) {
+ Object[] children = container.getChildren();
+ for (int i = 0; i < children.length; ++i) {
+ boolean isBreakpoint = children[0] instanceof IBreakpoint;
+ int numChild = isBreakpoint ? 0 : children.length;
+ int flag = isBreakpoint ? IModelDelta.ADDED|IModelDelta.INSTALL
+ : IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND;
+ ModelDelta childDelta = containerDelta.addNode(children[i], i, flag, numChild);
+
+ if (children[i] instanceof BreakpointContainer) {
+ BreakpointContainer childContainer = (BreakpointContainer) children[i];
+ appendContainerDelta(childContainer, childDelta);
+ }
+ }
+ }
+
+ /**
+ * A helper method to remove the breakpoint from the container.
+ *
+ * @param container the container to remove the breakpoint
+ * @param breakpoint the breakpoint to remove
+ * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
+ */
+ static public void removeBreakpoint(BreakpointContainer container, IBreakpoint breakpoint, ModelDelta containerDelta) {
+ container.removeBreakpoint(breakpoint, containerDelta);
List<IBreakpoint> breakpoints = new ArrayList<>();
- breakpoints.add(breakpoint);
- updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, false);
- }
-
- /**
- * Remove all child elements including the given container itself.
- *
- * @param container the breakpoint container
- * @param delta the parent delta
- */
- static public void removeAll(BreakpointContainer container, ModelDelta delta) {
- BreakpointContainer parent = container.getParent();
- if (parent != null) {
- parent.fChildContainers.remove(container);
- delta = delta.addNode(container, IModelDelta.UNINSTALL|IModelDelta.REMOVED);
- }
-
- if (container.fChildContainers.isEmpty()) {
+ breakpoints.add(breakpoint);
+ updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, false);
+ }
+
+ /**
+ * Remove all child elements including the given container itself.
+ *
+ * @param container the breakpoint container
+ * @param delta the parent delta
+ */
+ static public void removeAll(BreakpointContainer container, ModelDelta delta) {
+ BreakpointContainer parent = container.getParent();
+ if (parent != null) {
+ parent.fChildContainers.remove(container);
+ delta = delta.addNode(container, IModelDelta.UNINSTALL|IModelDelta.REMOVED);
+ }
+
+ if (container.fChildContainers.isEmpty()) {
List<IBreakpoint> breakpoints = new ArrayList<>();
Iterator<IBreakpoint> iterator = container.fBreakpoints.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
IBreakpoint obj = iterator.next();
breakpoints.add(obj);
delta.addNode(obj, IModelDelta.UNINSTALL|IModelDelta.REMOVED);
iterator.remove();
- }
+ }
- // remove the breakpoints from the parent containers.
+ // remove the breakpoints from the parent containers.
updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, false);
- return;
- }
+ return;
+ }
Iterator<BreakpointContainer> iterator = container.fChildContainers.iterator();
- while (iterator.hasNext()) {
- BreakpointContainer childContainer = iterator.next();
- ModelDelta childDelta = delta.addNode(childContainer, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
- iterator.remove();
- removeAll(childContainer, childDelta);
- }
- }
-
- /**
- * Returns whether this is the default container.
- *
- * @return true if it is a default container
- */
- boolean isDefaultContainer() {
- return fDefaultContainer;
- }
-
- /**
- * Returns the breakpoints in this container
- *
- * @return the breakpoints in this container
- */
- @Override
+ while (iterator.hasNext()) {
+ BreakpointContainer childContainer = iterator.next();
+ ModelDelta childDelta = delta.addNode(childContainer, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
+ iterator.remove();
+ removeAll(childContainer, childDelta);
+ }
+ }
+
+ /**
+ * Returns whether this is the default container.
+ *
+ * @return true if it is a default container
+ */
+ boolean isDefaultContainer() {
+ return fDefaultContainer;
+ }
+
+ /**
+ * Returns the breakpoints in this container
+ *
+ * @return the breakpoints in this container
+ */
+ @Override
public IBreakpoint[] getBreakpoints() {
- return fBreakpoints.toArray(new IBreakpoint[fBreakpoints.size()]);
- }
-
- /**
- * Returns this container's category.
- *
- * @return container category
- */
- @Override
+ return fBreakpoints.toArray(new IBreakpoint[fBreakpoints.size()]);
+ }
+
+ /**
+ * Returns this container's category.
+ *
+ * @return container category
+ */
+ @Override
public IAdaptable getCategory() {
- return fCategory;
- }
-
- /**
- * Returns children as breakpoints or nested containers.
- *
- * @return children as breakpoints or nested containers
- */
- public Object[] getChildren() {
- if (fChildContainers.isEmpty()) {
- return getBreakpoints();
- }
- return getContainers();
- }
-
- /**
- * Returns the index of the given child element (breakpoint or container.
- *
- * @param child Child to calculate index of.
- * @return index of child
- */
- public int getChildIndex(Object child) {
- if (fChildContainers.isEmpty()) {
- return fBreakpoints.indexOf(child);
- }
- return fChildContainers.indexOf(child);
- }
-
- /**
- * Returns the containers nested in this container, possibly empty.
- *
- * @return the containers nested in this container, can be empty.
- */
- public BreakpointContainer[] getContainers() {
- return fChildContainers.toArray(new BreakpointContainer[fChildContainers.size()]);
- }
-
- /**
- * Returns this container's organizer.
- *
- * @return this container's organizer
- */
- @Override
+ return fCategory;
+ }
+
+ /**
+ * Returns children as breakpoints or nested containers.
+ *
+ * @return children as breakpoints or nested containers
+ */
+ public Object[] getChildren() {
+ if (fChildContainers.isEmpty()) {
+ return getBreakpoints();
+ }
+ return getContainers();
+ }
+
+ /**
+ * Returns the index of the given child element (breakpoint or container.
+ *
+ * @param child Child to calculate index of.
+ * @return index of child
+ */
+ public int getChildIndex(Object child) {
+ if (fChildContainers.isEmpty()) {
+ return fBreakpoints.indexOf(child);
+ }
+ return fChildContainers.indexOf(child);
+ }
+
+ /**
+ * Returns the containers nested in this container, possibly empty.
+ *
+ * @return the containers nested in this container, can be empty.
+ */
+ public BreakpointContainer[] getContainers() {
+ return fChildContainers.toArray(new BreakpointContainer[fChildContainers.size()]);
+ }
+
+ /**
+ * Returns this container's organizer.
+ *
+ * @return this container's organizer
+ */
+ @Override
public IBreakpointOrganizer getOrganizer() {
- return fOrganizer;
- }
-
- /**
- * Returns whether this container contains the given breakpoint.
- *
- * @param breakpoint the breakpoint to check
- * @return true if this container contains the given breakpoint
- */
- @Override
+ return fOrganizer;
+ }
+
+ /**
+ * Returns whether this container contains the given breakpoint.
+ *
+ * @param breakpoint the breakpoint to check
+ * @return true if this container contains the given breakpoint
+ */
+ @Override
public boolean contains(IBreakpoint breakpoint) {
- return fBreakpoints.contains(breakpoint);
- }
-
- /**
- * Returns the child containers for the given breakpoint.
- *
- * @param breakpoint the breakpoint to get containers for
- * @return child containers
- */
- public BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
- if (contains(breakpoint)) {
- BreakpointContainer[] containers = getContainers();
- if (containers.length == 0) {
- return new BreakpointContainer[]{this};
- }
+ return fBreakpoints.contains(breakpoint);
+ }
+
+ /**
+ * Returns the child containers for the given breakpoint.
+ *
+ * @param breakpoint the breakpoint to get containers for
+ * @return child containers
+ */
+ public BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
+ if (contains(breakpoint)) {
+ BreakpointContainer[] containers = getContainers();
+ if (containers.length == 0) {
+ return new BreakpointContainer[]{this};
+ }
ArrayList<BreakpointContainer> list = new ArrayList<>();
- for (int i = 0; i < containers.length; i++) {
- BreakpointContainer container = containers[i];
- BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
- if (subcontainers != null) {
- for (int j = 0; j < subcontainers.length; j++) {
- list.add(subcontainers[j]);
- }
- }
- }
- return list.toArray(new BreakpointContainer[list.size()]);
- }
- return new BreakpointContainer[0];
- }
+ for (int i = 0; i < containers.length; i++) {
+ BreakpointContainer container = containers[i];
+ BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
+ if (subcontainers != null) {
+ for (int j = 0; j < subcontainers.length; j++) {
+ list.add(subcontainers[j]);
+ }
+ }
+ }
+ return list.toArray(new BreakpointContainer[list.size()]);
+ }
+ return new BreakpointContainer[0];
+ }
@Override
public boolean equals(Object obj) {
- if (obj instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) obj;
- // With Group by "Advanced" the same category can contain a different subset of breakpoints,
- // therefore to have the same category is not enough to be equal.
- if (! (fParent != null && container.fParent != null && fParent.equals(container.fParent) ||
- fParent == null && container.fParent == null) ) {
- return false;
- }
- if (getCategory() != null && container.getCategory() != null) {
- return getCategory().equals(container.getCategory());
- } else {
- return true;
- }
- }
- return super.equals(obj);
+ if (obj instanceof BreakpointContainer) {
+ BreakpointContainer container = (BreakpointContainer) obj;
+ // With Group by "Advanced" the same category can contain a different subset of breakpoints,
+ // therefore to have the same category is not enough to be equal.
+ if (! (fParent != null && container.fParent != null && fParent.equals(container.fParent) ||
+ fParent == null && container.fParent == null) ) {
+ return false;
+ }
+ if (getCategory() != null && container.getCategory() != null) {
+ return getCategory().equals(container.getCategory());
+ } else {
+ return true;
+ }
+ }
+ return super.equals(obj);
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
index aaee66875..e2b07dbc1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
@@ -28,86 +28,86 @@ import org.eclipse.ui.model.IWorkbenchAdapter2;
*/
public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2{
- @Override
+ @Override
public Object[] getChildren(Object o) {
- // not used
- return null;
- }
+ // not used
+ return null;
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- if (object instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) object;
- IAdaptable category = container.getCategory();
- if (category != null) {
- IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getImageDescriptor(category);
- }
- return container.getOrganizer().getImageDescriptor();
- }
- }
- return null;
- }
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
+ IAdaptable category = container.getCategory();
+ if (category != null) {
+ IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
+ if (adapter != null) {
+ return adapter.getImageDescriptor(category);
+ }
+ return container.getOrganizer().getImageDescriptor();
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public String getLabel(Object object) {
- if (object instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) object;
- IAdaptable category = container.getCategory();
- if (category != null) {
- IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getLabel(category);
- }
- return container.getOrganizer().getLabel();
- }
- }
- return IInternalDebugCoreConstants.EMPTY_STRING;
- }
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
+ IAdaptable category = container.getCategory();
+ if (category != null) {
+ IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
+ if (adapter != null) {
+ return adapter.getLabel(category);
+ }
+ return container.getOrganizer().getLabel();
+ }
+ }
+ return IInternalDebugCoreConstants.EMPTY_STRING;
+ }
- @Override
+ @Override
public Object getParent(Object o) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public RGB getForeground(Object object) {
- if (object instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- return adapter.getForeground(category);
- }
- }
- return null;
- }
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
+ IAdaptable category = container.getCategory();
+ IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ return adapter.getForeground(category);
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public RGB getBackground(Object object) {
- if (object instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- return adapter.getBackground(category);
- }
- }
- return null;
- }
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
+ IAdaptable category = container.getCategory();
+ IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ return adapter.getBackground(category);
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public FontData getFont(Object object) {
- if (object instanceof IBreakpointContainer) {
- IBreakpointContainer container = (IBreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- return adapter.getFont(category);
- }
- }
- return null;
- }
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
+ IAdaptable category = container.getCategory();
+ IWorkbenchAdapter2 adapter = category.getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ return adapter.getFont(category);
+ }
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java
index 7f2e199a6..d8ad046c8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java
@@ -27,29 +27,29 @@ import org.eclipse.ui.PlatformUI;
*/
public class BreakpointFactory implements IElementFactory {
- @Override
+ @Override
public IAdaptable createElement(IMemento memento) {
- String longString = memento.getString(BreakpointPersistableElementAdapter.TAG_MARKER_ID);
- String factoryId = memento.getString(BreakpointPersistableElementAdapter.TAG_RESOURCE_FACTORY_ID);
- if (factoryId != null && longString != null) {
- IElementFactory elementFactory = PlatformUI.getWorkbench().getElementFactory(factoryId);
- if (elementFactory != null) {
- IAdaptable adaptable = elementFactory.createElement(memento);
- if (adaptable instanceof IResource) {
- IResource resource = (IResource) adaptable;
- try {
- long id = Long.parseLong(longString);
- IMarker marker = resource.findMarker(id);
- if (marker != null) {
- return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
- }
- } catch (NumberFormatException e) {
- } catch (CoreException e) {
- }
- }
- }
- }
- return null;
- }
+ String longString = memento.getString(BreakpointPersistableElementAdapter.TAG_MARKER_ID);
+ String factoryId = memento.getString(BreakpointPersistableElementAdapter.TAG_RESOURCE_FACTORY_ID);
+ if (factoryId != null && longString != null) {
+ IElementFactory elementFactory = PlatformUI.getWorkbench().getElementFactory(factoryId);
+ if (elementFactory != null) {
+ IAdaptable adaptable = elementFactory.createElement(memento);
+ if (adaptable instanceof IResource) {
+ IResource resource = (IResource) adaptable;
+ try {
+ long id = Long.parseLong(longString);
+ IMarker marker = resource.findMarker(id);
+ if (marker != null) {
+ return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ }
+ } catch (NumberFormatException e) {
+ } catch (CoreException e) {
+ }
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
index be2005ce3..9c7bf8d82 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
@@ -39,7 +39,7 @@ public class BreakpointOrganizerExtension implements IBreakpointOrganizer, IBrea
public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
public static final String ATTR_ID = "id"; //$NON-NLS-1$
public static final String ATTR_ICON = "icon"; //$NON-NLS-1$
- public static final String ATTR_OTHERS_LABEL = "othersLabel"; //$NON-NLS-1$
+ public static final String ATTR_OTHERS_LABEL = "othersLabel"; //$NON-NLS-1$
public BreakpointOrganizerExtension(IConfigurationElement element) {
fElement = element;
@@ -71,15 +71,15 @@ public class BreakpointOrganizerExtension implements IBreakpointOrganizer, IBrea
return fElement.getAttribute(ATTR_LABEL);
}
- /**
- * Returns this organizer's identifier.
- *
- * @return this organizer's identifier
- */
- @Override
+ /**
+ * Returns this organizer's identifier.
+ *
+ * @return this organizer's identifier
+ */
+ @Override
public String getIdentifier() {
- return fElement.getAttribute(ATTR_ID);
- }
+ return fElement.getAttribute(ATTR_ID);
+ }
/**
* Returns this organizer's delegate, instantiating it if required.
@@ -97,62 +97,62 @@ public class BreakpointOrganizerExtension implements IBreakpointOrganizer, IBrea
return fDelegate;
}
- @Override
+ @Override
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- return getOrganizer().getCategories(breakpoint);
- }
+ return getOrganizer().getCategories(breakpoint);
+ }
- @Override
+ @Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- getOrganizer().addPropertyChangeListener(listener);
- }
+ getOrganizer().addPropertyChangeListener(listener);
+ }
- @Override
+ @Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- getOrganizer().removePropertyChangeListener(listener);
- }
+ getOrganizer().removePropertyChangeListener(listener);
+ }
- @Override
+ @Override
public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- getOrganizer().addBreakpoint(breakpoint, category);
- }
+ getOrganizer().addBreakpoint(breakpoint, category);
+ }
- @Override
+ @Override
public void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- getOrganizer().removeBreakpoint(breakpoint, category);
- }
+ getOrganizer().removeBreakpoint(breakpoint, category);
+ }
- @Override
+ @Override
public boolean canAdd(IBreakpoint breakpoint, IAdaptable category) {
- return getOrganizer().canAdd(breakpoint, category);
- }
+ return getOrganizer().canAdd(breakpoint, category);
+ }
- @Override
+ @Override
public boolean canRemove(IBreakpoint breakpoint, IAdaptable category) {
- return getOrganizer().canRemove(breakpoint, category);
- }
+ return getOrganizer().canRemove(breakpoint, category);
+ }
- @Override
+ @Override
public void dispose() {
- // don't instantiate the delegate if it has not been used
- if (fDelegate != null) {
- fDelegate.dispose();
- }
- }
+ // don't instantiate the delegate if it has not been used
+ if (fDelegate != null) {
+ fDelegate.dispose();
+ }
+ }
- @Override
+ @Override
public String getOthersLabel() {
- String attribute = fElement.getAttribute(ATTR_OTHERS_LABEL);
- if (attribute == null) {
- return DebugUIViewsMessages.OtherBreakpointOrganizer_0;
- }
- return attribute;
- }
-
- @Override
+ String attribute = fElement.getAttribute(ATTR_OTHERS_LABEL);
+ if (attribute == null) {
+ return DebugUIViewsMessages.OtherBreakpointOrganizer_0;
+ }
+ return attribute;
+ }
+
+ @Override
public IAdaptable[] getCategories() {
- return getOrganizer().getCategories();
- }
+ return getOrganizer().getCategories();
+ }
@Override
public void addBreakpoints(IBreakpoint[] breakpoints, IAdaptable category) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
index eec404099..49e1ef05f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
@@ -46,7 +46,7 @@ public class BreakpointOrganizerManager {
// map for lookup by id
private Map<String, IBreakpointOrganizer> fOrganizers = new HashMap<>();
- // cached sorted list by label
+ // cached sorted list by label
private List<IBreakpointOrganizer> fSorted = null;
/**
@@ -65,10 +65,10 @@ public class BreakpointOrganizerManager {
* Creates and initializes a new breakpoint container factory.
*/
private BreakpointOrganizerManager() {
- loadOrganizers();
- // force the working set organizers to initialize their listeners
- start("org.eclipse.debug.ui.workingSetOrganizer"); //$NON-NLS-1$
- start("org.eclipse.debug.ui.breakpointWorkingSetOrganizer"); //$NON-NLS-1$
+ loadOrganizers();
+ // force the working set organizers to initialize their listeners
+ start("org.eclipse.debug.ui.workingSetOrganizer"); //$NON-NLS-1$
+ start("org.eclipse.debug.ui.breakpointWorkingSetOrganizer"); //$NON-NLS-1$
}
/**
@@ -77,53 +77,53 @@ public class BreakpointOrganizerManager {
* @param organizerId organizer to start
*/
private void start(String organizerId) {
- IBreakpointOrganizer organizer = getOrganizer(organizerId);
- IPropertyChangeListener listener = new IPropertyChangeListener() {
- @Override
+ IBreakpointOrganizer organizer = getOrganizer(organizerId);
+ IPropertyChangeListener listener = new IPropertyChangeListener() {
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- }
- };
- organizer.addPropertyChangeListener(listener);
- organizer.removePropertyChangeListener(listener);
+ }
+ };
+ organizer.addPropertyChangeListener(listener);
+ organizer.removePropertyChangeListener(listener);
}
- /**
- * Loads all contributed breakpoint organizers.
- */
- private void loadOrganizers() {
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element= configurationElements[i];
- IBreakpointOrganizer organizer = new BreakpointOrganizerExtension(element);
- if (validateOrganizer(organizer)) {
- fOrganizers.put(organizer.getIdentifier(), organizer);
- }
- }
- }
+ /**
+ * Loads all contributed breakpoint organizers.
+ */
+ private void loadOrganizers() {
+ IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
+ IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
+ for (int i = 0; i < configurationElements.length; i++) {
+ IConfigurationElement element= configurationElements[i];
+ IBreakpointOrganizer organizer = new BreakpointOrganizerExtension(element);
+ if (validateOrganizer(organizer)) {
+ fOrganizers.put(organizer.getIdentifier(), organizer);
+ }
+ }
+ }
- /**
- * Validates the given organizer. Checks that certain required attributes
- * are available.
- * @param organizer the organizer to check
- * @return whether the given organizer is valid
- */
- protected static boolean validateOrganizer(IBreakpointOrganizer organizer) {
- String id = organizer.getIdentifier();
- String label = organizer.getLabel();
- return id != null && id.length() > 0 && label != null && label.length() > 0;
- }
+ /**
+ * Validates the given organizer. Checks that certain required attributes
+ * are available.
+ * @param organizer the organizer to check
+ * @return whether the given organizer is valid
+ */
+ protected static boolean validateOrganizer(IBreakpointOrganizer organizer) {
+ String id = organizer.getIdentifier();
+ String label = organizer.getLabel();
+ return id != null && id.length() > 0 && label != null && label.length() > 0;
+ }
- /**
- * Returns all contributed breakpoint organizers.
- *
- * @return all contributed breakpoint organizers
- */
- public IBreakpointOrganizer[] getOrganizers() {
- if (fSorted == null) {
+ /**
+ * Returns all contributed breakpoint organizers.
+ *
+ * @return all contributed breakpoint organizers
+ */
+ public IBreakpointOrganizer[] getOrganizers() {
+ if (fSorted == null) {
Collection<IBreakpointOrganizer> collection = fOrganizers.values();
fSorted = new ArrayList<>();
- fSorted.addAll(collection);
+ fSorted.addAll(collection);
Collections.sort(fSorted, new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
@@ -132,28 +132,28 @@ public class BreakpointOrganizerManager {
return b1.getLabel().compareTo(b2.getLabel());
}
});
- }
- return fSorted.toArray(new IBreakpointOrganizer[fSorted.size()]);
- }
+ }
+ return fSorted.toArray(new IBreakpointOrganizer[fSorted.size()]);
+ }
- /**
- * Returns the specified breakpoint organizer or <code>null</code>
- * @param id organizer identifier
- * @return breakpoint organizer or <code>null</code>
- */
- public IBreakpointOrganizer getOrganizer(String id) {
- return fOrganizers.get(id);
- }
+ /**
+ * Returns the specified breakpoint organizer or <code>null</code>
+ * @param id organizer identifier
+ * @return breakpoint organizer or <code>null</code>
+ */
+ public IBreakpointOrganizer getOrganizer(String id) {
+ return fOrganizers.get(id);
+ }
- /**
- * Shuts down the organizer manager, disposing organizers.
- */
- public void shutdown() {
- IBreakpointOrganizer[] organizers = getOrganizers();
- for (int i = 0; i < organizers.length; i++) {
- IBreakpointOrganizer organizer = organizers[i];
- organizer.dispose();
- }
- }
+ /**
+ * Shuts down the organizer manager, disposing organizers.
+ */
+ public void shutdown() {
+ IBreakpointOrganizer[] organizers = getOrganizers();
+ for (int i = 0; i < organizers.length; i++) {
+ IBreakpointOrganizer organizer = organizers[i];
+ organizer.dispose();
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
index f961845e5..6155fd8b5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
@@ -24,39 +24,39 @@ import org.eclipse.ui.IPersistableElement;
*/
public class BreakpointPersistableElementAdapter implements IPersistableElement {
- private IBreakpoint fBreakpoint;
+ private IBreakpoint fBreakpoint;
- public static final String TAG_MARKER_ID = "TAG_MARKER_ID"; //$NON-NLS-1$
- public static final String TAG_RESOURCE_FACTORY_ID = "TAG_RESOURCE_FACTORY_ID"; //$NON-NLS-1$
+ public static final String TAG_MARKER_ID = "TAG_MARKER_ID"; //$NON-NLS-1$
+ public static final String TAG_RESOURCE_FACTORY_ID = "TAG_RESOURCE_FACTORY_ID"; //$NON-NLS-1$
- /**
- * Constructs a new persitable element adapter for the given breakpoint.
- *
- * @param breakpoint the backing {@link IBreakpoint}
- */
- public BreakpointPersistableElementAdapter(IBreakpoint breakpoint) {
- fBreakpoint = breakpoint;
- }
+ /**
+ * Constructs a new persitable element adapter for the given breakpoint.
+ *
+ * @param breakpoint the backing {@link IBreakpoint}
+ */
+ public BreakpointPersistableElementAdapter(IBreakpoint breakpoint) {
+ fBreakpoint = breakpoint;
+ }
- @Override
+ @Override
public String getFactoryId() {
- return "org.eclipse.debug.ui.elementFactory.breakpoints"; //$NON-NLS-1$
- }
+ return "org.eclipse.debug.ui.elementFactory.breakpoints"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public void saveState(IMemento memento) {
- IMarker marker = fBreakpoint.getMarker();
- if (marker != null) {
- IResource resource = marker.getResource();
- IPersistableElement pe = resource.getAdapter(IPersistableElement.class);
- if (pe != null) {
- long id = marker.getId();
- String longString = Long.toString(id);
- memento.putString(TAG_MARKER_ID, longString);
- memento.putString(TAG_RESOURCE_FACTORY_ID, pe.getFactoryId());
- pe.saveState(memento);
- }
- }
- }
+ IMarker marker = fBreakpoint.getMarker();
+ if (marker != null) {
+ IResource resource = marker.getResource();
+ IPersistableElement pe = resource.getAdapter(IPersistableElement.class);
+ if (pe != null) {
+ long id = marker.getId();
+ String longString = Long.toString(id);
+ memento.putString(TAG_MARKER_ID, longString);
+ memento.putString(TAG_RESOURCE_FACTORY_ID, pe.getFactoryId());
+ pe.saveState(memento);
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
index c810780fe..aa926628c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
@@ -32,26 +32,26 @@ public class BreakpointTypeOrganizer extends AbstractBreakpointOrganizerDelegate
private Map<String, IAdaptable[]> fTypes = new HashMap<>();
- @Override
+ @Override
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- IBreakpointTypeCategory category = breakpoint.getAdapter(IBreakpointTypeCategory.class);
- if (category != null) {
- return new IAdaptable[]{category};
- }
- String name = DebugPlugin.getDefault().getBreakpointManager().getTypeName(breakpoint);
- if (name != null) {
- IAdaptable[] categories = fTypes.get(name);
- if (categories == null) {
- categories = new IAdaptable[]{new BreakpointTypeCategory(name)};
- fTypes.put(name, categories);
- }
- return categories;
- }
- return null;
- }
+ IBreakpointTypeCategory category = breakpoint.getAdapter(IBreakpointTypeCategory.class);
+ if (category != null) {
+ return new IAdaptable[]{category};
+ }
+ String name = DebugPlugin.getDefault().getBreakpointManager().getTypeName(breakpoint);
+ if (name != null) {
+ IAdaptable[] categories = fTypes.get(name);
+ if (categories == null) {
+ categories = new IAdaptable[]{new BreakpointTypeCategory(name)};
+ fTypes.put(name, categories);
+ }
+ return categories;
+ }
+ return null;
+ }
- @Override
+ @Override
public void dispose() {
- fTypes.clear();
- }
+ fTypes.clear();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
index 6134a9a71..f35696e10 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
@@ -34,7 +34,7 @@ public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAda
@Override
public IAdaptable[] adaptElements(IWorkingSet ws, IAdaptable[] elements) {
for (int i = 0; i < elements.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
if (breakpoint != null) {
return selectBreakpoints(elements);
}
@@ -45,7 +45,7 @@ public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAda
private IAdaptable[] selectBreakpoints(IAdaptable[] elements) {
List<IBreakpoint> breakpoints = new ArrayList<>(elements.length);
for (int i = 0; i < elements.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
if (breakpoint != null) {
breakpoints.add(breakpoint);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
index 5f021a796..47c2e2716 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
@@ -172,7 +172,7 @@ public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetP
ArrayList<IBreakpoint> elements = new ArrayList<>();
//weed out non-breakpoint elements since 3.2
for(int i = 0; i < adaptable.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(adaptable[i], IBreakpoint.class);
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(adaptable[i], IBreakpoint.class);
if(breakpoint != null) {
elements.add(breakpoint);
}//end if
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
index 37a66b30c..f720c8346 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
@@ -59,9 +59,9 @@ public class BreakpointsComparator extends ViewerComparator {
*/
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- if (!(e1 instanceof IBreakpoint)) {
- return super.compare(viewer, e1, e2);
- }
+ if (!(e1 instanceof IBreakpoint)) {
+ return super.compare(viewer, e1, e2);
+ }
IBreakpoint b1= (IBreakpoint)e1;
IBreakpoint b2= (IBreakpoint)e2;
@@ -138,7 +138,7 @@ public class BreakpointsComparator extends ViewerComparator {
* E.g.
* <p><code>
* "0", "1", "9", "11"
- * <p></code>
+ * <p></code>
*
* Note that String.compareTo orders "11" before "9".
*
@@ -146,10 +146,10 @@ public class BreakpointsComparator extends ViewerComparator {
* in this case the numerical value is compared.
* E.g.
* <p><code>
- * stringNumberCompareTo("a_01", "a_1") returns 0.
- * <p></code>
- * Note: For now no additional elements (spaces) are considered, for numbers only base 10 numbers are supported.
- *
+ * stringNumberCompareTo("a_01", "a_1") returns 0.
+ * <p></code>
+ * Note: For now no additional elements (spaces) are considered, for numbers only base 10 numbers are supported.
+ *
* @param n1 the first string to compare
* @param n2 the second string to compare
* @return
@@ -162,8 +162,8 @@ public class BreakpointsComparator extends ViewerComparator {
int index2 = 0;
int digitLen = 0; // Number of identical digits prior to the current index position.
for (; index1 < n1.length() && index2 < n2.length(); ) {
- char c1 = n1.charAt(index1);
- char c2 = n2.charAt(index2);
+ char c1 = n1.charAt(index1);
+ char c2 = n2.charAt(index2);
if (c1 != c2) {
// Strings are different starting at index.
@@ -205,8 +205,8 @@ public class BreakpointsComparator extends ViewerComparator {
} else {
digitLen = 0;
}
- index1++;
- index2++;
+ index1++;
+ index2++;
}
// Same characters up to index1/index2. Return < 0 if remaining in n1 is shorter than remaining in n2.
return (n1.length() - index1) - (n2.length() - index2);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
index e7c438e79..7672e1aed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
@@ -35,182 +35,182 @@ import org.eclipse.jface.viewers.Viewer;
*/
public class BreakpointsContentProvider implements ITreeContentProvider, IPropertyChangeListener {
- private IBreakpointOrganizer[] fOrganizers = null;
- private BreakpointsViewer fViewer;
- private Object[] fElements;
- private boolean fDisposed = false;
+ private IBreakpointOrganizer[] fOrganizers = null;
+ private BreakpointsViewer fViewer;
+ private Object[] fElements;
+ private boolean fDisposed = false;
- @Override
+ @Override
public Object[] getChildren(Object parentElement) {
- if (parentElement.equals(DebugPlugin.getDefault().getBreakpointManager())) {
- return fElements;
- } else if (parentElement instanceof BreakpointContainer) {
- return ((BreakpointContainer)parentElement).getChildren();
- }
- return new Object[0];
- }
+ if (parentElement.equals(DebugPlugin.getDefault().getBreakpointManager())) {
+ return fElements;
+ } else if (parentElement instanceof BreakpointContainer) {
+ return ((BreakpointContainer)parentElement).getChildren();
+ }
+ return new Object[0];
+ }
- @Override
+ @Override
public Object getParent(Object element) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
+ return getChildren(element).length > 0;
+ }
- @Override
+ @Override
public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
+ return getChildren(inputElement);
+ }
- @Override
+ @Override
public void dispose() {
- fDisposed = true;
- fElements = null;
- setOrganizers(null);
- }
+ fDisposed = true;
+ fElements = null;
+ setOrganizers(null);
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- fViewer = (BreakpointsViewer)viewer;
- if (newInput != null) {
- reorganize();
- }
- }
+ fViewer = (BreakpointsViewer)viewer;
+ if (newInput != null) {
+ reorganize();
+ }
+ }
- /**
- * Sets the nested order of breakpoint organizers, or <code>null</code>
- * if none.
- *
- * @param organizers the nested order of breakpoint organizers, or <code>null</code>
- * if none
- */
- public void setOrganizers(IBreakpointOrganizer[] organizers) {
- // remove previous listeners
- if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
+ /**
+ * Sets the nested order of breakpoint organizers, or <code>null</code>
+ * if none.
+ *
+ * @param organizers the nested order of breakpoint organizers, or <code>null</code>
+ * if none
+ */
+ public void setOrganizers(IBreakpointOrganizer[] organizers) {
+ // remove previous listeners
+ if (fOrganizers != null) {
+ for (int i = 0; i < fOrganizers.length; i++) {
fOrganizers[i].removePropertyChangeListener(this);
}
- }
+ }
fOrganizers = organizers;
if (organizers != null && organizers.length == 0) {
fOrganizers = null;
}
- // add listeners
- if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
+ // add listeners
+ if (fOrganizers != null) {
+ for (int i = 0; i < fOrganizers.length; i++) {
fOrganizers[i].addPropertyChangeListener(this);
}
- }
- if (!fDisposed) {
- fViewer.getControl().setRedraw(false);
- // maintain expansion based on visible breakpoints
- IBreakpoint[] breakpoints = null;
- if (isShowingGroups()) {
- breakpoints = fViewer.getVisibleBreakpoints();
- }
- reorganize();
- if (isShowingGroups() && breakpoints != null) {
- // restore expansion
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer) fElements[i];
- for (int j = 0; j < breakpoints.length; j++) {
- if (container.contains(breakpoints[j])) {
- fViewer.expandToLevel(container, AbstractTreeViewer.ALL_LEVELS);
- fViewer.updateCheckedState(container);
- break;
- }
- }
+ }
+ if (!fDisposed) {
+ fViewer.getControl().setRedraw(false);
+ // maintain expansion based on visible breakpoints
+ IBreakpoint[] breakpoints = null;
+ if (isShowingGroups()) {
+ breakpoints = fViewer.getVisibleBreakpoints();
+ }
+ reorganize();
+ if (isShowingGroups() && breakpoints != null) {
+ // restore expansion
+ for (int i = 0; i < fElements.length; i++) {
+ BreakpointContainer container = (BreakpointContainer) fElements[i];
+ for (int j = 0; j < breakpoints.length; j++) {
+ if (container.contains(breakpoints[j])) {
+ fViewer.expandToLevel(container, AbstractTreeViewer.ALL_LEVELS);
+ fViewer.updateCheckedState(container);
+ break;
+ }
+ }
- }
- }
- fViewer.getControl().setRedraw(true);
- }
- }
+ }
+ }
+ fViewer.getControl().setRedraw(true);
+ }
+ }
- /**
- * Returns the root containers containing the given breakpoint, or <code>null</code>
- * if none
- *
- * @param breakpoint the breakpoint to get containers for
- * @return root containers containing the given breakpoint or <code>null</code>
- */
- public BreakpointContainer[] getRoots(IBreakpoint breakpoint) {
- if (isShowingGroups()) {
+ /**
+ * Returns the root containers containing the given breakpoint, or <code>null</code>
+ * if none
+ *
+ * @param breakpoint the breakpoint to get containers for
+ * @return root containers containing the given breakpoint or <code>null</code>
+ */
+ public BreakpointContainer[] getRoots(IBreakpoint breakpoint) {
+ if (isShowingGroups()) {
List<BreakpointContainer> list = new ArrayList<>();
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer) fElements[i];
- if (container.contains(breakpoint)) {
- list.add(container);
- }
- }
- return list.toArray(new BreakpointContainer[list.size()]);
- }
- return null;
- }
+ for (int i = 0; i < fElements.length; i++) {
+ BreakpointContainer container = (BreakpointContainer) fElements[i];
+ if (container.contains(breakpoint)) {
+ list.add(container);
+ }
+ }
+ return list.toArray(new BreakpointContainer[list.size()]);
+ }
+ return null;
+ }
- /**
- * Returns the nested order of breakpoint organizers being used, or <code>null</code>
- * if none.
- *
- * @return the nested order of breakpoint organizers being used, or <code>null</code>
- * if none
- */
- IBreakpointOrganizer[] getOrganizers() {
- return fOrganizers;
- }
+ /**
+ * Returns the nested order of breakpoint organizers being used, or <code>null</code>
+ * if none.
+ *
+ * @return the nested order of breakpoint organizers being used, or <code>null</code>
+ * if none
+ */
+ IBreakpointOrganizer[] getOrganizers() {
+ return fOrganizers;
+ }
- /**
- * Organizes the breakpoints based on nested categories, if any.
- */
- protected void reorganize() {
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
- if (fOrganizers == null) {
- fElements = breakpoints;
- } else {
- IBreakpointOrganizer organizer = fOrganizers[0];
+ /**
+ * Organizes the breakpoints based on nested categories, if any.
+ */
+ protected void reorganize() {
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
+ if (fOrganizers == null) {
+ fElements = breakpoints;
+ } else {
+ IBreakpointOrganizer organizer = fOrganizers[0];
Map<IAdaptable, BreakpointContainer> categoriesToContainers = new HashMap<>();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- IAdaptable[] categories = organizer.getCategories(breakpoint);
- if (categories == null || categories.length == 0) {
- categories = OtherBreakpointCategory.getCategories(organizer);
- }
- for (int j = 0; j < categories.length; j++) {
- IAdaptable category = categories[j];
- BreakpointContainer container = categoriesToContainers.get(category);
- if (container == null) {
- IBreakpointOrganizer[] nesting = null;
- if (fOrganizers.length > 1) {
- nesting = new IBreakpointOrganizer[fOrganizers.length - 1];
- System.arraycopy(fOrganizers, 1, nesting, 0, nesting.length);
- }
- container = new BreakpointContainer(category, organizer, nesting);
- categoriesToContainers.put(category, container);
- }
- container.addBreakpoint(breakpoint);
- }
- }
- // add empty categories
- IAdaptable[] emptyCategories = organizer.getCategories();
- if (emptyCategories != null) {
- for (int i = 0; i < emptyCategories.length; i++) {
- IAdaptable category = emptyCategories[i];
- BreakpointContainer container = categoriesToContainers.get(category);
- if (container == null) {
- container = new BreakpointContainer(category, organizer, null);
- categoriesToContainers.put(category, container);
- }
- }
- }
- fElements = categoriesToContainers.values().toArray();
- }
- fViewer.getControl().setRedraw(false);
- fViewer.refresh();
- fViewer.getControl().setRedraw(true);
- }
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ IAdaptable[] categories = organizer.getCategories(breakpoint);
+ if (categories == null || categories.length == 0) {
+ categories = OtherBreakpointCategory.getCategories(organizer);
+ }
+ for (int j = 0; j < categories.length; j++) {
+ IAdaptable category = categories[j];
+ BreakpointContainer container = categoriesToContainers.get(category);
+ if (container == null) {
+ IBreakpointOrganizer[] nesting = null;
+ if (fOrganizers.length > 1) {
+ nesting = new IBreakpointOrganizer[fOrganizers.length - 1];
+ System.arraycopy(fOrganizers, 1, nesting, 0, nesting.length);
+ }
+ container = new BreakpointContainer(category, organizer, nesting);
+ categoriesToContainers.put(category, container);
+ }
+ container.addBreakpoint(breakpoint);
+ }
+ }
+ // add empty categories
+ IAdaptable[] emptyCategories = organizer.getCategories();
+ if (emptyCategories != null) {
+ for (int i = 0; i < emptyCategories.length; i++) {
+ IAdaptable category = emptyCategories[i];
+ BreakpointContainer container = categoriesToContainers.get(category);
+ if (container == null) {
+ container = new BreakpointContainer(category, organizer, null);
+ categoriesToContainers.put(category, container);
+ }
+ }
+ }
+ fElements = categoriesToContainers.values().toArray();
+ }
+ fViewer.getControl().setRedraw(false);
+ fViewer.refresh();
+ fViewer.getControl().setRedraw(true);
+ }
@Override
public void propertyChange(PropertyChangeEvent event) {
@@ -220,41 +220,41 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
}
}
- /**
- * Returns the existing containers the given breakpoint is contained in, or <code>null</code>.
- *
- * @param breakpoint the breakpoint to get containers for
- * @return the existing containers the given breakpoint is contained in, or <code>null</code>
- */
- protected BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
- if (isShowingGroups()) {
- IAdaptable[] categories = fOrganizers[0].getCategories(breakpoint);
- if (categories == null || categories.length == 0) {
- categories = OtherBreakpointCategory.getCategories(fOrganizers[0]);
- }
- BreakpointContainer[] containers = new BreakpointContainer[categories.length];
- int index = 0;
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer)fElements[i];
- for (int j = 0; j < categories.length; j++) {
- IAdaptable category = categories[j];
- if (container.getCategory().equals(category)) {
- containers[index] = container;
- index++;
- }
- }
- }
- return containers;
- }
- return null;
- }
+ /**
+ * Returns the existing containers the given breakpoint is contained in, or <code>null</code>.
+ *
+ * @param breakpoint the breakpoint to get containers for
+ * @return the existing containers the given breakpoint is contained in, or <code>null</code>
+ */
+ protected BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
+ if (isShowingGroups()) {
+ IAdaptable[] categories = fOrganizers[0].getCategories(breakpoint);
+ if (categories == null || categories.length == 0) {
+ categories = OtherBreakpointCategory.getCategories(fOrganizers[0]);
+ }
+ BreakpointContainer[] containers = new BreakpointContainer[categories.length];
+ int index = 0;
+ for (int i = 0; i < fElements.length; i++) {
+ BreakpointContainer container = (BreakpointContainer)fElements[i];
+ for (int j = 0; j < categories.length; j++) {
+ IAdaptable category = categories[j];
+ if (container.getCategory().equals(category)) {
+ containers[index] = container;
+ index++;
+ }
+ }
+ }
+ return containers;
+ }
+ return null;
+ }
- /**
- * Returns whether content is grouped by categories.
- *
- * @return whether content is grouped by categories
- */
- protected boolean isShowingGroups() {
- return fOrganizers != null;
- }
+ /**
+ * Returns whether content is grouped by categories.
+ *
+ * @return whether content is grouped by categories
+ */
+ protected boolean isShowingGroups() {
+ return fOrganizers != null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
index 485d369ac..fbdadf001 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
@@ -32,80 +32,80 @@ import org.eclipse.swt.widgets.Item;
*/
public class BreakpointsDragAdapter extends DragSourceAdapter implements TransferDragSourceListener {
- /**
- * the associated viewer for the adapter
- */
- private AbstractTreeViewer fViewer;
- private Item[] fItems = null;
+ /**
+ * the associated viewer for the adapter
+ */
+ private AbstractTreeViewer fViewer;
+ private Item[] fItems = null;
- private BreakpointsView fView;
- private TreePath[] fTreePaths = null;
+ private BreakpointsView fView;
+ private TreePath[] fTreePaths = null;
- /**
- * Constructor
- * @param viewer the associated viewer, which acts as the selection provider and therefore <b>must</b> implement <code>ISelectionProvider</code>
- */
- public BreakpointsDragAdapter(BreakpointsViewer viewer) {
- Assert.isNotNull(viewer);
- fViewer = viewer;
- }
- public BreakpointsDragAdapter(AbstractTreeViewer viewer, BreakpointsView view) {
- Assert.isNotNull(view);
- fViewer = viewer;
- fView = view;
- }
+ /**
+ * Constructor
+ * @param viewer the associated viewer, which acts as the selection provider and therefore <b>must</b> implement <code>ISelectionProvider</code>
+ */
+ public BreakpointsDragAdapter(BreakpointsViewer viewer) {
+ Assert.isNotNull(viewer);
+ fViewer = viewer;
+ }
+ public BreakpointsDragAdapter(AbstractTreeViewer viewer, BreakpointsView view) {
+ Assert.isNotNull(view);
+ fViewer = viewer;
+ fView = view;
+ }
- @Override
+ @Override
public Transfer getTransfer() {
- return LocalSelectionTransfer.getTransfer();
- }
+ return LocalSelectionTransfer.getTransfer();
+ }
- @Override
+ @Override
public void dragStart(DragSourceEvent event) {
- ISelection selection = fViewer.getSelection();
- LocalSelectionTransfer.getTransfer().setSelection(selection);
- LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL);
- if (fViewer instanceof BreakpointsViewer) {
- BreakpointsViewer viewer = (BreakpointsViewer)fViewer;
- fItems = viewer.getSelectedItems();
- event.doit = viewer.canDrag(fItems);
- } else {
- if (selection instanceof ITreeSelection) {
- fTreePaths = ((ITreeSelection) selection).getPaths();
- } else {
- fTreePaths = new TreePath[0];
- }
- event.doit = fView.canDrag(fTreePaths);
- }
- }
+ ISelection selection = fViewer.getSelection();
+ LocalSelectionTransfer.getTransfer().setSelection(selection);
+ LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL);
+ if (fViewer instanceof BreakpointsViewer) {
+ BreakpointsViewer viewer = (BreakpointsViewer)fViewer;
+ fItems = viewer.getSelectedItems();
+ event.doit = viewer.canDrag(fItems);
+ } else {
+ if (selection instanceof ITreeSelection) {
+ fTreePaths = ((ITreeSelection) selection).getPaths();
+ } else {
+ fTreePaths = new TreePath[0];
+ }
+ event.doit = fView.canDrag(fTreePaths);
+ }
+ }
- /* non Java-doc
- * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData
- */
- @Override
+ /* non Java-doc
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData
+ */
+ @Override
public void dragSetData(DragSourceEvent event) {
- // For consistency set the data to the selection even though
- // the selection is provided by the LocalSelectionTransfer
- // to the drop target adapter.
- event.data = LocalSelectionTransfer.getTransfer().getSelection();
- }
+ // For consistency set the data to the selection even though
+ // the selection is provided by the LocalSelectionTransfer
+ // to the drop target adapter.
+ event.data = LocalSelectionTransfer.getTransfer().getSelection();
+ }
- /* non Java-doc
- * @see org.eclipse.swt.dnd.DragSourceListener#dragFinished
- */
- @Override
+ /* non Java-doc
+ * @see org.eclipse.swt.dnd.DragSourceListener#dragFinished
+ */
+ @Override
public void dragFinished(DragSourceEvent event) {
- if (event.detail == DND.DROP_MOVE) {
- // remove from source on move operation
- if (fViewer instanceof BreakpointsViewer) {
- BreakpointsViewer viewer = (BreakpointsViewer)fViewer;
- viewer.performDrag(fItems);
- } else {
- fView.performDrag(fTreePaths);
- }
- }
- fItems = null;
- LocalSelectionTransfer.getTransfer().setSelection(null);
- LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
- }
+ if (event.detail == DND.DROP_MOVE) {
+ // remove from source on move operation
+ if (fViewer instanceof BreakpointsViewer) {
+ BreakpointsViewer viewer = (BreakpointsViewer)fViewer;
+ viewer.performDrag(fItems);
+ } else {
+ fView.performDrag(fTreePaths);
+ }
+ }
+ fItems = null;
+ LocalSelectionTransfer.getTransfer().setSelection(null);
+ LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
index 3f3f6ee35..85c59a891 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
@@ -38,36 +38,36 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter {
private TreePath fPath = null;
private BreakpointsView fView;
- /**
- * Constructor
- * @param viewer the backing viewer
- */
- protected BreakpointsDropAdapter(TreeViewer viewer) {
- super(viewer);
- setFeedbackEnabled(false);
- }
+ /**
+ * Constructor
+ * @param viewer the backing viewer
+ */
+ protected BreakpointsDropAdapter(TreeViewer viewer) {
+ super(viewer);
+ setFeedbackEnabled(false);
+ }
- protected BreakpointsDropAdapter(TreeViewer viewer, BreakpointsView view) {
- this(viewer);
- fView = view;
- }
+ protected BreakpointsDropAdapter(TreeViewer viewer, BreakpointsView view) {
+ this(viewer);
+ fView = view;
+ }
- /**
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
- */
- @Override
+ /**
+ * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
+ */
+ @Override
public boolean performDrop(Object data) {
- // This is temporary
- if (getViewer() instanceof BreakpointsViewer) {
- return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection());
- } else if (fView != null) {
- ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
- if (fPath != null && selection instanceof ITreeSelection) {
+ // This is temporary
+ if (getViewer() instanceof BreakpointsViewer) {
+ return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection());
+ } else if (fView != null) {
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ if (fPath != null && selection instanceof ITreeSelection) {
return fView.performDrop(fPath, (ITreeSelection) selection);
- }
- }
- return false;
- }
+ }
+ }
+ return false;
+ }
/**
* @see org.eclipse.jface.viewers.ViewerDropAdapter#determineTarget(org.eclipse.swt.dnd.DropTargetEvent)
@@ -89,20 +89,20 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter {
return fTarget;
}
- /**
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
- */
- @Override
+ /**
+ * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
+ */
+ @Override
public boolean validateDrop(Object target, int operation, TransferData transferType) {
- // This is temporary
- if (getViewer() instanceof BreakpointsViewer) {
- return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection());
- } else {
- ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
- if (fPath != null && selection instanceof ITreeSelection) {
+ // This is temporary
+ if (getViewer() instanceof BreakpointsViewer) {
+ return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection());
+ } else {
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ if (fPath != null && selection instanceof ITreeSelection) {
return fView.canDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getTransfer().getSelection());
- }
- }
- return false;
- }
+ }
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java
index 3b096d177..a9fc85730 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java
@@ -30,74 +30,74 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
*/
public class BreakpointsLabelProvider extends LabelProvider implements IFontProvider {
- private WorkbenchLabelProvider fWorkbenchLabelProvider;
- private IDebugModelPresentation fPresentation;
+ private WorkbenchLabelProvider fWorkbenchLabelProvider;
+ private IDebugModelPresentation fPresentation;
- /**
- * Constructs a new label provide for the breakpoints view.
- */
- public BreakpointsLabelProvider() {
- fWorkbenchLabelProvider = new WorkbenchLabelProvider();
- fPresentation = DebugUITools.newDebugModelPresentation();
- }
+ /**
+ * Constructs a new label provide for the breakpoints view.
+ */
+ public BreakpointsLabelProvider() {
+ fWorkbenchLabelProvider = new WorkbenchLabelProvider();
+ fPresentation = DebugUITools.newDebugModelPresentation();
+ }
- @Override
+ @Override
public void dispose() {
- fWorkbenchLabelProvider.dispose();
- fPresentation.dispose();
- super.dispose();
- }
+ fWorkbenchLabelProvider.dispose();
+ fPresentation.dispose();
+ super.dispose();
+ }
- @Override
+ @Override
public Image getImage(Object element) {
- if (element instanceof IBreakpoint) {
- return fPresentation.getImage(element);
- }
- Image image = fWorkbenchLabelProvider.getImage(element);
- if (image != null) {
- int flags= computeAdornmentFlags();
- if (flags > 0) {
- CompositeDebugImageDescriptor descriptor= new CompositeDebugImageDescriptor(image, flags);
- return DebugUIPlugin.getImageDescriptorRegistry().get(descriptor);
- }
- }
- return image;
- }
+ if (element instanceof IBreakpoint) {
+ return fPresentation.getImage(element);
+ }
+ Image image = fWorkbenchLabelProvider.getImage(element);
+ if (image != null) {
+ int flags= computeAdornmentFlags();
+ if (flags > 0) {
+ CompositeDebugImageDescriptor descriptor= new CompositeDebugImageDescriptor(image, flags);
+ return DebugUIPlugin.getImageDescriptorRegistry().get(descriptor);
+ }
+ }
+ return image;
+ }
/**
- * Computes and return common adornment flags for the given category.
- *
- * @return adornment flags defined in CompositeDebugImageDescriptor
- */
- private int computeAdornmentFlags() {
- if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
- return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
- }
- return 0;
- }
+ * Computes and return common adornment flags for the given category.
+ *
+ * @return adornment flags defined in CompositeDebugImageDescriptor
+ */
+ private int computeAdornmentFlags() {
+ if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
+ return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
+ }
+ return 0;
+ }
- @Override
+ @Override
public String getText(Object element) {
- if (element instanceof IBreakpoint) {
- return fPresentation.getText(element);
- }
- return fWorkbenchLabelProvider.getText(element);
- }
+ if (element instanceof IBreakpoint) {
+ return fPresentation.getText(element);
+ }
+ return fWorkbenchLabelProvider.getText(element);
+ }
- @Override
+ @Override
public Font getFont(Object element) {
- if (element instanceof IBreakpoint) {
- return null;
- }
- return fWorkbenchLabelProvider.getFont(element);
- }
+ if (element instanceof IBreakpoint) {
+ return null;
+ }
+ return fWorkbenchLabelProvider.getFont(element);
+ }
- /**
- * Returns the debug model presentation used by this label provider.
- *
- * @return the debug model presentation used by this label provider
- */
- public IDebugModelPresentation getPresentation() {
- return fPresentation;
- }
+ /**
+ * Returns the debug model presentation used by this label provider.
+ *
+ * @return the debug model presentation used by this label provider
+ */
+ public IDebugModelPresentation getPresentation() {
+ return fPresentation;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
index 76a100ff5..fa3719e8e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
@@ -146,9 +146,9 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
IPresentationContext presentationContext = viewer.getPresentationContext();
presentationContext.setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS, fOrganizers);
- presentationContext.setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR, new ElementComparator(presentationContext));
+ presentationContext.setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR, new ElementComparator(presentationContext));
- return viewer;
+ return viewer;
}
@Override
@@ -160,11 +160,11 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
*/
@Override
public String getText(Object element) {
- IDebugModelPresentation lp= getConfiguredPresentation(element);
- if (lp != null) {
- return lp.getText(element);
- }
- return getDefaultText(element);
+ IDebugModelPresentation lp= getConfiguredPresentation(element);
+ if (lp != null) {
+ return lp.getText(element);
+ }
+ return getDefaultText(element);
}
};
}
@@ -220,7 +220,7 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
SkipAllBreakpointsAction skipAll = new SkipAllBreakpointsAction(this);
setAction(ACTION_SKIP_BREAKPOINTS, skipAll);
skipAll.setActionDefinitionId(SkipAllBreakpointsAction.ACTION_DEFINITION_ID);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this);
fClipboard = new Clipboard(getSite().getShell().getDisplay());
@@ -229,8 +229,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
paste.setActionDefinitionId(ActionFactory.PASTE.getCommandId());
//actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
setGlobalAction(PASTE_ACTION, paste);
- getViewer().addSelectionChangedListener(paste);
- paste.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
+ getViewer().addSelectionChangedListener(paste);
+ paste.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
SelectionListenerAction remove = new RemoveFromWorkingSetAction(this);
setAction(ACTION_REMOVE_FROM_GROUP, remove);
@@ -264,7 +264,7 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
return;
}
- IPresentationContext presentationContext = getTreeModelViewer().getPresentationContext();
+ IPresentationContext presentationContext = getTreeModelViewer().getPresentationContext();
if (selection == null || selection.isEmpty()) {
Object input = new DefaultBreakpointsViewInput(presentationContext);
@@ -293,20 +293,20 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
// Expand all elements when the view is first shown. (bug 297762)
if (!fFirstInputSet) {
- fFirstInputSet = true;
- expandAllElementsInViewer();
+ fFirstInputSet = true;
+ expandAllElementsInViewer();
}
}
@Override
protected void viewerInputUpdateComplete(IViewerInputUpdate update) {
// handles non-standard debug model
- IStatus status = update.getStatus();
- if ( (status == null || status.isOK()) && update.getElement() != null) {
- setViewerInput(update.getInputElement());
- } else {
- setViewerInput(new DefaultBreakpointsViewInput(getTreeModelViewer().getPresentationContext()));
- }
+ IStatus status = update.getStatus();
+ if ( (status == null || status.isOK()) && update.getElement() != null) {
+ setViewerInput(update.getInputElement());
+ } else {
+ setViewerInput(new DefaultBreakpointsViewInput(getTreeModelViewer().getPresentationContext()));
+ }
}
@@ -316,12 +316,12 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
* @return whether this view is currently tracking the debug view's selection
*/
public boolean isTrackingSelection() {
- final TreeModelViewer viewer = getTreeModelViewer();
- if (viewer != null) {
- return Boolean.TRUE.equals(
- viewer.getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION) );
- }
- return false;
+ final TreeModelViewer viewer = getTreeModelViewer();
+ if (viewer != null) {
+ return Boolean.TRUE.equals(
+ viewer.getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION) );
+ }
+ return false;
}
/**
@@ -334,8 +334,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
final TreeModelViewer viewer = getTreeModelViewer();
if (viewer != null) {
viewer.getPresentationContext().setProperty(
- IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION,
- trackSelection ? Boolean.TRUE : Boolean.FALSE);
+ IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION,
+ trackSelection ? Boolean.TRUE : Boolean.FALSE);
}
}
@@ -348,55 +348,55 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
if (node == null) {
fOrganizers = null;
- } else {
+ } else {
String value = node.getString(KEY_VALUE);
- if (value != null) {
- String[] ids = value.split(","); //$NON-NLS-1$
- BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault();
+ if (value != null) {
+ String[] ids = value.split(","); //$NON-NLS-1$
+ BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault();
List<IBreakpointOrganizer> organziers = new ArrayList<>();
- for (int i = 0; i < ids.length; i++) {
- IBreakpointOrganizer organizer = manager.getOrganizer(ids[i]);
- if (organizer != null) {
- organziers.add(organizer);
- }
- }
- fOrganizers = organziers.toArray(new IBreakpointOrganizer[organziers.size()]);
-
- for (int i = 0; i < fOrganizers.length; i++) {
+ for (int i = 0; i < ids.length; i++) {
+ IBreakpointOrganizer organizer = manager.getOrganizer(ids[i]);
+ if (organizer != null) {
+ organziers.add(organizer);
+ }
+ }
+ fOrganizers = organziers.toArray(new IBreakpointOrganizer[organziers.size()]);
+
+ for (int i = 0; i < fOrganizers.length; i++) {
fOrganizers[i].addPropertyChangeListener(this);
}
- }
+ }
}
}
}
- /**
- * Initializes drag and drop for the breakpoints viewer
- * @param viewer the viewer to add drag and drop support to
- */
+ /**
+ * Initializes drag and drop for the breakpoints viewer
+ * @param viewer the viewer to add drag and drop support to
+ */
@Override
protected void initDragAndDrop(TreeModelViewer viewer) {
- int ops = DND.DROP_MOVE | DND.DROP_COPY;
- // drop
- viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new BreakpointsDropAdapter(viewer, this));
- // Drag
- viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new BreakpointsDragAdapter(viewer, this));
- }
+ int ops = DND.DROP_MOVE | DND.DROP_COPY;
+ // drop
+ viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new BreakpointsDropAdapter(viewer, this));
+ // Drag
+ viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new BreakpointsDragAdapter(viewer, this));
+ }
@Override
public void saveViewerState(IMemento memento) {
StringBuilder buffer = new StringBuilder();
- if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
- IBreakpointOrganizer organizer = fOrganizers[i];
- buffer.append(organizer.getIdentifier());
- if (i < (fOrganizers.length - 1)) {
- buffer.append(',');
- }
- }
- IMemento node = memento.createChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- node.putString(KEY_VALUE, buffer.toString());
- }
+ if (fOrganizers != null) {
+ for (int i = 0; i < fOrganizers.length; i++) {
+ IBreakpointOrganizer organizer = fOrganizers[i];
+ buffer.append(organizer.getIdentifier());
+ if (i < (fOrganizers.length - 1)) {
+ buffer.append(',');
+ }
+ }
+ IMemento node = memento.createChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
+ node.putString(KEY_VALUE, buffer.toString());
+ }
super.saveViewerState(memento);
}
@@ -464,7 +464,7 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
if (viewer != null) {
// update the presentation context filter
viewer.getPresentationContext().setProperty(
- IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION, filter ? Boolean.TRUE : Boolean.FALSE);
+ IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION, filter ? Boolean.TRUE : Boolean.FALSE);
}
}
@@ -482,31 +482,31 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
* Expands all elements in the viewer.
*/
public void expandAllElementsInViewer() {
- Display display = getSite().getShell().getDisplay();
+ Display display = getSite().getShell().getDisplay();
- final VirtualTreeModelViewer virtualViewer = new VirtualTreeModelViewer(
- display, 0, ((ITreeModelViewer)getViewer()).getPresentationContext());
+ final VirtualTreeModelViewer virtualViewer = new VirtualTreeModelViewer(
+ display, 0, ((ITreeModelViewer)getViewer()).getPresentationContext());
- virtualViewer.setAutoExpandLevel(-1);
- virtualViewer.addViewerUpdateListener(new IViewerUpdateListener() {
- @Override
+ virtualViewer.setAutoExpandLevel(-1);
+ virtualViewer.addViewerUpdateListener(new IViewerUpdateListener() {
+ @Override
public void viewerUpdatesComplete() {
- ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
- virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
- ITreeModelViewer treeModelViewer = ((ITreeModelViewer) getViewer());
- if (treeModelViewer != null) {
- ((ITreeModelViewer) getViewer()).updateViewer(stateDelta);
- }
- virtualViewer.dispose();
- }
- @Override
+ ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
+ virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
+ ITreeModelViewer treeModelViewer = ((ITreeModelViewer) getViewer());
+ if (treeModelViewer != null) {
+ ((ITreeModelViewer) getViewer()).updateViewer(stateDelta);
+ }
+ virtualViewer.dispose();
+ }
+ @Override
public void viewerUpdatesBegin() {}
- @Override
+ @Override
public void updateStarted(IViewerUpdate update) {}
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {}
- });
- virtualViewer.setInput(getViewer().getInput());
+ });
+ virtualViewer.setInput(getViewer().getInput());
}
@@ -520,120 +520,120 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
}
/**
- * Returns whether the given selection can be pasted into the given target.
- * <p>
- * Scheme:
- * <ul>
- * <li>Breakpoints can only be pasted into allowable containers (i..e. like workings sets)</li>
- * <li>Breakpoints can only be pasted into containers that they do not already reside in</li>
- * <li>Breakpoints can only be pasted into containers, not other breakpoints</li>
- * </ul>
- * </p>
- *
- * @param target target of the paste
- * @param selection the selection to paste
- * @return whether the given selection can be pasted into the given target
- *
- * TODO Remove in favor of using <code>TreeItem</code>s and <code>TreePath</code>s to determine paste targets
- */
- public boolean canPaste(Object target, ISelection selection) {
- if(!(target instanceof IBreakpointContainer) || !(selection instanceof IStructuredSelection)) {
- return false;
- }
- if(selection == null || selection.isEmpty()) {
- return false;
- }
- IStructuredSelection ss = (IStructuredSelection) selection;
- IBreakpointContainer container = (IBreakpointContainer) target;
+ * Returns whether the given selection can be pasted into the given target.
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>Breakpoints can only be pasted into allowable containers (i..e. like workings sets)</li>
+ * <li>Breakpoints can only be pasted into containers that they do not already reside in</li>
+ * <li>Breakpoints can only be pasted into containers, not other breakpoints</li>
+ * </ul>
+ * </p>
+ *
+ * @param target target of the paste
+ * @param selection the selection to paste
+ * @return whether the given selection can be pasted into the given target
+ *
+ * TODO Remove in favor of using <code>TreeItem</code>s and <code>TreePath</code>s to determine paste targets
+ */
+ public boolean canPaste(Object target, ISelection selection) {
+ if(!(target instanceof IBreakpointContainer) || !(selection instanceof IStructuredSelection)) {
+ return false;
+ }
+ if(selection == null || selection.isEmpty()) {
+ return false;
+ }
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ IBreakpointContainer container = (IBreakpointContainer) target;
for (Iterator<?> iter = ss.iterator(); iter.hasNext();) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
- if (breakpoint == null || container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Pastes the selection into the given target
- *
- * @param target target of the paste, either a IBreakpointContainer,
- * or a Breakpoint within a IBreakpointContainer
- * @param selection breakpoints
- * @return whether successful
- *
- * TODO remove in favor of using <code>TreeItem</code> as paste target
- */
- public boolean performPaste(Object target, ISelection selection) {
- if (target instanceof IBreakpointContainer && selection instanceof IStructuredSelection) {
- IBreakpointContainer container = (IBreakpointContainer) target;
- Object[] objects = ((IStructuredSelection)selection).toArray();
- for (int i = 0; i < objects.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(objects[i], IBreakpoint.class);
- if (breakpoint != null) {
- container.getOrganizer().addBreakpoint(breakpoint, container.getCategory());
- }
- }
- return true;
- }
- return false;
- }
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
+ if (breakpoint == null || container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Pastes the selection into the given target
+ *
+ * @param target target of the paste, either a IBreakpointContainer,
+ * or a Breakpoint within a IBreakpointContainer
+ * @param selection breakpoints
+ * @return whether successful
+ *
+ * TODO remove in favor of using <code>TreeItem</code> as paste target
+ */
+ public boolean performPaste(Object target, ISelection selection) {
+ if (target instanceof IBreakpointContainer && selection instanceof IStructuredSelection) {
+ IBreakpointContainer container = (IBreakpointContainer) target;
+ Object[] objects = ((IStructuredSelection)selection).toArray();
+ for (int i = 0; i < objects.length; i++) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(objects[i], IBreakpoint.class);
+ if (breakpoint != null) {
+ container.getOrganizer().addBreakpoint(breakpoint, container.getCategory());
+ }
+ }
+ return true;
+ }
+ return false;
+ }
/**
- * Returns the container from within the specified path that is the container the breakpoint can be removed from
+ * Returns the container from within the specified path that is the container the breakpoint can be removed from
* @param path the path to get the container from
- * @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
- * @since 3.3
- */
- public IBreakpointContainer getRemovableContainer(TreePath path) {
- if (path != null) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
- if (breakpoint != null) {
- IBreakpointContainer container = null;
- for(int i = path.getSegmentCount()-2; i > -1; i--) {
- Object segment = path.getSegment(i);
- if (segment instanceof IBreakpointContainer) {
- container = (IBreakpointContainer) segment;
- if(container.contains(breakpoint) &&
- container.getOrganizer() != null &&
- container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
- return container;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the addable breakpoint container of the specified tree path
- * @param path the path to get the container for
- * @return the first found addable container for the specified tree path or <code>null</code> if none found
- * @since 3.3
- */
- protected IBreakpointContainer getAddableContainer(TreePath path) {
- if (path != null) {
- Object element = path.getLastSegment();
- if (element instanceof IBreakpointContainer) {
- return (IBreakpointContainer)element;
- }
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class);
- if (breakpoint != null) {
- IBreakpointContainer container = null;
- for (int i = path.getSegmentCount()-2; i > -1; i--) {
- Object segment = path.getSegment(i);
- if (segment instanceof IBreakpointContainer) {
- container = (IBreakpointContainer) segment;
- if (container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return container;
- }
- }
- }
- }
- }
- return null;
- }
+ * @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
+ * @since 3.3
+ */
+ public IBreakpointContainer getRemovableContainer(TreePath path) {
+ if (path != null) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
+ if (breakpoint != null) {
+ IBreakpointContainer container = null;
+ for(int i = path.getSegmentCount()-2; i > -1; i--) {
+ Object segment = path.getSegment(i);
+ if (segment instanceof IBreakpointContainer) {
+ container = (IBreakpointContainer) segment;
+ if(container.contains(breakpoint) &&
+ container.getOrganizer() != null &&
+ container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the addable breakpoint container of the specified tree path
+ * @param path the path to get the container for
+ * @return the first found addable container for the specified tree path or <code>null</code> if none found
+ * @since 3.3
+ */
+ protected IBreakpointContainer getAddableContainer(TreePath path) {
+ if (path != null) {
+ Object element = path.getLastSegment();
+ if (element instanceof IBreakpointContainer) {
+ return (IBreakpointContainer)element;
+ }
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class);
+ if (breakpoint != null) {
+ IBreakpointContainer container = null;
+ for (int i = path.getSegmentCount()-2; i > -1; i--) {
+ Object segment = path.getSegment(i);
+ if (segment instanceof IBreakpointContainer) {
+ container = (IBreakpointContainer) segment;
+ if (container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
/**
* This method is used to determine if there is an addable parent container available for the specified drop target.
* <p>
@@ -652,72 +652,72 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
if (element instanceof IBreakpointContainer) {
IBreakpointContainer container = (IBreakpointContainer) element;
if (container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return false;
- }
+ return false;
+ }
}
}
}
return true;
}
- /**
- * Returns if the selected item in the tree can be dragged
- * <p>
- * Scheme:
- * <ul>
- * <li>breakpoint containers cannot be dragged</li>
- * <li>breakpoints can be dragged iff the container they reside in supports the removal of breakpoints</li>
- * </ul>
- * </p>
- * @param items the tree paths to check if they can be dragged
- * @return true if the selected element can be dragged, false otherwise
- * @since 3.3
- */
- boolean canDrag(TreePath[] items) {
- if(items == null) {
- return false;
- }
- if (items.length == 0) {
- return false;
- }
- for (int i = 0; i < items.length; i++) {
- if (getRemovableContainer(items[i]) == null) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Performs the actual removal of breakpoints from their respective (removable) containers on a successful drag operation
- * @param paths the tree paths to drag
- * @since 3.3
- */
- void performDrag(TreePath[] paths) {
- if (paths == null) {
- return;
- }
+ /**
+ * Returns if the selected item in the tree can be dragged
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>breakpoint containers cannot be dragged</li>
+ * <li>breakpoints can be dragged iff the container they reside in supports the removal of breakpoints</li>
+ * </ul>
+ * </p>
+ * @param items the tree paths to check if they can be dragged
+ * @return true if the selected element can be dragged, false otherwise
+ * @since 3.3
+ */
+ boolean canDrag(TreePath[] items) {
+ if(items == null) {
+ return false;
+ }
+ if (items.length == 0) {
+ return false;
+ }
+ for (int i = 0; i < items.length; i++) {
+ if (getRemovableContainer(items[i]) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Performs the actual removal of breakpoints from their respective (removable) containers on a successful drag operation
+ * @param paths the tree paths to drag
+ * @since 3.3
+ */
+ void performDrag(TreePath[] paths) {
+ if (paths == null) {
+ return;
+ }
Map<IBreakpointContainer, List<IBreakpoint>> containersToBreakpoints = new HashMap<>();
- for (int i = 0; i < paths.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(paths[i].getLastSegment(), IBreakpoint.class);
- if (breakpoint != null) {
- IBreakpointContainer container = getRemovableContainer(paths[i]);
- if(container != null) {
+ for (int i = 0; i < paths.length; i++) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(paths[i].getLastSegment(), IBreakpoint.class);
+ if (breakpoint != null) {
+ IBreakpointContainer container = getRemovableContainer(paths[i]);
+ if(container != null) {
List<IBreakpoint> list = containersToBreakpoints.get(container);
- if (list == null) {
+ if (list == null) {
list = new ArrayList<>();
- containersToBreakpoints.put(container, list);
- }
- list.add(breakpoint);
- }
- }
- }
+ containersToBreakpoints.put(container, list);
+ }
+ list.add(breakpoint);
+ }
+ }
+ }
for (Entry<IBreakpointContainer, List<IBreakpoint>> entry : containersToBreakpoints.entrySet()) {
- IBreakpointContainer container = entry.getKey();
+ IBreakpointContainer container = entry.getKey();
List<IBreakpoint> list = entry.getValue();
- IBreakpointOrganizer organizer = container.getOrganizer();
- IBreakpoint[] breakpoints = list.toArray(new IBreakpoint[list.size()]);
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
+ IBreakpointOrganizer organizer = container.getOrganizer();
+ IBreakpoint[] breakpoints = list.toArray(new IBreakpoint[list.size()]);
+ if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
extension.removeBreakpoints(breakpoints, container.getCategory());
} else {
@@ -725,71 +725,71 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
organizer.removeBreakpoint(breakpoints[i], container.getCategory());
}
}
- }
- }
+ }
+ }
/**
- * Performs the actual addition of the selected breakpoints to the specified target
- * @param target the target to add the selection of breakpoints to
- * @param selection the selection of breakpoints
- * @return true if the drop occurred, false otherwise
- * @since 3.3
- */
- protected boolean performDrop(TreePath target, ITreeSelection selection) {
+ * Performs the actual addition of the selected breakpoints to the specified target
+ * @param target the target to add the selection of breakpoints to
+ * @param selection the selection of breakpoints
+ * @return true if the drop occurred, false otherwise
+ * @since 3.3
+ */
+ protected boolean performDrop(TreePath target, ITreeSelection selection) {
if(target == null || selection == null) {
- return false;
- }
- IBreakpointContainer container = getAddableContainer(target);
- if (container == null) {
+ return false;
+ }
+ IBreakpointContainer container = getAddableContainer(target);
+ if (container == null) {
return false;
}
- IBreakpointOrganizer organizer = container.getOrganizer();
+ IBreakpointOrganizer organizer = container.getOrganizer();
List<IBreakpoint> breakpoints = new ArrayList<>(selection.size());
for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
- IBreakpoint breakpoint = (IBreakpoint) DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
- if (breakpoint != null) {
- breakpoints.add(breakpoint);
- }
- }
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
- IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
- extension.addBreakpoints(
- breakpoints.toArray(new IBreakpoint[breakpoints.size()]),
- container.getCategory());
- } else {
- for (int i = 0; i < breakpoints.size(); i++) {
- organizer.addBreakpoint(breakpoints.get(i), container.getCategory());
- }
- }
- // TODO expandToLevel(target.getData(), ALL_LEVELS);
- return true;
- }
-
- /**
- * Determines if the specified element can be dropped into the specified target
- * <p>
- * Scheme:
- * <ul>
- * <li>Breakpoints can be dropped into working sets</li>
- * <li>Breakpoints can be dropped into breakpoints, provided there is a drop-able parent of the target breakpoint</li>
- * </ul>
- * </p>
- * @param target the target for the drop
- * @param selection the selection to see if we can drop
- * @return true if the specified element can be dropped into the specified target, false otherwise
- * @since 3.3
- */
- boolean canDrop(TreePath target, ITreeSelection selection) {
- if (selection == null || target == null) {
- return false;
- }
+ IBreakpoint breakpoint = (IBreakpoint) DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
+ if (breakpoint != null) {
+ breakpoints.add(breakpoint);
+ }
+ }
+ if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
+ IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
+ extension.addBreakpoints(
+ breakpoints.toArray(new IBreakpoint[breakpoints.size()]),
+ container.getCategory());
+ } else {
+ for (int i = 0; i < breakpoints.size(); i++) {
+ organizer.addBreakpoint(breakpoints.get(i), container.getCategory());
+ }
+ }
+ // TODO expandToLevel(target.getData(), ALL_LEVELS);
+ return true;
+ }
+
+ /**
+ * Determines if the specified element can be dropped into the specified target
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>Breakpoints can be dropped into working sets</li>
+ * <li>Breakpoints can be dropped into breakpoints, provided there is a drop-able parent of the target breakpoint</li>
+ * </ul>
+ * </p>
+ * @param target the target for the drop
+ * @param selection the selection to see if we can drop
+ * @return true if the specified element can be dropped into the specified target, false otherwise
+ * @since 3.3
+ */
+ boolean canDrop(TreePath target, ITreeSelection selection) {
+ if (selection == null || target == null) {
+ return false;
+ }
for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
- if (breakpoint == null || !checkAddableParentContainers(target, breakpoint)){
- return false;
- }
- }
- return true;
- }
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
+ if (breakpoint == null || !checkAddableParentContainers(target, breakpoint)){
+ return false;
+ }
+ }
+ return true;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
index c72c2333c..437bfd1dd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
@@ -43,202 +43,202 @@ import org.eclipse.swt.widgets.Widget;
*/
public class BreakpointsViewer extends CheckboxTreeViewer {
- /**
- * Constructs a new breakpoints viewer with the given tree.
- *
- * @param tree the backing tree widget
- */
- public BreakpointsViewer(Tree tree) {
- super(tree);
- }
+ /**
+ * Constructs a new breakpoints viewer with the given tree.
+ *
+ * @param tree the backing tree widget
+ */
+ public BreakpointsViewer(Tree tree) {
+ super(tree);
+ }
- /**
- * Returns the selected items.
- *
- * @return selected items
- */
- public Item[] getSelectedItems() {
- return getSelection(getControl());
- }
+ /**
+ * Returns the selected items.
+ *
+ * @return selected items
+ */
+ public Item[] getSelectedItems() {
+ return getSelection(getControl());
+ }
- /**
- * Returns the item associated with the given element, or <code>null</code>.
- *
- * @param element element in breakpoints view
- * @return item associated with the given element, or <code>null</code>
- */
- public Widget searchItem(Object element) {
- return findItem(element);
- }
+ /**
+ * Returns the item associated with the given element, or <code>null</code>.
+ *
+ * @param element element in breakpoints view
+ * @return item associated with the given element, or <code>null</code>
+ */
+ public Widget searchItem(Object element) {
+ return findItem(element);
+ }
- /**
- * Refreshes the given item in the tree.
- *
- * @param item item to refresh
- */
- public void refreshItem(TreeItem item) {
- updateItem(item, item.getData());
- }
+ /**
+ * Refreshes the given item in the tree.
+ *
+ * @param item item to refresh
+ */
+ public void refreshItem(TreeItem item) {
+ updateItem(item, item.getData());
+ }
- /**
- * Returns a collection of currently visible breakpoints.
- *
- * @return collection of currently visible breakpoints
- */
- public IBreakpoint[] getVisibleBreakpoints() {
- IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
- Object[] elements= ((ITreeContentProvider)getContentProvider()).getElements(manager);
+ /**
+ * Returns a collection of currently visible breakpoints.
+ *
+ * @return collection of currently visible breakpoints
+ */
+ public IBreakpoint[] getVisibleBreakpoints() {
+ IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
+ Object[] elements= ((ITreeContentProvider)getContentProvider()).getElements(manager);
List<IBreakpoint> list = new ArrayList<>();
- for (int i = 0; i < elements.length; i++) {
- TreeItem item = (TreeItem) searchItem(elements[i]);
- if (item != null) {
- collectExpandedBreakpoints(item, list);
- }
- }
- return list.toArray(new IBreakpoint[list.size()]);
- }
+ for (int i = 0; i < elements.length; i++) {
+ TreeItem item = (TreeItem) searchItem(elements[i]);
+ if (item != null) {
+ collectExpandedBreakpoints(item, list);
+ }
+ }
+ return list.toArray(new IBreakpoint[list.size()]);
+ }
- /**
- * Adds expanded breakpoints to the list. Traverses children of the given
- * tree item if any.
- *
- * @param item the item to get breakpoints from
- * @param list collection of visible breakpoints
- */
+ /**
+ * Adds expanded breakpoints to the list. Traverses children of the given
+ * tree item if any.
+ *
+ * @param item the item to get breakpoints from
+ * @param list collection of visible breakpoints
+ */
private void collectExpandedBreakpoints(TreeItem item, List<IBreakpoint> list) {
- Object data = item.getData();
- if (data instanceof IBreakpoint) {
+ Object data = item.getData();
+ if (data instanceof IBreakpoint) {
list.add((IBreakpoint) data);
- return;
- }
- if (item.getExpanded()) {
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- collectExpandedBreakpoints(items[i], list);
- }
- }
- }
+ return;
+ }
+ if (item.getExpanded()) {
+ TreeItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ collectExpandedBreakpoints(items[i], list);
+ }
+ }
+ }
- /**
- * Sets the selection to a specific tree item
- *
- * @param item the item to set as the current tree selection
- */
- protected void setSelection(TreeItem item) {
- getTree().setSelection(new TreeItem[]{item});
- updateSelection(getSelection());
- }
+ /**
+ * Sets the selection to a specific tree item
+ *
+ * @param item the item to set as the current tree selection
+ */
+ protected void setSelection(TreeItem item) {
+ getTree().setSelection(new TreeItem[]{item});
+ updateSelection(getSelection());
+ }
/**
- * Returns the container from within the specified path that is the container the breakpoint can be removed from
- * @param item the item to get the container for
- * @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
- * @since 3.3
- */
- public IBreakpointContainer getRemovableContainer(Item item) {
- if(item == null) {
- return null;
- }
- if(item.getData() instanceof IBreakpoint) {
- TreePath path = getTreePathFromItem(item);
- if(path != null) {
- IBreakpoint breakpoint = (IBreakpoint) path.getLastSegment();
- IBreakpointContainer container = null;
- for(int i = path.getSegmentCount()-2; i > -1; i--) {
- container = (IBreakpointContainer) path.getSegment(i);
- if(container.contains(breakpoint) && container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
- return container;
- }
- }
- }
- }
- return null;
- }
+ * Returns the container from within the specified path that is the container the breakpoint can be removed from
+ * @param item the item to get the container for
+ * @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
+ * @since 3.3
+ */
+ public IBreakpointContainer getRemovableContainer(Item item) {
+ if(item == null) {
+ return null;
+ }
+ if(item.getData() instanceof IBreakpoint) {
+ TreePath path = getTreePathFromItem(item);
+ if(path != null) {
+ IBreakpoint breakpoint = (IBreakpoint) path.getLastSegment();
+ IBreakpointContainer container = null;
+ for(int i = path.getSegmentCount()-2; i > -1; i--) {
+ container = (IBreakpointContainer) path.getSegment(i);
+ if(container.contains(breakpoint) && container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ return null;
+ }
- /**
- * Returns the addable breakpoint container of the specified breakpoint
- * @param item the item to get the container for
- * @return the first found addable container for the specified breakpoint or <code>null</code> if none found
- * @since 3.3
- */
- public IBreakpointContainer getAddableContainer(Item item) {
- TreePath path = getTreePathFromItem(item);
- if(path != null) {
- Object element = path.getLastSegment();
- if(element instanceof IBreakpoint) {
- IBreakpointContainer container = null;
- IBreakpoint breakpoint = (IBreakpoint) element;
- for(int i = path.getSegmentCount()-2; i > -1; i--) {
- container = (IBreakpointContainer) path.getSegment(i);
- if(container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return container;
- }
- }
- }
- }
- return null;
- }
+ /**
+ * Returns the addable breakpoint container of the specified breakpoint
+ * @param item the item to get the container for
+ * @return the first found addable container for the specified breakpoint or <code>null</code> if none found
+ * @since 3.3
+ */
+ public IBreakpointContainer getAddableContainer(Item item) {
+ TreePath path = getTreePathFromItem(item);
+ if(path != null) {
+ Object element = path.getLastSegment();
+ if(element instanceof IBreakpoint) {
+ IBreakpointContainer container = null;
+ IBreakpoint breakpoint = (IBreakpoint) element;
+ for(int i = path.getSegmentCount()-2; i > -1; i--) {
+ container = (IBreakpointContainer) path.getSegment(i);
+ if(container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ return null;
+ }
- /**
- * Returns if the selected item in the tree can be dragged
- * <p>
- * Scheme:
- * <ul>
- * <li>breakpoint containers cannot be dragged</li>
- * <li>breakpoints can be dragged iff the container they reside in supports the removal of breakpoints</li>
- * </ul>
- * </p>
- * @param items the items to test if they can be dragged
- * @return true if the selected element can be dragged, false otherwise
- * @since 3.3
- */
- public boolean canDrag(Item[] items) {
- if(items == null) {
- return false;
- }
- if(items.length == 0) {
- return false;
- }
- for(int i = 0; i < items.length; i++) {
- if(getRemovableContainer(items[i]) == null) {
- return false;
- }
- }
- return true;
- }
+ /**
+ * Returns if the selected item in the tree can be dragged
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>breakpoint containers cannot be dragged</li>
+ * <li>breakpoints can be dragged iff the container they reside in supports the removal of breakpoints</li>
+ * </ul>
+ * </p>
+ * @param items the items to test if they can be dragged
+ * @return true if the selected element can be dragged, false otherwise
+ * @since 3.3
+ */
+ public boolean canDrag(Item[] items) {
+ if(items == null) {
+ return false;
+ }
+ if(items.length == 0) {
+ return false;
+ }
+ for(int i = 0; i < items.length; i++) {
+ if(getRemovableContainer(items[i]) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
- /**
- * Performs the actual removal of breakpoints from their respective (removable) containers on a successful drag operation
- * @param items the items involved in the drag
- * @since 3.3
- */
- public void performDrag(Item[] items) {
- if(items == null) {
- return;
- }
+ /**
+ * Performs the actual removal of breakpoints from their respective (removable) containers on a successful drag operation
+ * @param items the items involved in the drag
+ * @since 3.3
+ */
+ public void performDrag(Item[] items) {
+ if(items == null) {
+ return;
+ }
Map<IBreakpointContainer, List<IBreakpoint>> containersToBreakpoints = new HashMap<>();
IBreakpointContainer container = null;
- IBreakpoint breakpoint = null;
- for(int i = 0; i < items.length; i++) {
- if(!items[i].isDisposed()) {
- breakpoint = (IBreakpoint)items[i].getData();
- container = getRemovableContainer(items[i]);
- if(container != null) {
+ IBreakpoint breakpoint = null;
+ for(int i = 0; i < items.length; i++) {
+ if(!items[i].isDisposed()) {
+ breakpoint = (IBreakpoint)items[i].getData();
+ container = getRemovableContainer(items[i]);
+ if(container != null) {
List<IBreakpoint> list = containersToBreakpoints.get(container);
- if (list == null) {
+ if (list == null) {
list = new ArrayList<>();
- containersToBreakpoints.put(container, list);
- }
- list.add(breakpoint);
- }
- }
- }
+ containersToBreakpoints.put(container, list);
+ }
+ list.add(breakpoint);
+ }
+ }
+ }
for (Entry<IBreakpointContainer, List<IBreakpoint>> entry : containersToBreakpoints.entrySet()) {
- container = entry.getKey();
+ container = entry.getKey();
List<IBreakpoint> list = entry.getValue();
- IBreakpointOrganizer organizer = container.getOrganizer();
- IBreakpoint[] breakpoints = list.toArray(new IBreakpoint[list.size()]);
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
+ IBreakpointOrganizer organizer = container.getOrganizer();
+ IBreakpoint[] breakpoints = list.toArray(new IBreakpoint[list.size()]);
+ if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
extension.removeBreakpoints(breakpoints, container.getCategory());
} else {
@@ -246,35 +246,35 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
organizer.removeBreakpoint(breakpoints[i], container.getCategory());
}
}
- }
- }
+ }
+ }
- /**
- * Determines if the specified element can be dropped into the specified target
- * <p>
- * Scheme:
- * <ul>
- * <li>Breakpoints can be dropped into working sets</li>
- * <li>Breakpoints can be dropped into breakpoints, provided there is a droppable parent of the target breakpoint</li>
- * </ul>
- * </p>
- * @param target the target for the drop
- * @param selection the selection we want to drop
- * @return true if the specified element can be dropped into the specified target, false otherwise
- * @since 3.3
- */
- public boolean canDrop(Item target, IStructuredSelection selection) {
- if(selection == null || target == null) {
- return false;
- }
+ /**
+ * Determines if the specified element can be dropped into the specified target
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>Breakpoints can be dropped into working sets</li>
+ * <li>Breakpoints can be dropped into breakpoints, provided there is a droppable parent of the target breakpoint</li>
+ * </ul>
+ * </p>
+ * @param target the target for the drop
+ * @param selection the selection we want to drop
+ * @return true if the specified element can be dropped into the specified target, false otherwise
+ * @since 3.3
+ */
+ public boolean canDrop(Item target, IStructuredSelection selection) {
+ if(selection == null || target == null) {
+ return false;
+ }
for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
- Object currentObject = iter.next();
- if (!(currentObject instanceof IBreakpoint) || !checkAddableParentContainers(target, (IBreakpoint)currentObject)){
- return false;
- }
- }
- return true;
- }
+ Object currentObject = iter.next();
+ if (!(currentObject instanceof IBreakpoint) || !checkAddableParentContainers(target, (IBreakpoint)currentObject)){
+ return false;
+ }
+ }
+ return true;
+ }
/**
* This method is used to determine if there is an addable parent container available for the specified drop target.
@@ -296,8 +296,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
if(element instanceof IBreakpointContainer) {
container = (IBreakpointContainer) element;
if(container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return false;
- }
+ return false;
+ }
}
}
}
@@ -305,38 +305,38 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
}
/**
- * Performs the actual addition of the selected breakpoints to the specified target
- * @param target the target to add the selection of breakpoints to
- * @param selection the selection of breakpoints
- * @return true if the drop occurred, false otherwise
- * @since 3.3
- */
- public boolean performDrop(Item target, IStructuredSelection selection) {
+ * Performs the actual addition of the selected breakpoints to the specified target
+ * @param target the target to add the selection of breakpoints to
+ * @param selection the selection of breakpoints
+ * @return true if the drop occurred, false otherwise
+ * @since 3.3
+ */
+ public boolean performDrop(Item target, IStructuredSelection selection) {
if(target == null || selection == null) {
- return false;
- }
- IBreakpoint breakpoint = null;
- Object element = target.getData();
- IBreakpointContainer container = (element instanceof IBreakpointContainer ? (IBreakpointContainer)element : getAddableContainer(target));
- if(container == null) {
return false;
}
- IBreakpointOrganizer organizer = container.getOrganizer();
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
- IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
- Object[] array = selection.toArray();
- IBreakpoint[] breakpoints = new IBreakpoint[array.length];
- System.arraycopy(array, 0, breakpoints, 0, array.length);
- extension.addBreakpoints(breakpoints, container.getCategory());
- } else {
+ IBreakpoint breakpoint = null;
+ Object element = target.getData();
+ IBreakpointContainer container = (element instanceof IBreakpointContainer ? (IBreakpointContainer)element : getAddableContainer(target));
+ if(container == null) {
+ return false;
+ }
+ IBreakpointOrganizer organizer = container.getOrganizer();
+ if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
+ IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
+ Object[] array = selection.toArray();
+ IBreakpoint[] breakpoints = new IBreakpoint[array.length];
+ System.arraycopy(array, 0, breakpoints, 0, array.length);
+ extension.addBreakpoints(breakpoints, container.getCategory());
+ } else {
for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
- breakpoint = (IBreakpoint) iter.next();
+ breakpoint = (IBreakpoint) iter.next();
organizer.addBreakpoint(breakpoint, container.getCategory());
- }
- }
- expandToLevel(target.getData(), ALL_LEVELS);
- return true;
- }
+ }
+ }
+ expandToLevel(target.getData(), ALL_LEVELS);
+ return true;
+ }
@Override
public void refresh() {
@@ -354,19 +354,19 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
}
}
- /**
- * Update the checked state up the given element and all of its children.
- *
- * @param element the element to update
- */
+ /**
+ * Update the checked state up the given element and all of its children.
+ *
+ * @param element the element to update
+ */
public void updateCheckedState(Object element) {
- Widget[] widgets = searchItems(element);
- for (int i = 0; i < widgets.length; i++) {
- Widget widget = widgets[i];
- if (widget != null) {
- updateCheckedState((TreeItem)widget);
- }
- }
+ Widget[] widgets = searchItems(element);
+ for (int i = 0; i < widgets.length; i++) {
+ Widget widget = widgets[i];
+ if (widget != null) {
+ updateCheckedState((TreeItem)widget);
+ }
+ }
}
/**
@@ -374,76 +374,76 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* @param element the element to search for when finding occurrences
* @return a list of widget occurrences to update or an empty list
*/
- private Widget[] searchItems(Object element) {
+ private Widget[] searchItems(Object element) {
ArrayList<TreeItem> list = new ArrayList<>();
- TreeItem[] items = getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
- }
- return list.toArray(new Widget[0]);
- }
+ TreeItem[] items = getTree().getItems();
+ for (int i = 0; i < items.length; i++) {
+ findAllOccurrences(items[i], element, list);
+ }
+ return list.toArray(new Widget[0]);
+ }
- /**
- * performs the actual search for items in the tree
- * @param list the list to add matches to
- * @param item the item in the tree
- * @param element the element to compare
- */
+ /**
+ * performs the actual search for items in the tree
+ * @param list the list to add matches to
+ * @param item the item in the tree
+ * @param element the element to compare
+ */
private void findAllOccurrences(TreeItem item, Object element, ArrayList<TreeItem> list) {
- if (element.equals(item.getData())) {
+ if (element.equals(item.getData())) {
list.add(item);
- }
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
- }
- }
+ }
+ TreeItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ findAllOccurrences(items[i], element, list);
+ }
+ }
- /**
- * Update the checked state up the given element and all of its children.
- *
- * @param item the item to update
- */
- public void updateCheckedState(TreeItem item) {
- Object element = item.getData();
- if (element instanceof IBreakpoint) {
- try {
- item.setChecked(((IBreakpoint) element).isEnabled());
- refreshItem(item);
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- } else if (element instanceof IBreakpointContainer) {
- IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints();
- int enabledChildren= 0;
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- try {
- if (breakpoint.isEnabled()) {
- enabledChildren++;
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- if (enabledChildren == 0) {
- // Uncheck the container node if no children are enabled
- item.setGrayed(false);
- item.setChecked(false);
- } else if (enabledChildren == breakpoints.length) {
- // Check the container if all children are enabled
- item.setGrayed(false);
- item.setChecked(true);
- } else {
- // If some but not all children are enabled, gray the container node
- item.setGrayed(true);
- item.setChecked(true);
- }
- // Update any children (breakpoints and containers)
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- updateCheckedState(items[i]);
- }
- }
- }
+ /**
+ * Update the checked state up the given element and all of its children.
+ *
+ * @param item the item to update
+ */
+ public void updateCheckedState(TreeItem item) {
+ Object element = item.getData();
+ if (element instanceof IBreakpoint) {
+ try {
+ item.setChecked(((IBreakpoint) element).isEnabled());
+ refreshItem(item);
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ } else if (element instanceof IBreakpointContainer) {
+ IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints();
+ int enabledChildren= 0;
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ try {
+ if (breakpoint.isEnabled()) {
+ enabledChildren++;
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ if (enabledChildren == 0) {
+ // Uncheck the container node if no children are enabled
+ item.setGrayed(false);
+ item.setChecked(false);
+ } else if (enabledChildren == breakpoints.length) {
+ // Check the container if all children are enabled
+ item.setGrayed(false);
+ item.setChecked(true);
+ } else {
+ // If some but not all children are enabled, gray the container node
+ item.setGrayed(true);
+ item.setChecked(true);
+ }
+ // Update any children (breakpoints and containers)
+ TreeItem[] items = item.getItems();
+ for (int i = 0; i < items.length; i++) {
+ updateCheckedState(items[i]);
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java
index d7a0fb9ec..e13ac561c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java
@@ -48,9 +48,9 @@ public class ElementComparator implements Comparator<Object> {
@Override
public int compare(Object arg0, Object arg1) {
- IBreakpoint bp0 = (IBreakpoint)DebugPlugin.getAdapter(arg0, IBreakpoint.class);
- IBreakpoint bp1 = (IBreakpoint)DebugPlugin.getAdapter(arg1, IBreakpoint.class);
- if (bp0 != null && bp1 != null) {
+ IBreakpoint bp0 = (IBreakpoint)DebugPlugin.getAdapter(arg0, IBreakpoint.class);
+ IBreakpoint bp1 = (IBreakpoint)DebugPlugin.getAdapter(arg1, IBreakpoint.class);
+ if (bp0 != null && bp1 != null) {
return doCompare(bp0, bp1);
} else if (arg0 instanceof IBreakpointContainer && arg1 instanceof IBreakpointContainer) {
return doCompare((IBreakpointContainer) arg0, (IBreakpointContainer) arg1);
@@ -67,18 +67,18 @@ public class ElementComparator implements Comparator<Object> {
* @return
*/
private int doCompare(IBreakpointContainer c1, IBreakpointContainer c2) {
- // The "Other" breakpoint category should be listed last.
- // (Bug 311457).
- if (c1.getCategory() instanceof OtherBreakpointCategory) {
- if (c2.getCategory() instanceof OtherBreakpointCategory) {
- return 0;
- }
- return 1;
- } else if (c2.getCategory() instanceof OtherBreakpointCategory) {
- return -1;
- }
-
- // Rest of categories should be listed alphabetically.
+ // The "Other" breakpoint category should be listed last.
+ // (Bug 311457).
+ if (c1.getCategory() instanceof OtherBreakpointCategory) {
+ if (c2.getCategory() instanceof OtherBreakpointCategory) {
+ return 0;
+ }
+ return 1;
+ } else if (c2.getCategory() instanceof OtherBreakpointCategory) {
+ return -1;
+ }
+
+ // Rest of categories should be listed alphabetically.
if (fContext != null) {
String name1 = fContext.getModelPresentation().getText(c1);
String name2 = fContext.getModelPresentation().getText(c2);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java
index a712c77ed..1d2a95b9f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java
@@ -27,16 +27,16 @@ import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
*/
public class FileBreakpointOrganizer extends AbstractBreakpointOrganizerDelegate {
- @Override
+ @Override
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- IResource resource = marker.getResource();
- if (resource.getType() == IResource.FILE) {
- return new IAdaptable[]{(IFile)resource};
- }
- }
- return null;
- }
+ IMarker marker = breakpoint.getMarker();
+ if (marker != null) {
+ IResource resource = marker.getResource();
+ if (resource.getType() == IResource.FILE) {
+ return new IAdaptable[]{(IFile)resource};
+ }
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java
index 406ae6506..0aad8cea4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java
@@ -26,16 +26,16 @@ import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
*/
public class ProjectBreakpointOrganizer extends AbstractBreakpointOrganizerDelegate {
- @Override
+ @Override
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- IProject project = marker.getResource().getProject();
- if (project != null) {
- return new IAdaptable[]{project};
- }
- }
- return null;
- }
+ IMarker marker = breakpoint.getMarker();
+ if (marker != null) {
+ IProject project = marker.getResource().getProject();
+ if (project != null) {
+ return new IAdaptable[]{project};
+ }
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
index 3f443c9e8..2dec7323c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
@@ -34,63 +34,63 @@ import org.eclipse.ui.PlatformUI;
*/
public class WorkingSetBreakpointOrganizer extends AbstractBreakpointOrganizerDelegate implements IPropertyChangeListener {
- IWorkingSetManager fWorkingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
+ IWorkingSetManager fWorkingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
- /**
- * Constructs a working set breakpoint organizer. Listens for changes in
- * working sets and fires property change notification.
- */
- public WorkingSetBreakpointOrganizer() {
- fWorkingSetManager.addPropertyChangeListener(this);
- }
+ /**
+ * Constructs a working set breakpoint organizer. Listens for changes in
+ * working sets and fires property change notification.
+ */
+ public WorkingSetBreakpointOrganizer() {
+ fWorkingSetManager.addPropertyChangeListener(this);
+ }
- @Override
+ @Override
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
List<IAdaptable> result = new ArrayList<>();
List<IResource> parents = new ArrayList<>();
- IResource res = breakpoint.getMarker().getResource();
- parents.add(res);
- while (res != null) {
- res = res.getParent();
- if (res != null) {
- parents.add(res);
- }
- }
- IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(workingSets[i].getId())) {
- IAdaptable[] elements = workingSets[i].getElements();
- for (int j = 0; j < elements.length; j++) {
- IResource resource = elements[j].getAdapter(IResource.class);
- if (resource != null) {
- if (parents.contains(resource)) {
- result.add(new WorkingSetCategory(workingSets[i]));
- break;
- }
- }
- }
- }
- }
- return result.toArray(new IAdaptable[result.size()]);
- }
+ IResource res = breakpoint.getMarker().getResource();
+ parents.add(res);
+ while (res != null) {
+ res = res.getParent();
+ if (res != null) {
+ parents.add(res);
+ }
+ }
+ IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
+ for (int i = 0; i < workingSets.length; i++) {
+ if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(workingSets[i].getId())) {
+ IAdaptable[] elements = workingSets[i].getElements();
+ for (int j = 0; j < elements.length; j++) {
+ IResource resource = elements[j].getAdapter(IResource.class);
+ if (resource != null) {
+ if (parents.contains(resource)) {
+ result.add(new WorkingSetCategory(workingSets[i]));
+ break;
+ }
+ }
+ }
+ }
+ }
+ return result.toArray(new IAdaptable[result.size()]);
+ }
- @Override
+ @Override
public void dispose() {
- fWorkingSetManager.removePropertyChangeListener(this);
- fWorkingSetManager = null;
- super.dispose();
- }
+ fWorkingSetManager.removePropertyChangeListener(this);
+ fWorkingSetManager = null;
+ super.dispose();
+ }
- @Override
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- IWorkingSet set = null;
- if (event.getNewValue() instanceof IWorkingSet) {
- set = (IWorkingSet) event.getNewValue();
- } else if (event.getOldValue() instanceof IWorkingSet) {
- set = (IWorkingSet) event.getOldValue();
- }
- if (set != null && !IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
- fireCategoryChanged(new WorkingSetCategory(set));
- }
- }
+ IWorkingSet set = null;
+ if (event.getNewValue() instanceof IWorkingSet) {
+ set = (IWorkingSet) event.getNewValue();
+ } else if (event.getOldValue() instanceof IWorkingSet) {
+ set = (IWorkingSet) event.getOldValue();
+ }
+ if (set != null && !IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
+ fireCategoryChanged(new WorkingSetCategory(set));
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
index 6fe66273f..415f04862 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
@@ -29,99 +29,99 @@ import org.eclipse.ui.model.IWorkbenchAdapter2;
*/
public class WorkingSetCategory extends PlatformObject implements IWorkbenchAdapter, IWorkbenchAdapter2 {
- private IWorkingSet fWorkingSet;
-
- /**
- * Constructs a new workings set category for the given working set.
- *
- * @param workingSet
- */
- public WorkingSetCategory(IWorkingSet workingSet) {
- fWorkingSet = workingSet;
- }
-
- @Override
+ private IWorkingSet fWorkingSet;
+
+ /**
+ * Constructs a new workings set category for the given working set.
+ *
+ * @param workingSet
+ */
+ public WorkingSetCategory(IWorkingSet workingSet) {
+ fWorkingSet = workingSet;
+ }
+
+ @Override
public Object[] getChildren(Object o) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return fWorkingSet.getImageDescriptor();
- }
+ return fWorkingSet.getImageDescriptor();
+ }
- @Override
+ @Override
public String getLabel(Object o) {
- StringBuilder name = new StringBuilder(fWorkingSet.getName());
- if (isDefault()) {
- name.append(DebugUIViewsMessages.WorkingSetCategory_0);
- }
- return name.toString();
- }
-
- @Override
+ StringBuilder name = new StringBuilder(fWorkingSet.getName());
+ if (isDefault()) {
+ name.append(DebugUIViewsMessages.WorkingSetCategory_0);
+ }
+ return name.toString();
+ }
+
+ @Override
public Object getParent(Object o) {
- return null;
- }
-
- /**
- * Returns the working set for this category.
- *
- * @return
- */
- public IWorkingSet getWorkingSet() {
- return fWorkingSet;
- }
-
- @Override
+ return null;
+ }
+
+ /**
+ * Returns the working set for this category.
+ *
+ * @return
+ */
+ public IWorkingSet getWorkingSet() {
+ return fWorkingSet;
+ }
+
+ @Override
public boolean equals(Object obj) {
- if (obj instanceof WorkingSetCategory) {
- WorkingSetCategory category = (WorkingSetCategory) obj;
- return category.getWorkingSet().equals(fWorkingSet);
- }
- return false;
- }
-
- @Override
+ if (obj instanceof WorkingSetCategory) {
+ WorkingSetCategory category = (WorkingSetCategory) obj;
+ return category.getWorkingSet().equals(fWorkingSet);
+ }
+ return false;
+ }
+
+ @Override
public int hashCode() {
- return fWorkingSet.hashCode();
- }
+ return fWorkingSet.hashCode();
+ }
- @Override
+ @Override
public RGB getForeground(Object element) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public RGB getBackground(Object element) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public FontData getFont(Object element) {
- if (isDefault()) {
- FontData[] fontData = JFaceResources.getDefaultFont().getFontData();
- if (fontData != null && fontData.length > 0) {
- FontData data = fontData[0];
- data.setStyle(SWT.BOLD);
- return data;
- }
- }
- return null;
- }
-
- /**
- * Whether this is the default breakpoint working set.
- *
- * @return whether this is the default breakpoint working set
- */
- private boolean isDefault() {
- return fWorkingSet.equals(BreakpointSetOrganizer.getDefaultWorkingSet());
- }
-
- @Override
+ if (isDefault()) {
+ FontData[] fontData = JFaceResources.getDefaultFont().getFontData();
+ if (fontData != null && fontData.length > 0) {
+ FontData data = fontData[0];
+ data.setStyle(SWT.BOLD);
+ return data;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Whether this is the default breakpoint working set.
+ *
+ * @return whether this is the default breakpoint working set
+ */
+ private boolean isDefault() {
+ return fWorkingSet.equals(BreakpointSetOrganizer.getDefaultWorkingSet());
+ }
+
+ @Override
public String toString() {
- return fWorkingSet.getName();
- }
+ return fWorkingSet.getName();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
index 9b22fb2fa..e9961aab6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
@@ -48,104 +48,104 @@ public class ConsoleLineNotifier implements IPatternMatchListener, IPropertyChan
@Override
public void connect(TextConsole console) {
- if (console instanceof ProcessConsole) {
- fConsole = (ProcessConsole)console;
+ if (console instanceof ProcessConsole) {
+ fConsole = (ProcessConsole)console;
- IConsoleLineTracker[] lineTrackers = DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(fConsole.getProcess());
- for (int i = 0; i < lineTrackers.length; i++) {
- lineTrackers[i].init(fConsole);
- addConsoleListener(lineTrackers[i]);
- }
+ IConsoleLineTracker[] lineTrackers = DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(fConsole.getProcess());
+ for (int i = 0; i < lineTrackers.length; i++) {
+ lineTrackers[i].init(fConsole);
+ addConsoleListener(lineTrackers[i]);
+ }
- fConsole.addPropertyChangeListener(this);
- }
+ fConsole.addPropertyChangeListener(this);
+ }
}
@Override
public synchronized void disconnect() {
- try {
- IDocument document = fConsole.getDocument();
- if (document != null) {
- int lastLine = document.getNumberOfLines() - 1;
- if (document.getLineDelimiter(lastLine) == null) {
- IRegion lineInformation = document.getLineInformation(lastLine);
- lineAppended(lineInformation);
- }
- }
- } catch (BadLocationException e) {
- }
- }
-
- /**
- * Notification the console's streams have been closed
- */
- public synchronized void consoleClosed() {
- int size = fListeners.size();
- for (int i = 0; i < size; i++) {
- IConsoleLineTracker tracker = fListeners.get(i);
- if (tracker instanceof IConsoleLineTrackerExtension) {
- ((IConsoleLineTrackerExtension) tracker).consoleClosed();
- }
- tracker.dispose();
- }
-
- fConsole = null;
- fListeners = null;
- }
+ try {
+ IDocument document = fConsole.getDocument();
+ if (document != null) {
+ int lastLine = document.getNumberOfLines() - 1;
+ if (document.getLineDelimiter(lastLine) == null) {
+ IRegion lineInformation = document.getLineInformation(lastLine);
+ lineAppended(lineInformation);
+ }
+ }
+ } catch (BadLocationException e) {
+ }
+ }
/**
- * Adds the given listener to the list of listeners notified when a line of
- * text is appended to the console.
- *
- * @param listener the listener to add
- */
+ * Notification the console's streams have been closed
+ */
+ public synchronized void consoleClosed() {
+ int size = fListeners.size();
+ for (int i = 0; i < size; i++) {
+ IConsoleLineTracker tracker = fListeners.get(i);
+ if (tracker instanceof IConsoleLineTrackerExtension) {
+ ((IConsoleLineTrackerExtension) tracker).consoleClosed();
+ }
+ tracker.dispose();
+ }
+
+ fConsole = null;
+ fListeners = null;
+ }
+
+ /**
+ * Adds the given listener to the list of listeners notified when a line of
+ * text is appended to the console.
+ *
+ * @param listener the listener to add
+ */
public void addConsoleListener(IConsoleLineTracker listener) {
- if (!fListeners.contains(listener)) {
+ if (!fListeners.contains(listener)) {
fListeners.add(listener);
}
}
- @Override
+ @Override
public void matchFound(PatternMatchEvent event) {
- try {
- IDocument document = fConsole.getDocument();
- int lineOfOffset = document.getLineOfOffset(event.getOffset());
- String delimiter = document.getLineDelimiter(lineOfOffset);
- int strip = delimiter==null ? 0 : delimiter.length();
- Region region = new Region(event.getOffset(), event.getLength()-strip);
- lineAppended(region);
- } catch (BadLocationException e) {}
- }
-
- public void lineAppended(IRegion region) {
- int size = fListeners.size();
- for (int i=0; i<size; i++) {
- IConsoleLineTracker tracker = fListeners.get(i);
- tracker.lineAppended(region);
- }
- }
-
- @Override
+ try {
+ IDocument document = fConsole.getDocument();
+ int lineOfOffset = document.getLineOfOffset(event.getOffset());
+ String delimiter = document.getLineDelimiter(lineOfOffset);
+ int strip = delimiter==null ? 0 : delimiter.length();
+ Region region = new Region(event.getOffset(), event.getLength()-strip);
+ lineAppended(region);
+ } catch (BadLocationException e) {}
+ }
+
+ public void lineAppended(IRegion region) {
+ int size = fListeners.size();
+ for (int i=0; i<size; i++) {
+ IConsoleLineTracker tracker = fListeners.get(i);
+ tracker.lineAppended(region);
+ }
+ }
+
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- if(event.getProperty().equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
- fConsole.removePropertyChangeListener(this);
- consoleClosed();
- }
- }
+ if(event.getProperty().equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
+ fConsole.removePropertyChangeListener(this);
+ consoleClosed();
+ }
+ }
- @Override
+ @Override
public String getPattern() {
- return ".*\\r(\\n?)|.*\\n"; //$NON-NLS-1$
- }
+ return ".*\\r(\\n?)|.*\\n"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public int getCompilerFlags() {
- return 0;
- }
+ return 0;
+ }
- @Override
+ @Override
public String getLineQualifier() {
- return "\\n|\\r"; //$NON-NLS-1$
- }
+ return "\\n|\\r"; //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java
index 0cc5a1441..b88e18a22 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java
@@ -35,9 +35,9 @@ public class ConsoleMessages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
}
- public static String ConsoleRemoveTerminatedAction_0;
+ public static String ConsoleRemoveTerminatedAction_0;
- public static String ConsoleRemoveTerminatedAction_1;
+ public static String ConsoleRemoveTerminatedAction_1;
public static String ShowStandardErrorAction_0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java
index 53fb177ef..c0226dcf8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java
@@ -65,20 +65,20 @@ public class ConsoleRemoveAllTerminatedAction extends Action implements IUpdate,
update();
}
- @Override
+ @Override
public void launchesRemoved(ILaunch[] launches) {
- if (isEnabled()) {
- update();
- }
- }
+ if (isEnabled()) {
+ update();
+ }
+ }
- @Override
+ @Override
public void launchesAdded(ILaunch[] launches) {
- }
+ }
- @Override
+ @Override
public void launchesChanged(ILaunch[] launches) {
- }
+ }
@Override
public void launchesTerminated(ILaunch[] launches) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java
index 0e6ccb2ad..d8f813ec0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java
@@ -37,76 +37,76 @@ import org.eclipse.ui.console.IConsoleView;
*/
public class ConsoleRemoveLaunchAction extends Action implements IViewActionDelegate, IConsoleListener, ILaunchesListener2 {
- private ILaunch fLaunch;
-
- // only used when a view action delegate
- private IConsoleView fConsoleView;
-
- public ConsoleRemoveLaunchAction() {
- super(ConsoleMessages.ConsoleRemoveTerminatedAction_0);
- setToolTipText(ConsoleMessages.ConsoleRemoveTerminatedAction_1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CONSOLE_REMOVE_LAUNCH);
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE));
- setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE));
- setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE));
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(this);
- }
-
- public ConsoleRemoveLaunchAction(ILaunch launch) {
- this();
- fLaunch = launch;
- update();
- }
-
- public void dispose() {
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- }
-
- public synchronized void update() {
- ILaunch launch = getLaunch();
- if (launch != null) {
- setEnabled(launch.isTerminated());
- } else {
- setEnabled(false);
- }
- }
-
- @Override
+ private ILaunch fLaunch;
+
+ // only used when a view action delegate
+ private IConsoleView fConsoleView;
+
+ public ConsoleRemoveLaunchAction() {
+ super(ConsoleMessages.ConsoleRemoveTerminatedAction_0);
+ setToolTipText(ConsoleMessages.ConsoleRemoveTerminatedAction_1);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CONSOLE_REMOVE_LAUNCH);
+ setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE));
+ setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE));
+ setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE));
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(this);
+ }
+
+ public ConsoleRemoveLaunchAction(ILaunch launch) {
+ this();
+ fLaunch = launch;
+ update();
+ }
+
+ public void dispose() {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
+ ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
+ }
+
+ public synchronized void update() {
+ ILaunch launch = getLaunch();
+ if (launch != null) {
+ setEnabled(launch.isTerminated());
+ } else {
+ setEnabled(false);
+ }
+ }
+
+ @Override
public synchronized void run() {
- ILaunch launch = getLaunch();
- if (launch != null) {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- launchManager.removeLaunch(launch);
- }
- }
-
- @Override
+ ILaunch launch = getLaunch();
+ if (launch != null) {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ launchManager.removeLaunch(launch);
+ }
+ }
+
+ @Override
public void init(IViewPart view) {
- if (view instanceof IConsoleView) {
+ if (view instanceof IConsoleView) {
fConsoleView = (IConsoleView) view;
}
- update();
- }
+ update();
+ }
- @Override
+ @Override
public void run(IAction action) {
- run();
- }
+ run();
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- }
+ }
- @Override
+ @Override
public void consolesAdded(IConsole[] consoles) {
- }
+ }
- @Override
+ @Override
public void consolesRemoved(IConsole[] consoles) {
- update();
- }
+ update();
+ }
@Override
public void launchesTerminated(ILaunch[] launches) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java
index 50ded99a1..0c2bf341f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java
@@ -27,16 +27,16 @@ import org.eclipse.ui.IViewPart;
*/
public class ConsoleShowPreferencesAction extends Action implements IViewActionDelegate {
- @Override
+ @Override
public void init(IViewPart view) {}
- @Override
+ @Override
public void run(IAction action) {
- SWTFactory.showPreferencePage("org.eclipse.debug.ui.ConsolePreferencePage"); //$NON-NLS-1$
- }
+ SWTFactory.showPreferencePage("org.eclipse.debug.ui.ConsolePreferencePage"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
+ // do nothing
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
index 3cce1e96c..950cd9f15 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
@@ -69,8 +69,8 @@ public class ConsoleTerminateAction extends Action implements IUpdate {
IProcess process = fConsole.getProcess();
List<ITerminate> targets = collectTargets(process);
targets.add(process);
- DebugCommandService service = DebugCommandService.getService(fWindow);
- service.executeCommand(ITerminateHandler.class, targets.toArray(), null);
+ DebugCommandService service = DebugCommandService.getService(fWindow);
+ service.executeCommand(ITerminateHandler.class, targets.toArray(), null);
}
/**
@@ -80,28 +80,28 @@ public class ConsoleTerminateAction extends Action implements IUpdate {
* @return associated targets
*/
private List<ITerminate> collectTargets(IProcess process) {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches = launchManager.getLaunches();
List<ITerminate> targets = new ArrayList<>();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- IProcess[] processes = launch.getProcesses();
- for (int j = 0; j < processes.length; j++) {
- IProcess process2 = processes[j];
- if (process2.equals(process)) {
- IDebugTarget[] debugTargets = launch.getDebugTargets();
- for (int k = 0; k < debugTargets.length; k++) {
- targets.add(debugTargets[k]);
- }
- return targets; // all possible targets have been terminated for the launch.
- }
- }
- }
- return targets;
- }
+ for (int i = 0; i < launches.length; i++) {
+ ILaunch launch = launches[i];
+ IProcess[] processes = launch.getProcesses();
+ for (int j = 0; j < processes.length; j++) {
+ IProcess process2 = processes[j];
+ if (process2.equals(process)) {
+ IDebugTarget[] debugTargets = launch.getDebugTargets();
+ for (int k = 0; k < debugTargets.length; k++) {
+ targets.add(debugTargets[k]);
+ }
+ return targets; // all possible targets have been terminated for the launch.
+ }
+ }
+ }
+ return targets;
+ }
- public void dispose() {
- fConsole = null;
+ public void dispose() {
+ fConsole = null;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
index 0514024ee..4c8d38382 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
@@ -98,43 +98,43 @@ import com.ibm.icu.text.MessageFormat;
*/
@SuppressWarnings("deprecation")
public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSetListener, IPropertyChangeListener {
- private IProcess fProcess = null;
+ private IProcess fProcess = null;
private List<StreamListener> fStreamListeners = new ArrayList<>();
- private IConsoleColorProvider fColorProvider;
+ private IConsoleColorProvider fColorProvider;
private volatile InputStream fInput;
- private FileOutputStream fFileOutputStream;
+ private FileOutputStream fFileOutputStream;
- private boolean fAllocateConsole = true;
+ private boolean fAllocateConsole = true;
private String fStdInFile = null;
- private boolean fStreamsClosed = false;
-
- /**
- * Proxy to a console document
- */
- public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider) {
- this(process, colorProvider, null);
- }
-
- /**
- * Constructor
- * @param process the process to associate with this console
- * @param colorProvider the colour provider for this console
- * @param encoding the desired encoding for this console
- */
- public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider, String encoding) {
- super(IInternalDebugCoreConstants.EMPTY_STRING, IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE, null, encoding, true);
- fProcess = process;
-
- ILaunchConfiguration configuration = process.getLaunch().getLaunchConfiguration();
- String file = null;
- boolean append = false;
- if (configuration != null) {
- try {
+ private boolean fStreamsClosed = false;
+
+ /**
+ * Proxy to a console document
+ */
+ public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider) {
+ this(process, colorProvider, null);
+ }
+
+ /**
+ * Constructor
+ * @param process the process to associate with this console
+ * @param colorProvider the colour provider for this console
+ * @param encoding the desired encoding for this console
+ */
+ public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider, String encoding) {
+ super(IInternalDebugCoreConstants.EMPTY_STRING, IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE, null, encoding, true);
+ fProcess = process;
+
+ ILaunchConfiguration configuration = process.getLaunch().getLaunchConfiguration();
+ String file = null;
+ boolean append = false;
+ if (configuration != null) {
+ try {
file = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String) null);
fStdInFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, (String) null);
if (file != null || fStdInFile != null) {
@@ -147,54 +147,54 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
if (fStdInFile != null) {
fStdInFile = stringVariableManager.performStringSubstitution(fStdInFile);
}
- }
- } catch (CoreException e) {
- }
- }
-
- if (file != null && configuration != null) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- Path path = new Path(file);
- IFile ifile = root.getFileForLocation(path);
- String message = null;
-
- try {
- String fileLoc = null;
- if (ifile != null) {
- if (append && ifile.exists()) {
- ifile.appendContents(new ByteArrayInputStream(new byte[0]), true, true, new NullProgressMonitor());
- } else {
- if (ifile.exists()) {
- ifile.delete(true, new NullProgressMonitor());
- }
- ifile.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
- }
- }
-
- File outputFile = new File(file);
- fFileOutputStream = new FileOutputStream(outputFile, append);
- fileLoc = outputFile.getAbsolutePath();
+ }
+ } catch (CoreException e) {
+ }
+ }
+
+ if (file != null && configuration != null) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ Path path = new Path(file);
+ IFile ifile = root.getFileForLocation(path);
+ String message = null;
+
+ try {
+ String fileLoc = null;
+ if (ifile != null) {
+ if (append && ifile.exists()) {
+ ifile.appendContents(new ByteArrayInputStream(new byte[0]), true, true, new NullProgressMonitor());
+ } else {
+ if (ifile.exists()) {
+ ifile.delete(true, new NullProgressMonitor());
+ }
+ ifile.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
+ }
+ }
+
+ File outputFile = new File(file);
+ fFileOutputStream = new FileOutputStream(outputFile, append);
+ fileLoc = outputFile.getAbsolutePath();
message = MessageFormat.format(ConsoleMessages.ProcessConsole_1, new Object[] { fileLoc });
- addPatternMatchListener(new ConsoleLogFilePatternMatcher(fileLoc));
- } catch (FileNotFoundException e) {
+ addPatternMatchListener(new ConsoleLogFilePatternMatcher(fileLoc));
+ } catch (FileNotFoundException e) {
message = MessageFormat.format(ConsoleMessages.ProcessConsole_2, new Object[] { file });
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- if (message != null) {
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ if (message != null) {
try (IOConsoleOutputStream stream = newOutputStream()) {
- stream.write(message);
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- }
- try {
- fAllocateConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
- } catch (CoreException e) {
- }
- }
+ stream.write(message);
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ try {
+ fAllocateConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
+ } catch (CoreException e) {
+ }
+ }
if (fStdInFile != null && configuration != null) {
String message = null;
try {
@@ -214,501 +214,501 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
}
}
- fColorProvider = colorProvider;
+ fColorProvider = colorProvider;
if (fInput == null) {
fInput = getInputStream();
}
- colorProvider.connect(fProcess, this);
+ colorProvider.connect(fProcess, this);
- setName(computeName());
+ setName(computeName());
- Color color = fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_INPUT_STREAM);
+ Color color = fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_INPUT_STREAM);
if (fInput instanceof IOConsoleInputStream) {
((IOConsoleInputStream)fInput).setColor(color);
}
- IConsoleLineTracker[] lineTrackers = DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(process);
- if (lineTrackers.length > 0) {
- addPatternMatchListener(new ConsoleLineNotifier());
- }
- }
-
- /**
- * Computes and returns the image descriptor for this console.
- *
- * @return an image descriptor for this console or <code>null</code>
- */
- protected ImageDescriptor computeImageDescriptor() {
- ILaunchConfiguration configuration = getProcess().getLaunch().getLaunchConfiguration();
- if (configuration != null) {
- ILaunchConfigurationType type;
- try {
- type = configuration.getType();
- return DebugPluginImages.getImageDescriptor(type.getIdentifier());
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- return null;
- }
-
- /**
- * Computes and returns the current name of this console.
- *
- * @return a name for this console
- */
- protected String computeName() {
- String label = null;
- IProcess process = getProcess();
- ILaunchConfiguration config = process.getLaunch().getLaunchConfiguration();
-
- label = process.getAttribute(IProcess.ATTR_PROCESS_LABEL);
- if (label == null) {
- if (config == null) {
- label = process.getLabel();
- } else {
- // check if PRIVATE config
- if (DebugUITools.isPrivate(config)) {
- label = process.getLabel();
- } else {
- String type = null;
- try {
- type = config.getType().getName();
- } catch (CoreException e) {
- }
- StringBuilder buffer = new StringBuilder();
- buffer.append(config.getName());
- if (type != null) {
- buffer.append(" ["); //$NON-NLS-1$
- buffer.append(type);
- buffer.append("] "); //$NON-NLS-1$
- }
- buffer.append(process.getLabel());
- label = buffer.toString();
- }
- }
- }
-
- if (process.isTerminated()) {
+ IConsoleLineTracker[] lineTrackers = DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(process);
+ if (lineTrackers.length > 0) {
+ addPatternMatchListener(new ConsoleLineNotifier());
+ }
+ }
+
+ /**
+ * Computes and returns the image descriptor for this console.
+ *
+ * @return an image descriptor for this console or <code>null</code>
+ */
+ protected ImageDescriptor computeImageDescriptor() {
+ ILaunchConfiguration configuration = getProcess().getLaunch().getLaunchConfiguration();
+ if (configuration != null) {
+ ILaunchConfigurationType type;
+ try {
+ type = configuration.getType();
+ return DebugPluginImages.getImageDescriptor(type.getIdentifier());
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Computes and returns the current name of this console.
+ *
+ * @return a name for this console
+ */
+ protected String computeName() {
+ String label = null;
+ IProcess process = getProcess();
+ ILaunchConfiguration config = process.getLaunch().getLaunchConfiguration();
+
+ label = process.getAttribute(IProcess.ATTR_PROCESS_LABEL);
+ if (label == null) {
+ if (config == null) {
+ label = process.getLabel();
+ } else {
+ // check if PRIVATE config
+ if (DebugUITools.isPrivate(config)) {
+ label = process.getLabel();
+ } else {
+ String type = null;
+ try {
+ type = config.getType().getName();
+ } catch (CoreException e) {
+ }
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(config.getName());
+ if (type != null) {
+ buffer.append(" ["); //$NON-NLS-1$
+ buffer.append(type);
+ buffer.append("] "); //$NON-NLS-1$
+ }
+ buffer.append(process.getLabel());
+ label = buffer.toString();
+ }
+ }
+ }
+
+ if (process.isTerminated()) {
return MessageFormat.format(ConsoleMessages.ProcessConsole_0, new Object[] { label });
- }
- return label;
- }
-
- /**
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- @Override
+ }
+ return label;
+ }
+
+ /**
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
- String property = evt.getProperty();
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- if (property.equals(IDebugPreferenceConstants.CONSOLE_WRAP) || property.equals(IDebugPreferenceConstants.CONSOLE_WIDTH)) {
- boolean fixedWidth = store.getBoolean(IDebugPreferenceConstants.CONSOLE_WRAP);
- if (fixedWidth) {
- int width = store.getInt(IDebugPreferenceConstants.CONSOLE_WIDTH);
- setConsoleWidth(width);
- } else {
- setConsoleWidth(-1);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT) || property.equals(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK) || property.equals(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK)) {
- boolean limitBufferSize = store.getBoolean(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT);
- if (limitBufferSize) {
- int highWater = store.getInt(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK);
- int lowWater = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK);
- if (highWater > lowWater) {
- setWaterMarks(lowWater, highWater);
- }
- } else {
- setWaterMarks(-1, -1);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH)) {
- int tabWidth = store.getInt(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH);
- setTabWidth(tabWidth);
+ String property = evt.getProperty();
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ if (property.equals(IDebugPreferenceConstants.CONSOLE_WRAP) || property.equals(IDebugPreferenceConstants.CONSOLE_WIDTH)) {
+ boolean fixedWidth = store.getBoolean(IDebugPreferenceConstants.CONSOLE_WRAP);
+ if (fixedWidth) {
+ int width = store.getInt(IDebugPreferenceConstants.CONSOLE_WIDTH);
+ setConsoleWidth(width);
+ } else {
+ setConsoleWidth(-1);
+ }
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT) || property.equals(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK) || property.equals(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK)) {
+ boolean limitBufferSize = store.getBoolean(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT);
+ if (limitBufferSize) {
+ int highWater = store.getInt(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK);
+ int lowWater = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK);
+ if (highWater > lowWater) {
+ setWaterMarks(lowWater, highWater);
+ }
+ } else {
+ setWaterMarks(-1, -1);
+ }
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH)) {
+ int tabWidth = store.getInt(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH);
+ setTabWidth(tabWidth);
} else if (property.equals(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT)) {
- boolean activateOnOut = store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT);
+ boolean activateOnOut = store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT);
@SuppressWarnings("resource")
IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM);
- if (stream != null) {
- stream.setActivateOnWrite(activateOnOut);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR)) {
- boolean activateOnErr = store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR);
+ if (stream != null) {
+ stream.setActivateOnWrite(activateOnOut);
+ }
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR)) {
+ boolean activateOnErr = store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR);
@SuppressWarnings("resource")
IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_ERROR_STREAM);
- if (stream != null) {
- stream.setActivateOnWrite(activateOnErr);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR)) {
+ if (stream != null) {
+ stream.setActivateOnWrite(activateOnErr);
+ }
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR)) {
@SuppressWarnings("resource")
IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM);
- if (stream != null) {
- stream.setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM));
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR)) {
+ if (stream != null) {
+ stream.setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM));
+ }
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR)) {
@SuppressWarnings("resource")
IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_ERROR_STREAM);
- if (stream != null) {
- stream.setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM));
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR)) {
+ if (stream != null) {
+ stream.setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM));
+ }
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR)) {
if (fInput != null && fInput instanceof IOConsoleInputStream) {
((IOConsoleInputStream) fInput).setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_INPUT_STREAM));
- }
- } else if (property.equals(IDebugUIConstants.PREF_CONSOLE_FONT)) {
- setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)) {
- setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
- }
- }
-
- @Override
+ }
+ } else if (property.equals(IDebugUIConstants.PREF_CONSOLE_FONT)) {
+ setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)) {
+ setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
+ }
+ }
+
+ @Override
public IOConsoleOutputStream getStream(String streamIdentifier) {
if (streamIdentifier == null) {
return null;
}
for (StreamListener listener : fStreamListeners) {
if (streamIdentifier.equals(listener.fStreamId)) {
- return listener.fStream;
- }
- }
- return null;
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#getProcess()
- */
- @Override
+ return listener.fStream;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.console.IConsole#getProcess()
+ */
+ @Override
public IProcess getProcess() {
- return fProcess;
- }
+ return fProcess;
+ }
- /**
- * @see org.eclipse.ui.console.IOConsole#dispose()
- */
- @Override
+ /**
+ * @see org.eclipse.ui.console.IOConsole#dispose()
+ */
+ @Override
protected void dispose() {
- super.dispose();
- fColorProvider.disconnect();
- DebugPlugin.getDefault().removeDebugEventListener(this);
- DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
- JFaceResources.getFontRegistry().removeListener(this);
+ super.dispose();
+ fColorProvider.disconnect();
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
+ JFaceResources.getFontRegistry().removeListener(this);
closeStreams();
disposeStreams();
- }
+ }
- /**
+ /**
* cleanup method to close all of the open stream to this console
*/
- private synchronized void closeStreams() {
- if (fStreamsClosed) {
- return;
- }
+ private synchronized void closeStreams() {
+ if (fStreamsClosed) {
+ return;
+ }
for (StreamListener listener : fStreamListeners) {
- listener.closeStream();
- }
- if (fFileOutputStream != null) {
- synchronized (fFileOutputStream) {
- try {
- fFileOutputStream.flush();
- fFileOutputStream.close();
- } catch (IOException e) {
- }
- }
- }
- try {
- fInput.close();
- } catch (IOException e) {
- }
- fStreamsClosed = true;
- }
-
- /**
+ listener.closeStream();
+ }
+ if (fFileOutputStream != null) {
+ synchronized (fFileOutputStream) {
+ try {
+ fFileOutputStream.flush();
+ fFileOutputStream.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ try {
+ fInput.close();
+ } catch (IOException e) {
+ }
+ fStreamsClosed = true;
+ }
+
+ /**
* disposes the listeners for each of the stream associated with this
* console
*/
- private synchronized void disposeStreams() {
+ private synchronized void disposeStreams() {
for (StreamListener listener : fStreamListeners) {
- listener.dispose();
- }
- fFileOutputStream = null;
- fInput = null;
- }
-
- /**
- * @see org.eclipse.ui.console.AbstractConsole#init()
- */
- @Override
+ listener.dispose();
+ }
+ fFileOutputStream = null;
+ fInput = null;
+ }
+
+ /**
+ * @see org.eclipse.ui.console.AbstractConsole#init()
+ */
+ @Override
protected void init() {
- super.init();
+ super.init();
DebugPlugin.getDefault().addDebugEventListener(this);
- if (fProcess.isTerminated()) {
- closeStreams();
- resetName();
+ if (fProcess.isTerminated()) {
+ closeStreams();
+ resetName();
DebugPlugin.getDefault().removeDebugEventListener(this);
- }
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- store.addPropertyChangeListener(this);
- JFaceResources.getFontRegistry().addListener(this);
- if (store.getBoolean(IDebugPreferenceConstants.CONSOLE_WRAP)) {
- setConsoleWidth(store.getInt(IDebugPreferenceConstants.CONSOLE_WIDTH));
- }
- setTabWidth(store.getInt(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH));
-
- if (store.getBoolean(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT)) {
- int highWater = store.getInt(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK);
- int lowWater = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK);
- setWaterMarks(lowWater, highWater);
- }
+ }
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ store.addPropertyChangeListener(this);
+ JFaceResources.getFontRegistry().addListener(this);
+ if (store.getBoolean(IDebugPreferenceConstants.CONSOLE_WRAP)) {
+ setConsoleWidth(store.getInt(IDebugPreferenceConstants.CONSOLE_WIDTH));
+ }
+ setTabWidth(store.getInt(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH));
+
+ if (store.getBoolean(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT)) {
+ int highWater = store.getInt(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK);
+ int lowWater = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK);
+ setWaterMarks(lowWater, highWater);
+ }
DebugUIPlugin.getStandardDisplay().asyncExec(() -> {
setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
});
- }
-
- /**
- * Notify listeners when name changes.
- *
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
- */
- @Override
+ }
+
+ /**
+ * Notify listeners when name changes.
+ *
+ * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
+ */
+ @Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (event.getSource().equals(getProcess())) {
-
- if (event.getKind() == DebugEvent.TERMINATE) {
- closeStreams();
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
-
- resetName();
- }
- }
- }
-
- /**
- * resets the name of this console to the original computed name
- */
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event = events[i];
+ if (event.getSource().equals(getProcess())) {
+
+ if (event.getKind() == DebugEvent.TERMINATE) {
+ closeStreams();
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ }
+
+ resetName();
+ }
+ }
+ }
+
+ /**
+ * resets the name of this console to the original computed name
+ */
private synchronized void resetName() {
- final String newName = computeName();
- String name = getName();
- if (!name.equals(newName)) {
- UIJob job = new UIJob("Update console title") { //$NON-NLS-1$
+ final String newName = computeName();
+ String name = getName();
+ if (!name.equals(newName)) {
+ UIJob job = new UIJob("Update console title") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
ProcessConsole.this.setName(newName);
- warnOfContentChange();
- return Status.OK_STATUS;
+ warnOfContentChange();
+ return Status.OK_STATUS;
}
};
job.setSystem(true);
job.schedule();
- }
- }
-
- /**
- * send notification of a change of content in this console
- */
- private void warnOfContentChange() {
- ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(DebugUITools.getConsole(fProcess));
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#connect(org.eclipse.debug.core.model.IStreamsProxy)
- */
- @Override
+ }
+ }
+
+ /**
+ * send notification of a change of content in this console
+ */
+ private void warnOfContentChange() {
+ ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(DebugUITools.getConsole(fProcess));
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.console.IConsole#connect(org.eclipse.debug.core.model.IStreamsProxy)
+ */
+ @Override
public void connect(IStreamsProxy streamsProxy) {
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- IStreamMonitor streamMonitor = streamsProxy.getErrorStreamMonitor();
- if (streamMonitor != null) {
- connect(streamMonitor, IDebugUIConstants.ID_STANDARD_ERROR_STREAM,
- store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR));
- }
- streamMonitor = streamsProxy.getOutputStreamMonitor();
- if (streamMonitor != null) {
- connect(streamMonitor, IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM,
- store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT));
- }
- InputReadJob readJob = new InputReadJob(streamsProxy);
- readJob.setSystem(true);
- readJob.schedule();
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#connect(org.eclipse.debug.core.model.IStreamMonitor, java.lang.String)
- */
- @Override
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ IStreamMonitor streamMonitor = streamsProxy.getErrorStreamMonitor();
+ if (streamMonitor != null) {
+ connect(streamMonitor, IDebugUIConstants.ID_STANDARD_ERROR_STREAM,
+ store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR));
+ }
+ streamMonitor = streamsProxy.getOutputStreamMonitor();
+ if (streamMonitor != null) {
+ connect(streamMonitor, IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM,
+ store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT));
+ }
+ InputReadJob readJob = new InputReadJob(streamsProxy);
+ readJob.setSystem(true);
+ readJob.schedule();
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.console.IConsole#connect(org.eclipse.debug.core.model.IStreamMonitor, java.lang.String)
+ */
+ @Override
public void connect(IStreamMonitor streamMonitor, String streamIdentifier) {
- connect(streamMonitor, streamIdentifier, false);
- }
-
- /**
- * Connects the given stream monitor to a new output stream with the given identifier.
- *
- * @param streamMonitor stream monitor
- * @param streamIdentifier stream identifier
- * @param activateOnWrite whether the stream should displayed when written to
- */
+ connect(streamMonitor, streamIdentifier, false);
+ }
+
+ /**
+ * Connects the given stream monitor to a new output stream with the given identifier.
+ *
+ * @param streamMonitor stream monitor
+ * @param streamIdentifier stream identifier
+ * @param activateOnWrite whether the stream should displayed when written to
+ */
@SuppressWarnings("resource")
private void connect(IStreamMonitor streamMonitor, String streamIdentifier, boolean activateOnWrite) {
- IOConsoleOutputStream stream = null;
- if (fAllocateConsole) {
+ IOConsoleOutputStream stream = null;
+ if (fAllocateConsole) {
stream = newOutputStream();
Color color = fColorProvider.getColor(streamIdentifier);
stream.setColor(color);
stream.setActivateOnWrite(activateOnWrite);
- }
- synchronized (streamMonitor) {
- StreamListener listener = new StreamListener(streamIdentifier, streamMonitor, stream);
- fStreamListeners.add(listener);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#addLink(org.eclipse.debug.ui.console.IConsoleHyperlink, int, int)
- */
- @Override
+ }
+ synchronized (streamMonitor) {
+ StreamListener listener = new StreamListener(streamIdentifier, streamMonitor, stream);
+ fStreamListeners.add(listener);
+ }
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.console.IConsole#addLink(org.eclipse.debug.ui.console.IConsoleHyperlink, int, int)
+ */
+ @Override
public void addLink(IConsoleHyperlink link, int offset, int length) {
- try {
- addHyperlink(link, offset, length);
- } catch (BadLocationException e) {
- DebugUIPlugin.log(e);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#addLink(org.eclipse.ui.console.IHyperlink, int, int)
- */
- @Override
+ try {
+ addHyperlink(link, offset, length);
+ } catch (BadLocationException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.console.IConsole#addLink(org.eclipse.ui.console.IHyperlink, int, int)
+ */
+ @Override
public void addLink(IHyperlink link, int offset, int length) {
- try {
- addHyperlink(link, offset, length);
- } catch (BadLocationException e) {
- DebugUIPlugin.log(e);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#getRegion(org.eclipse.debug.ui.console.IConsoleHyperlink)
- */
- @Override
+ try {
+ addHyperlink(link, offset, length);
+ } catch (BadLocationException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.console.IConsole#getRegion(org.eclipse.debug.ui.console.IConsoleHyperlink)
+ */
+ @Override
public IRegion getRegion(IConsoleHyperlink link) {
- return super.getRegion(link);
- }
+ return super.getRegion(link);
+ }
- /**
- * This class listens to a specified IO stream
- */
- private class StreamListener implements IStreamListener {
+ /**
+ * This class listens to a specified IO stream
+ */
+ private class StreamListener implements IStreamListener {
- private IOConsoleOutputStream fStream;
+ private IOConsoleOutputStream fStream;
- private IStreamMonitor fStreamMonitor;
+ private IStreamMonitor fStreamMonitor;
- private String fStreamId;
+ private String fStreamId;
- private boolean fFlushed = false;
+ private boolean fFlushed = false;
- private boolean fListenerRemoved = false;
+ private boolean fListenerRemoved = false;
- public StreamListener(String streamIdentifier, IStreamMonitor monitor, IOConsoleOutputStream stream) {
- this.fStreamId = streamIdentifier;
- this.fStreamMonitor = monitor;
- this.fStream = stream;
- fStreamMonitor.addListener(this);
- //fix to bug 121454. Ensure that output to fast processes is processed.
- streamAppended(null, monitor);
- }
+ public StreamListener(String streamIdentifier, IStreamMonitor monitor, IOConsoleOutputStream stream) {
+ this.fStreamId = streamIdentifier;
+ this.fStreamMonitor = monitor;
+ this.fStream = stream;
+ fStreamMonitor.addListener(this);
+ //fix to bug 121454. Ensure that output to fast processes is processed.
+ streamAppended(null, monitor);
+ }
- @Override
+ @Override
public void streamAppended(String text, IStreamMonitor monitor) {
- String encoding = getEncoding();
- if (fFlushed) {
- try {
- if (fStream != null) {
- if (encoding == null) {
+ String encoding = getEncoding();
+ if (fFlushed) {
+ try {
+ if (fStream != null) {
+ if (encoding == null) {
fStream.write(text);
} else {
fStream.write(text.getBytes(encoding));
}
- }
- if (fFileOutputStream != null) {
- synchronized (fFileOutputStream) {
- if (encoding == null) {
+ }
+ if (fFileOutputStream != null) {
+ synchronized (fFileOutputStream) {
+ if (encoding == null) {
fFileOutputStream.write(text.getBytes());
} else {
fFileOutputStream.write(text.getBytes(encoding));
}
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- } else {
- String contents = null;
- synchronized (fStreamMonitor) {
- fFlushed = true;
- contents = fStreamMonitor.getContents();
- if (fStreamMonitor instanceof IFlushableStreamMonitor) {
- IFlushableStreamMonitor m = (IFlushableStreamMonitor) fStreamMonitor;
- m.flushContents();
- m.setBuffered(false);
- }
- }
- try {
- if (contents != null && contents.length() > 0) {
- if (fStream != null) {
- fStream.write(contents);
- }
- if (fFileOutputStream != null) {
- synchronized (fFileOutputStream) {
- fFileOutputStream.write(contents.getBytes());
- }
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
-
- public void closeStream() {
- if (fStreamMonitor == null) {
- return;
- }
- synchronized (fStreamMonitor) {
- fStreamMonitor.removeListener(this);
- if (!fFlushed) {
- String contents = fStreamMonitor.getContents();
- streamAppended(contents, fStreamMonitor);
- }
- fListenerRemoved = true;
- try {
- if (fStream != null) {
- fStream.close();
- }
- } catch (IOException e) {
- }
- }
- }
-
- public void dispose() {
- if (!fListenerRemoved) {
- closeStream();
- }
- fStream = null;
- fStreamMonitor = null;
- fStreamId = null;
- }
- }
-
- private class InputReadJob extends Job {
-
- private IStreamsProxy streamsProxy;
+ }
+ }
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
+ } else {
+ String contents = null;
+ synchronized (fStreamMonitor) {
+ fFlushed = true;
+ contents = fStreamMonitor.getContents();
+ if (fStreamMonitor instanceof IFlushableStreamMonitor) {
+ IFlushableStreamMonitor m = (IFlushableStreamMonitor) fStreamMonitor;
+ m.flushContents();
+ m.setBuffered(false);
+ }
+ }
+ try {
+ if (contents != null && contents.length() > 0) {
+ if (fStream != null) {
+ fStream.write(contents);
+ }
+ if (fFileOutputStream != null) {
+ synchronized (fFileOutputStream) {
+ fFileOutputStream.write(contents.getBytes());
+ }
+ }
+ }
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ }
+
+ public void closeStream() {
+ if (fStreamMonitor == null) {
+ return;
+ }
+ synchronized (fStreamMonitor) {
+ fStreamMonitor.removeListener(this);
+ if (!fFlushed) {
+ String contents = fStreamMonitor.getContents();
+ streamAppended(contents, fStreamMonitor);
+ }
+ fListenerRemoved = true;
+ try {
+ if (fStream != null) {
+ fStream.close();
+ }
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ public void dispose() {
+ if (!fListenerRemoved) {
+ closeStream();
+ }
+ fStream = null;
+ fStreamMonitor = null;
+ fStreamId = null;
+ }
+ }
+
+ private class InputReadJob extends Job {
+
+ private IStreamsProxy streamsProxy;
/**
* The {@link InputStream} this job is currently reading from or maybe blocking
@@ -716,10 +716,10 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
*/
private InputStream readingStream;
- InputReadJob(IStreamsProxy streamsProxy) {
- super("Process Console Input Job"); //$NON-NLS-1$
- this.streamsProxy = streamsProxy;
- }
+ InputReadJob(IStreamsProxy streamsProxy) {
+ super("Process Console Input Job"); //$NON-NLS-1$
+ this.streamsProxy = streamsProxy;
+ }
@Override
protected void canceling() {
@@ -736,7 +736,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
}
- @Override
+ @Override
public boolean belongsTo(Object family) {
return ProcessConsole.class == family;
}
@@ -750,7 +750,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
readingStream = fInput;
InputStreamReader streamReader = (encoding == null ? new InputStreamReader(readingStream)
: new InputStreamReader(readingStream, encoding));
- try {
+ try {
char[] cbuf = new char[1024];
int charRead = 0;
while (charRead >= 0 && !monitor.isCanceled()) {
@@ -766,160 +766,160 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
charRead = streamReader.read(cbuf);
if (charRead > 0) {
String s = new String(cbuf, 0, charRead);
- streamsProxy.write(s);
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
+ streamsProxy.write(s);
+ }
+ }
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
readingStream = null;
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
- }
- }
+ }
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- if (super.getImageDescriptor() == null) {
- setImageDescriptor(computeImageDescriptor());
- }
- return super.getImageDescriptor();
- }
-
- private class ConsoleLogFilePatternMatcher implements IPatternMatchListener {
- String fFilePath;
-
- public ConsoleLogFilePatternMatcher(String filePath) {
- fFilePath = escape(filePath);
- }
-
- private String escape(String path) {
- StringBuilder buffer = new StringBuilder(path);
- int index = buffer.indexOf("\\"); //$NON-NLS-1$
- while (index >= 0) {
- buffer.insert(index, '\\');
- index = buffer.indexOf("\\", index+2); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-
- @Override
+ if (super.getImageDescriptor() == null) {
+ setImageDescriptor(computeImageDescriptor());
+ }
+ return super.getImageDescriptor();
+ }
+
+ private class ConsoleLogFilePatternMatcher implements IPatternMatchListener {
+ String fFilePath;
+
+ public ConsoleLogFilePatternMatcher(String filePath) {
+ fFilePath = escape(filePath);
+ }
+
+ private String escape(String path) {
+ StringBuilder buffer = new StringBuilder(path);
+ int index = buffer.indexOf("\\"); //$NON-NLS-1$
+ while (index >= 0) {
+ buffer.insert(index, '\\');
+ index = buffer.indexOf("\\", index+2); //$NON-NLS-1$
+ }
+ return buffer.toString();
+ }
+
+ @Override
public String getPattern() {
- return fFilePath;
- }
+ return fFilePath;
+ }
- @Override
+ @Override
public void matchFound(PatternMatchEvent event) {
- try {
- addHyperlink(new ConsoleLogFileHyperlink(fFilePath), event.getOffset(), event.getLength());
- removePatternMatchListener(this);
- } catch (BadLocationException e) {
- }
- }
-
- @Override
+ try {
+ addHyperlink(new ConsoleLogFileHyperlink(fFilePath), event.getOffset(), event.getLength());
+ removePatternMatchListener(this);
+ } catch (BadLocationException e) {
+ }
+ }
+
+ @Override
public int getCompilerFlags() {
- return 0;
- }
+ return 0;
+ }
- @Override
+ @Override
public String getLineQualifier() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public void connect(TextConsole console) {
- }
+ }
- @Override
+ @Override
public void disconnect() {
- }
- }
+ }
+ }
- private class ConsoleLogFileHyperlink implements IHyperlink {
- String fFilePath;
- ConsoleLogFileHyperlink(String filePath) {
- fFilePath = filePath;
- }
+ private class ConsoleLogFileHyperlink implements IHyperlink {
+ String fFilePath;
+ ConsoleLogFileHyperlink(String filePath) {
+ fFilePath = filePath;
+ }
- @Override
+ @Override
public void linkActivated() {
- IEditorInput input;
- Path path = new Path(fFilePath);
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile ifile = root.getFileForLocation(path);
- if (ifile == null) { // The file is not in the workspace
- File file = new File(fFilePath);
- LocalFileStorage lfs = new LocalFileStorage(file);
- input = new StorageEditorInput(lfs, file);
-
- } else {
- input = new FileEditorInput(ifile);
- }
-
- IWorkbenchPage activePage = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
- try {
- activePage.openEditor(input, EditorsUI.DEFAULT_TEXT_EDITOR_ID, true);
- } catch (PartInitException e) {
- }
- }
- @Override
+ IEditorInput input;
+ Path path = new Path(fFilePath);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile ifile = root.getFileForLocation(path);
+ if (ifile == null) { // The file is not in the workspace
+ File file = new File(fFilePath);
+ LocalFileStorage lfs = new LocalFileStorage(file);
+ input = new StorageEditorInput(lfs, file);
+
+ } else {
+ input = new FileEditorInput(ifile);
+ }
+
+ IWorkbenchPage activePage = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ try {
+ activePage.openEditor(input, EditorsUI.DEFAULT_TEXT_EDITOR_ID, true);
+ } catch (PartInitException e) {
+ }
+ }
+ @Override
public void linkEntered() {
- }
- @Override
+ }
+ @Override
public void linkExited() {
- }
- }
+ }
+ }
- class StorageEditorInput extends PlatformObject implements IStorageEditorInput {
- private File fFile;
- private IStorage fStorage;
+ class StorageEditorInput extends PlatformObject implements IStorageEditorInput {
+ private File fFile;
+ private IStorage fStorage;
- public StorageEditorInput(IStorage storage, File file) {
- fStorage = storage;
- fFile = file;
- }
+ public StorageEditorInput(IStorage storage, File file) {
+ fStorage = storage;
+ fFile = file;
+ }
- @Override
+ @Override
public IStorage getStorage() {
- return fStorage;
- }
+ return fStorage;
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getName() {
- return getStorage().getName();
- }
+ return getStorage().getName();
+ }
- @Override
+ @Override
public IPersistableElement getPersistable() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getToolTipText() {
- return getStorage().getFullPath().toOSString();
- }
+ return getStorage().getFullPath().toOSString();
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- return object instanceof StorageEditorInput &&
- getStorage().equals(((StorageEditorInput)object).getStorage());
- }
+ return object instanceof StorageEditorInput &&
+ getStorage().equals(((StorageEditorInput)object).getStorage());
+ }
- @Override
+ @Override
public int hashCode() {
- return getStorage().hashCode();
- }
+ return getStorage().hashCode();
+ }
- @Override
+ @Override
public boolean exists() {
- return fFile.exists();
- }
- }
+ return fFile.exists();
+ }
+ }
@Override
public String getHelpContextId() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
index 45d3ac769..3fb4622e7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
@@ -106,98 +106,98 @@ public class ProcessConsoleManager implements ILaunchListener {
}
/**
- * Console document content provider extensions, keyed by extension id
- */
+ * Console document content provider extensions, keyed by extension id
+ */
private Map<String, IConfigurationElement> fColorProviders;
- /**
- * The default color provider. Used if no color provider is contributed
- * for the given process type.
- */
- private IConsoleColorProvider fDefaultColorProvider;
+ /**
+ * The default color provider. Used if no color provider is contributed
+ * for the given process type.
+ */
+ private IConsoleColorProvider fDefaultColorProvider;
- /**
- * Console line trackers; keyed by process type to list of trackers (1:N)
- */
+ /**
+ * Console line trackers; keyed by process type to list of trackers (1:N)
+ */
private Map<String, List<IConfigurationElement>> fLineTrackers;
- /**
- * Map of processes for a launch to compute removed processes
- */
+ /**
+ * Map of processes for a launch to compute removed processes
+ */
private Map<ILaunch, IProcess[]> fProcesses;
/**
* Lock for fLineTrackers
*/
private Object fLineTrackersLock = new Object();
- /**
- * @see ILaunchListener#launchRemoved(ILaunch)
- */
- @Override
+ /**
+ * @see ILaunchListener#launchRemoved(ILaunch)
+ */
+ @Override
public void launchRemoved(ILaunch launch) {
- removeLaunch(launch);
- }
-
- protected void removeLaunch(ILaunch launch) {
- IProcess[] processes= launch.getProcesses();
- for (int i= 0; i < processes.length; i++) {
- IProcess iProcess = processes[i];
- removeProcess(iProcess);
- }
- if (fProcesses != null) {
- fProcesses.remove(launch);
- }
- }
-
- /**
- * Removes the console and document associated with the given process.
- *
- * @param iProcess process to clean up
- */
- private void removeProcess(IProcess iProcess) {
- IConsole console = getConsole(iProcess);
-
- if (console != null) {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- manager.removeConsoles(new IConsole[]{console});
- }
- }
-
- /**
- * Returns the console for the given process, or <code>null</code> if none.
- *
- * @param process
- * @return the console for the given process, or <code>null</code> if none
- */
- public IConsole getConsole(IProcess process) {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] consoles = manager.getConsoles();
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console instanceof ProcessConsole) {
- ProcessConsole pc = (ProcessConsole)console;
- if (pc.getProcess().equals(process)) {
- return pc;
- }
- }
- }
- return null;
- }
-
- /**
- * @see ILaunchListener#launchAdded(ILaunch)
- */
- @Override
+ removeLaunch(launch);
+ }
+
+ protected void removeLaunch(ILaunch launch) {
+ IProcess[] processes= launch.getProcesses();
+ for (int i= 0; i < processes.length; i++) {
+ IProcess iProcess = processes[i];
+ removeProcess(iProcess);
+ }
+ if (fProcesses != null) {
+ fProcesses.remove(launch);
+ }
+ }
+
+ /**
+ * Removes the console and document associated with the given process.
+ *
+ * @param iProcess process to clean up
+ */
+ private void removeProcess(IProcess iProcess) {
+ IConsole console = getConsole(iProcess);
+
+ if (console != null) {
+ IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
+ manager.removeConsoles(new IConsole[]{console});
+ }
+ }
+
+ /**
+ * Returns the console for the given process, or <code>null</code> if none.
+ *
+ * @param process
+ * @return the console for the given process, or <code>null</code> if none
+ */
+ public IConsole getConsole(IProcess process) {
+ IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
+ IConsole[] consoles = manager.getConsoles();
+ for (int i = 0; i < consoles.length; i++) {
+ IConsole console = consoles[i];
+ if (console instanceof ProcessConsole) {
+ ProcessConsole pc = (ProcessConsole)console;
+ if (pc.getProcess().equals(process)) {
+ return pc;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see ILaunchListener#launchAdded(ILaunch)
+ */
+ @Override
public void launchAdded(ILaunch launch) {
- launchChanged(launch);
- }
+ launchChanged(launch);
+ }
- /**
- * @see ILaunchListener#launchChanged(ILaunch)
- */
- @Override
+ /**
+ * @see ILaunchListener#launchChanged(ILaunch)
+ */
+ @Override
public void launchChanged(final ILaunch launch) {
- IProcess[] processes= launch.getProcesses();
+ IProcess[] processes= launch.getProcesses();
for (IProcess process : processes) {
if (process.getStreamsProxy() == null) {
continue;
@@ -206,108 +206,108 @@ public class ProcessConsoleManager implements ILaunchListener {
// create a new console in a separated thread, see bug 355011.
Job job = new ConsoleCreation(launch, process);
job.schedule();
- }
- }
+ }
+ }
List<IProcess> removed = getRemovedProcesses(launch);
- if (removed != null) {
+ if (removed != null) {
for (IProcess p : removed) {
- removeProcess(p);
- }
- }
- }
-
- /**
- * Returns the document for the process, or <code>null</code>
- * if none.
- */
- public IDocument getConsoleDocument(IProcess process) {
- ProcessConsole console = (ProcessConsole) getConsole(process);
- return (console != null ? console.getDocument() : null);
- }
-
- /**
- * Called by the debug ui plug-in on startup.
- * The console document manager starts listening for
- * launches to be registered and initializes if any launches
- * already exist.
- */
- public void startup() {
- ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
- launchManager.addLaunchListener(this);
-
- //set up the docs for launches already registered
- ILaunch[] launches= launchManager.getLaunches();
- for (int i = 0; i < launches.length; i++) {
- launchAdded(launches[i]);
- }
- }
-
- /**
- * Called by the debug ui plug-in on shutdown.
- * The console document manager de-registers as a
- * launch listener and kills all existing console documents.
- */
- public void shutdown() {
+ removeProcess(p);
+ }
+ }
+ }
+
+ /**
+ * Returns the document for the process, or <code>null</code>
+ * if none.
+ */
+ public IDocument getConsoleDocument(IProcess process) {
+ ProcessConsole console = (ProcessConsole) getConsole(process);
+ return (console != null ? console.getDocument() : null);
+ }
+
+ /**
+ * Called by the debug ui plug-in on startup.
+ * The console document manager starts listening for
+ * launches to be registered and initializes if any launches
+ * already exist.
+ */
+ public void startup() {
+ ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
+ launchManager.addLaunchListener(this);
+
+ //set up the docs for launches already registered
+ ILaunch[] launches= launchManager.getLaunches();
+ for (int i = 0; i < launches.length; i++) {
+ launchAdded(launches[i]);
+ }
+ }
+
+ /**
+ * Called by the debug ui plug-in on shutdown.
+ * The console document manager de-registers as a
+ * launch listener and kills all existing console documents.
+ */
+ public void shutdown() {
Job.getJobManager().cancel(ProcessConsoleManager.class);
- ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- removeLaunch(launch);
- }
- launchManager.removeLaunchListener(this);
- if (fProcesses != null) {
- fProcesses.clear();
- }
- }
-
- /**
- * Returns a new console document color provider extension for the given
- * process type, or <code>null</code> if none.
- *
- * @param type corresponds to <code>IProcess.ATTR_PROCESS_TYPE</code>
- * @return IConsoleColorProvider
- */
- public IConsoleColorProvider getColorProvider(String type) {
- if (fColorProviders == null) {
+ ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches = launchManager.getLaunches();
+ for (int i = 0; i < launches.length; i++) {
+ ILaunch launch = launches[i];
+ removeLaunch(launch);
+ }
+ launchManager.removeLaunchListener(this);
+ if (fProcesses != null) {
+ fProcesses.clear();
+ }
+ }
+
+ /**
+ * Returns a new console document color provider extension for the given
+ * process type, or <code>null</code> if none.
+ *
+ * @param type corresponds to <code>IProcess.ATTR_PROCESS_TYPE</code>
+ * @return IConsoleColorProvider
+ */
+ public IConsoleColorProvider getColorProvider(String type) {
+ if (fColorProviders == null) {
fColorProviders = new HashMap<>();
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_COLOR_PROVIDERS);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement extension = elements[i];
- fColorProviders.put(extension.getAttribute("processType"), extension); //$NON-NLS-1$
- }
- }
- IConfigurationElement extension = fColorProviders.get(type);
- if (extension != null) {
- try {
- Object colorProvider = extension.createExecutableExtension("class"); //$NON-NLS-1$
- if (colorProvider instanceof IConsoleColorProvider) {
- return (IConsoleColorProvider)colorProvider;
- }
- DebugUIPlugin.logErrorMessage(MessageFormat.format(
- "Extension {0} must specify an instanceof IConsoleColorProvider for class attribute.", //$NON-NLS-1$
+ IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_COLOR_PROVIDERS);
+ IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement extension = elements[i];
+ fColorProviders.put(extension.getAttribute("processType"), extension); //$NON-NLS-1$
+ }
+ }
+ IConfigurationElement extension = fColorProviders.get(type);
+ if (extension != null) {
+ try {
+ Object colorProvider = extension.createExecutableExtension("class"); //$NON-NLS-1$
+ if (colorProvider instanceof IConsoleColorProvider) {
+ return (IConsoleColorProvider)colorProvider;
+ }
+ DebugUIPlugin.logErrorMessage(MessageFormat.format(
+ "Extension {0} must specify an instanceof IConsoleColorProvider for class attribute.", //$NON-NLS-1$
new Object[] { extension.getDeclaringExtension().getUniqueIdentifier() }));
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- //no color provider found of specified type, return default color provider.
- if (fDefaultColorProvider == null) {
- fDefaultColorProvider = new ConsoleColorProvider();
- }
- return fDefaultColorProvider;
- }
-
- /**
- * Returns the Line Trackers for a given process type.
- * @param process The process for which line trackers are required.
- * @return An array of line trackers which match the given process type.
- */
- public IConsoleLineTracker[] getLineTrackers(IProcess process) {
- String type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE);
-
- if (fLineTrackers == null) {
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ //no color provider found of specified type, return default color provider.
+ if (fDefaultColorProvider == null) {
+ fDefaultColorProvider = new ConsoleColorProvider();
+ }
+ return fDefaultColorProvider;
+ }
+
+ /**
+ * Returns the Line Trackers for a given process type.
+ * @param process The process for which line trackers are required.
+ * @return An array of line trackers which match the given process type.
+ */
+ public IConsoleLineTracker[] getLineTrackers(IProcess process) {
+ String type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE);
+
+ if (fLineTrackers == null) {
synchronized (fLineTrackersLock) { // can't use fLineTrackers as lock as it is null here
fLineTrackers = new HashMap<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_LINE_TRACKERS);
@@ -323,71 +323,71 @@ public class ProcessConsoleManager implements ILaunchListener {
list.add(extension);
}
}
- }
+ }
ArrayList<IConsoleLineTracker> trackers = new ArrayList<>();
- if (type != null) {
+ if (type != null) {
List<IConfigurationElement> lineTrackerExtensions;
synchronized (fLineTrackers) {// need to synchronize as the update to list might be still happening
lineTrackerExtensions = fLineTrackers.get(type);
}
- if(lineTrackerExtensions != null) {
+ if(lineTrackerExtensions != null) {
for (IConfigurationElement element : lineTrackerExtensions) {
try {
trackers.add((IConsoleLineTracker) element.createExecutableExtension("class")); //$NON-NLS-1$
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
}
- }
- }
- return trackers.toArray(new IConsoleLineTracker[0]);
- }
-
- /**
- * Returns the processes that have been removed from the given
- * launch, or <code>null</code> if none.
- *
- * @param launch launch that has changed
- * @return removed processes or <code>null</code>
- */
+ }
+ }
+ return trackers.toArray(new IConsoleLineTracker[0]);
+ }
+
+ /**
+ * Returns the processes that have been removed from the given
+ * launch, or <code>null</code> if none.
+ *
+ * @param launch launch that has changed
+ * @return removed processes or <code>null</code>
+ */
private List<IProcess> getRemovedProcesses(ILaunch launch) {
List<IProcess> removed = null;
- if (fProcesses == null) {
+ if (fProcesses == null) {
fProcesses = new HashMap<>();
- }
- IProcess[] old = fProcesses.get(launch);
- IProcess[] curr = launch.getProcesses();
- if (old != null) {
- for (int i = 0; i < old.length; i++) {
- IProcess process = old[i];
- if (!contains(curr, process)) {
- if (removed == null) {
+ }
+ IProcess[] old = fProcesses.get(launch);
+ IProcess[] curr = launch.getProcesses();
+ if (old != null) {
+ for (int i = 0; i < old.length; i++) {
+ IProcess process = old[i];
+ if (!contains(curr, process)) {
+ if (removed == null) {
removed = new ArrayList<>();
- }
- removed.add(process);
- }
- }
- }
- // update cache with current processes
- fProcesses.put(launch, curr);
- return removed;
- }
-
- /**
- * Returns whether the given object is contained in the list.
- *
- * @param list list to search
- * @param object object to search for
- * @return whether the given object is contained in the list
- */
- private boolean contains(Object[] list, Object object) {
- for (int i = 0; i < list.length; i++) {
- Object object2 = list[i];
- if (object2.equals(object)) {
- return true;
- }
- }
- return false;
- }
+ }
+ removed.add(process);
+ }
+ }
+ }
+ // update cache with current processes
+ fProcesses.put(launch, curr);
+ return removed;
+ }
+
+ /**
+ * Returns whether the given object is contained in the list.
+ *
+ * @param list list to search
+ * @param object object to search for
+ * @return whether the given object is contained in the list
+ */
+ private boolean contains(Object[] list, Object object) {
+ for (int i = 0; i < list.length; i++) {
+ Object object2 = list[i];
+ if (object2.equals(object)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
index 431b52743..d524b0381 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
@@ -59,79 +59,79 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
// actions
private ConsoleTerminateAction fTerminate;
- private ConsoleRemoveLaunchAction fRemoveTerminated;
+ private ConsoleRemoveLaunchAction fRemoveTerminated;
private ConsoleRemoveAllTerminatedAction fRemoveAllTerminated;
private ShowWhenContentChangesAction fStdOut;
private ShowWhenContentChangesAction fStdErr;
- private ProcessConsole fConsole;
+ private ProcessConsole fConsole;
- private IPageBookViewPage fPage;
+ private IPageBookViewPage fPage;
- private IConsoleView fView;
+ private IConsoleView fView;
- private EOFHandler fEOFHandler;
- private String fContextId = "org.eclipse.debug.ui.console"; //$NON-NLS-1$;
- private IContextActivation fActivatedContext;
- private IHandlerActivation fActivatedHandler;
+ private EOFHandler fEOFHandler;
+ private String fContextId = "org.eclipse.debug.ui.console"; //$NON-NLS-1$;
+ private IContextActivation fActivatedContext;
+ private IHandlerActivation fActivatedHandler;
/**
* Handler to send EOF
*/
private class EOFHandler extends AbstractHandler {
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
- IStreamsProxy proxy = getProcess().getStreamsProxy();
- if (proxy instanceof IStreamsProxy2) {
- IStreamsProxy2 proxy2 = (IStreamsProxy2) proxy;
- try {
- proxy2.closeInputStream();
- } catch (IOException e1) {
- }
- }
- return null;
- }
+ IStreamsProxy proxy = getProcess().getStreamsProxy();
+ if (proxy instanceof IStreamsProxy2) {
+ IStreamsProxy2 proxy2 = (IStreamsProxy2) proxy;
+ try {
+ proxy2.closeInputStream();
+ } catch (IOException e1) {
+ }
+ }
+ return null;
+ }
}
- @Override
+ @Override
public void init(IPageBookViewPage page, IConsole console) {
- fPage = page;
- fConsole = (ProcessConsole) console;
+ fPage = page;
+ fConsole = (ProcessConsole) console;
- fRemoveTerminated = new ConsoleRemoveLaunchAction(fConsole.getProcess().getLaunch());
- fRemoveAllTerminated = new ConsoleRemoveAllTerminatedAction();
- fTerminate = new ConsoleTerminateAction(page.getSite().getWorkbenchWindow(), fConsole);
- fStdOut = new ShowStandardOutAction();
- fStdErr = new ShowStandardErrorAction();
+ fRemoveTerminated = new ConsoleRemoveLaunchAction(fConsole.getProcess().getLaunch());
+ fRemoveAllTerminated = new ConsoleRemoveAllTerminatedAction();
+ fTerminate = new ConsoleTerminateAction(page.getSite().getWorkbenchWindow(), fConsole);
+ fStdOut = new ShowStandardOutAction();
+ fStdErr = new ShowStandardErrorAction();
- fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
+ fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
- DebugPlugin.getDefault().addDebugEventListener(this);
- DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
- // contribute to toolbar
- IActionBars actionBars = fPage.getSite().getActionBars();
- configureToolBar(actionBars.getToolBarManager());
+ // contribute to toolbar
+ IActionBars actionBars = fPage.getSite().getActionBars();
+ configureToolBar(actionBars.getToolBarManager());
- // create handler and submissions for EOF
- fEOFHandler = new EOFHandler();
- }
+ // create handler and submissions for EOF
+ fEOFHandler = new EOFHandler();
+ }
- @Override
+ @Override
public void dispose() {
- DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
DebugPlugin.getDefault().removeDebugEventListener(this);
- if (fRemoveTerminated != null) {
- fRemoveTerminated.dispose();
- fRemoveTerminated = null;
- }
+ if (fRemoveTerminated != null) {
+ fRemoveTerminated.dispose();
+ fRemoveTerminated = null;
+ }
if (fRemoveAllTerminated != null) {
fRemoveAllTerminated.dispose();
fRemoveAllTerminated = null;
}
if (fTerminate != null) {
- fTerminate.dispose();
- fTerminate = null;
+ fTerminate.dispose();
+ fTerminate = null;
}
if (fStdOut != null) {
fStdOut.dispose();
@@ -142,116 +142,116 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
fStdErr = null;
}
fConsole = null;
- }
+ }
- /**
- * Contribute actions to the toolbar
- */
- protected void configureToolBar(IToolBarManager mgr) {
+ /**
+ * Contribute actions to the toolbar
+ */
+ protected void configureToolBar(IToolBarManager mgr) {
mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTerminate);
- mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveTerminated);
+ mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveTerminated);
mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveAllTerminated);
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut);
mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdErr);
- }
+ }
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> required) {
- if (IShowInSource.class.equals(required)) {
+ if (IShowInSource.class.equals(required)) {
return (T) this;
- }
- if (IShowInTargetList.class.equals(required)) {
+ }
+ if (IShowInTargetList.class.equals(required)) {
return (T) this;
- }
- //CONTEXTLAUNCHING
- if(ILaunchConfiguration.class.equals(required)) {
- ILaunch launch = getProcess().getLaunch();
- if(launch != null) {
+ }
+ //CONTEXTLAUNCHING
+ if(ILaunchConfiguration.class.equals(required)) {
+ ILaunch launch = getProcess().getLaunch();
+ if(launch != null) {
return (T) launch.getLaunchConfiguration();
- }
- return null;
- }
- return null;
- }
+ }
+ return null;
+ }
+ return null;
+ }
- @Override
+ @Override
public ShowInContext getShowInContext() {
- IProcess process = getProcess();
- if (process == null) {
- return null;
- }
- IDebugTarget target = process.getAdapter(IDebugTarget.class);
- ISelection selection = null;
- if (target == null) {
- selection = new TreeSelection(new TreePath(new Object[]{
- DebugPlugin.getDefault().getLaunchManager(),
- process.getLaunch(),
- process}));
- } else {
- selection = new TreeSelection(new TreePath(new Object[]{
- DebugPlugin.getDefault().getLaunchManager(),
- target.getLaunch(),
- target}));
- }
- return new ShowInContext(null, selection);
- }
+ IProcess process = getProcess();
+ if (process == null) {
+ return null;
+ }
+ IDebugTarget target = process.getAdapter(IDebugTarget.class);
+ ISelection selection = null;
+ if (target == null) {
+ selection = new TreeSelection(new TreePath(new Object[]{
+ DebugPlugin.getDefault().getLaunchManager(),
+ process.getLaunch(),
+ process}));
+ } else {
+ selection = new TreeSelection(new TreePath(new Object[]{
+ DebugPlugin.getDefault().getLaunchManager(),
+ target.getLaunch(),
+ target}));
+ }
+ return new ShowInContext(null, selection);
+ }
- @Override
+ @Override
public String[] getShowInTargetIds() {
- return new String[] {IDebugUIConstants.ID_DEBUG_VIEW};
- }
+ return new String[] {IDebugUIConstants.ID_DEBUG_VIEW};
+ }
- @Override
+ @Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (event.getSource().equals(getProcess())) {
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event = events[i];
+ if (event.getSource().equals(getProcess())) {
Runnable r = () -> {
if (fTerminate != null) {
fTerminate.update();
}
};
- DebugUIPlugin.getStandardDisplay().asyncExec(r);
- }
- }
- }
+ DebugUIPlugin.getStandardDisplay().asyncExec(r);
+ }
+ }
+ }
- protected IProcess getProcess() {
- return fConsole != null ? fConsole.getProcess() : null;
- }
+ protected IProcess getProcess() {
+ return fConsole != null ? fConsole.getProcess() : null;
+ }
- @Override
+ @Override
public void activated() {
- // add EOF submissions
- IPageSite site = fPage.getSite();
- if(fActivatedContext == null && fActivatedHandler == null) {
- IHandlerService handlerService = site.getService(IHandlerService.class);
- IContextService contextService = site.getService(IContextService.class);
- fActivatedContext = contextService.activateContext(fContextId);
- fActivatedHandler = handlerService.activateHandler("org.eclipse.debug.ui.commands.eof", fEOFHandler); //$NON-NLS-1$
- }
- }
+ // add EOF submissions
+ IPageSite site = fPage.getSite();
+ if(fActivatedContext == null && fActivatedHandler == null) {
+ IHandlerService handlerService = site.getService(IHandlerService.class);
+ IContextService contextService = site.getService(IContextService.class);
+ fActivatedContext = contextService.activateContext(fContextId);
+ fActivatedHandler = handlerService.activateHandler("org.eclipse.debug.ui.commands.eof", fEOFHandler); //$NON-NLS-1$
+ }
+ }
- @Override
+ @Override
public void deactivated() {
- // remove EOF submissions
- IPageSite site = fPage.getSite();
- IHandlerService handlerService = site.getService(IHandlerService.class);
- IContextService contextService = site.getService(IContextService.class);
- handlerService.deactivateHandler(fActivatedHandler);
+ // remove EOF submissions
+ IPageSite site = fPage.getSite();
+ IHandlerService handlerService = site.getService(IHandlerService.class);
+ IContextService contextService = site.getService(IContextService.class);
+ handlerService.deactivateHandler(fActivatedHandler);
contextService.deactivateContext(fActivatedContext);
fActivatedContext = null;
fActivatedHandler = null;
- }
+ }
@Override
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
if (fView != null && getProcess().equals(DebugUITools.getCurrentProcess())) {
- fView.display(fConsole);
- }
+ fView.display(fConsole);
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java
index 0ff7735c2..9f42f18cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java
@@ -25,17 +25,17 @@ import org.eclipse.ui.console.TextConsole;
*/
public class ProcessTypePropertyTester extends PropertyTester {
- @Override
+ @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof TextConsole) {
- TextConsole console = (TextConsole) receiver;
- IProcess process = (IProcess) console.getAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS);
- if (process != null) {
- String type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE);
- return (type != null && type.equals(expectedValue));
- }//end if
- }//end if
- return false;
- }//end test
+ if (receiver instanceof TextConsole) {
+ TextConsole console = (TextConsole) receiver;
+ IProcess process = (IProcess) console.getAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS);
+ if (process != null) {
+ String type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE);
+ return (type != null && type.equals(expectedValue));
+ }//end if
+ }//end if
+ return false;
+ }//end test
}//end class
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java
index 786539db4..da5891b07 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java
@@ -40,10 +40,10 @@ public abstract class ShowWhenContentChangesAction extends Action implements IPr
@Override
public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(getKey())) {
- update();
- }
+ String property = event.getProperty();
+ if (property.equals(getKey())) {
+ update();
+ }
}
protected abstract String getKey();
@@ -51,12 +51,12 @@ public abstract class ShowWhenContentChangesAction extends Action implements IPr
private void update() {
IPreferenceStore store = getPreferenceStore();
if (store.getBoolean(getKey())) {
- // on
- setChecked(true);
- } else {
- // off
- setChecked(false);
- }
+ // on
+ setChecked(true);
+ } else {
+ // off
+ setChecked(false);
+ }
}
private IPreferenceStore getPreferenceStore() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
index 4412f3ec8..870b46430 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
@@ -58,135 +58,135 @@ import org.eclipse.ui.IWorkbenchPartSite;
*/
public class ExpressionDropAdapter extends ViewerDropAdapter {
- private IWorkbenchPartSite fSite;
- private TransferData fCurrentTransferType = null;
+ private IWorkbenchPartSite fSite;
+ private TransferData fCurrentTransferType = null;
private boolean fInsertBefore;
private int fDropType;
private static final int DROP_TYPE_DEFAULT = 0;
private static final int DROP_TYPE_VARIABLE = 1;
private static final int DROP_TYPE_EXPRESSION = 2;
- private static final int DROP_TYPE_WATCH_ADAPTABLE_ELEMENT = 3;
-
- /**
- * Constructor takes the viewer this drop adapter applies to.
- * @param viewer the viewer to add drop to
- */
- protected ExpressionDropAdapter(IWorkbenchPartSite site, TreeModelViewer viewer) {
- super(viewer);
- fSite = site;
- setFeedbackEnabled(true);
- setSelectionFeedbackEnabled(false);
- setScrollExpandEnabled(false);
- }
-
- @Override
+ private static final int DROP_TYPE_WATCH_ADAPTABLE_ELEMENT = 3;
+
+ /**
+ * Constructor takes the viewer this drop adapter applies to.
+ * @param viewer the viewer to add drop to
+ */
+ protected ExpressionDropAdapter(IWorkbenchPartSite site, TreeModelViewer viewer) {
+ super(viewer);
+ fSite = site;
+ setFeedbackEnabled(true);
+ setSelectionFeedbackEnabled(false);
+ setScrollExpandEnabled(false);
+ }
+
+ @Override
public void dragEnter(DropTargetEvent event) {
- fDropType = DROP_TYPE_DEFAULT;
- event.detail = DND.DROP_NONE;
-
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataTypes[i])) {
- if (isExpressionDrop()){
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_MOVE;
- fDropType = DROP_TYPE_EXPRESSION;
- break;
- } else if (isVariableDrop()){
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_COPY;
- fDropType = DROP_TYPE_VARIABLE;
- break;
- } else if (isWatchAdaptableElementDrop()){
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_COPY;
- fDropType = DROP_TYPE_WATCH_ADAPTABLE_ELEMENT;
- break;
- }
- } else if (TextTransfer.getInstance().isSupportedType(event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_COPY;
- fDropType = DROP_TYPE_DEFAULT;
- break;
- }
- }
-
- super.dragEnter(event);
- }
-
- /**
- * @return whether the selection transfer contains only IExpressions
- */
- private boolean isExpressionDrop() {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+ fDropType = DROP_TYPE_DEFAULT;
+ event.detail = DND.DROP_NONE;
+
+ for (int i = 0; i < event.dataTypes.length; i++) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataTypes[i])) {
+ if (isExpressionDrop()){
+ event.currentDataType = event.dataTypes[i];
+ event.detail = DND.DROP_MOVE;
+ fDropType = DROP_TYPE_EXPRESSION;
+ break;
+ } else if (isVariableDrop()){
+ event.currentDataType = event.dataTypes[i];
+ event.detail = DND.DROP_COPY;
+ fDropType = DROP_TYPE_VARIABLE;
+ break;
+ } else if (isWatchAdaptableElementDrop()){
+ event.currentDataType = event.dataTypes[i];
+ event.detail = DND.DROP_COPY;
+ fDropType = DROP_TYPE_WATCH_ADAPTABLE_ELEMENT;
+ break;
+ }
+ } else if (TextTransfer.getInstance().isSupportedType(event.dataTypes[i])) {
+ event.currentDataType = event.dataTypes[i];
+ event.detail = DND.DROP_COPY;
+ fDropType = DROP_TYPE_DEFAULT;
+ break;
+ }
+ }
+
+ super.dragEnter(event);
+ }
+
+ /**
+ * @return whether the selection transfer contains only IExpressions
+ */
+ private boolean isExpressionDrop() {
+ IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (getTargetExpression(element) == null){
- return false;
- }
- }
- return true;
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+ if (getTargetExpression(element) == null){
+ return false;
+ }
+ }
+ return true;
}
/**
* @return whether the selection transfer contains only IVariables
*/
private boolean isVariableDrop() {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+ IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (!(element instanceof IVariable)){
- return false;
- }
- }
- return true;
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+ if (!(element instanceof IVariable)){
+ return false;
+ }
+ }
+ return true;
}
- /**
- * @return whether the selection transfer contains only objects adaptable
- * to IWatchExpressionFactoryAdapter2
- */
- private boolean isWatchAdaptableElementDrop() {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+ /**
+ * @return whether the selection transfer contains only objects adaptable
+ * to IWatchExpressionFactoryAdapter2
+ */
+ private boolean isWatchAdaptableElementDrop() {
+ IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (!(element instanceof IAdaptable &&
- ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class) != null))
- {
- return false;
- }
- }
- return true;
- }
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+ if (!(element instanceof IAdaptable &&
+ ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class) != null))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
@Override
public void dragOver(DropTargetEvent event) {
- super.dragOver(event);
- // Allow scrolling (but not expansion)
- event.feedback |= DND.FEEDBACK_SCROLL;
- }
+ super.dragOver(event);
+ // Allow scrolling (but not expansion)
+ event.feedback |= DND.FEEDBACK_SCROLL;
+ }
- @Override
+ @Override
public boolean validateDrop(Object target, int operation, TransferData transferType) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
- switch (fDropType) {
- case DROP_TYPE_EXPRESSION:
- return validateExpressionDrop(target);
- case DROP_TYPE_VARIABLE:
- return validateVariableDrop(target);
- case DROP_TYPE_WATCH_ADAPTABLE_ELEMENT:
- return validateWatchAdaptableDrop(target);
- default:
- break;
- }
- } else if (TextTransfer.getInstance().isSupportedType(transferType)) {
- return validateTextDrop(target);
- }
- return false;
- }
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ switch (fDropType) {
+ case DROP_TYPE_EXPRESSION:
+ return validateExpressionDrop(target);
+ case DROP_TYPE_VARIABLE:
+ return validateVariableDrop(target);
+ case DROP_TYPE_WATCH_ADAPTABLE_ELEMENT:
+ return validateWatchAdaptableDrop(target);
+ default:
+ break;
+ }
+ } else if (TextTransfer.getInstance().isSupportedType(transferType)) {
+ return validateTextDrop(target);
+ }
+ return false;
+ }
/**
* Validates if an IExpression drop is valid by checking if the target
@@ -196,16 +196,16 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
*/
private boolean validateExpressionDrop(Object target){
return target instanceof IExpression ||
- ((target instanceof IAdaptable) && ((IAdaptable)target).getAdapter(IExpression.class) != null);
+ ((target instanceof IAdaptable) && ((IAdaptable)target).getAdapter(IExpression.class) != null);
}
private IExpression getTargetExpression(Object target) {
- if (target instanceof IExpression) {
- return (IExpression)target;
- } else if (target instanceof IAdaptable) {
- return ((IAdaptable)target).getAdapter(IExpression.class);
- }
- return null;
+ if (target instanceof IExpression) {
+ return (IExpression)target;
+ } else if (target instanceof IAdaptable) {
+ return ((IAdaptable)target).getAdapter(IExpression.class);
+ }
+ return null;
}
/**
@@ -217,62 +217,62 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
private boolean validateVariableDrop(Object target) {
// Target must be null or an IExpression, you cannot add a new watch expression inside another
if (target != null && getTargetExpression(target) == null) {
- return false;
+ return false;
}
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- int enabled = 0;
- int size = -1;
- if (selection != null) {
- size = selection.size();
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
+ IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+ int enabled = 0;
+ int size = -1;
+ if (selection != null) {
+ size = selection.size();
+ IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (element instanceof IVariable){
- IVariable variable = (IVariable) element;
- if (variable instanceof IndexedVariablePartition) {
- break;
- } else if (manager.hasWatchExpressionDelegate(variable.getModelIdentifier()) && isFactoryEnabled(variable)) {
- enabled++;
- } else {
- break;
- }
- }
- }
- }
- return enabled == size;
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+ if (element instanceof IVariable){
+ IVariable variable = (IVariable) element;
+ if (variable instanceof IndexedVariablePartition) {
+ break;
+ } else if (manager.hasWatchExpressionDelegate(variable.getModelIdentifier()) && isFactoryEnabled(variable)) {
+ enabled++;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return enabled == size;
}
/**
- * Validates if the drop is valid by validating the local selection transfer
- * to ensure that a watch expression can be created for each contained element.
- * @param target target of the drop
- * @return whether the drop is valid
- */
- private boolean validateWatchAdaptableDrop(Object target) {
- // Target must be null or an IExpression, you cannot add a new watch expression inside another
- if (target != null && getTargetExpression(target) == null) {
- return false;
- }
-
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- int enabled = 0;
- int size = -1;
- if (selection != null) {
- size = selection.size();
+ * Validates if the drop is valid by validating the local selection transfer
+ * to ensure that a watch expression can be created for each contained element.
+ * @param target target of the drop
+ * @return whether the drop is valid
+ */
+ private boolean validateWatchAdaptableDrop(Object target) {
+ // Target must be null or an IExpression, you cannot add a new watch expression inside another
+ if (target != null && getTargetExpression(target) == null) {
+ return false;
+ }
+
+ IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+ int enabled = 0;
+ int size = -1;
+ if (selection != null) {
+ size = selection.size();
Iterator<?> iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (isFactory2Enabled(element)) {
- enabled++;
- } else {
- break;
- }
- }
- }
- return enabled == size;
- }
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+ if (isFactory2Enabled(element)) {
+ enabled++;
+ } else {
+ break;
+ }
+ }
+ }
+ return enabled == size;
+ }
/**
* Validates if the drop is valid by validating the drop location.
@@ -282,7 +282,7 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
* @return whether the drop is valid
*/
private boolean validateTextDrop(Object target){
- return target == null || getTargetExpression(target) != null;
+ return target == null || getTargetExpression(target) != null;
}
/**
@@ -292,219 +292,219 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
* @return whether the factory is enabled
*/
private boolean isFactoryEnabled(IVariable variable) {
- IWatchExpressionFactoryAdapter factory = getFactory(variable);
- if (factory instanceof IWatchExpressionFactoryAdapterExtension) {
- IWatchExpressionFactoryAdapterExtension ext = (IWatchExpressionFactoryAdapterExtension) factory;
- return ext.canCreateWatchExpression(variable);
- }
- return true;
+ IWatchExpressionFactoryAdapter factory = getFactory(variable);
+ if (factory instanceof IWatchExpressionFactoryAdapterExtension) {
+ IWatchExpressionFactoryAdapterExtension ext = (IWatchExpressionFactoryAdapterExtension) factory;
+ return ext.canCreateWatchExpression(variable);
+ }
+ return true;
}
- /**
- * Returns whether the factory adapter for the given element is currently enabled.
- *
- * @param element the element to ask for the adapter
- * @return whether the factory is enabled
- */
- private boolean isFactory2Enabled(Object element) {
- IWatchExpressionFactoryAdapter2 factory = getFactory2(element);
- if (factory != null) {
- return factory.canCreateWatchExpression(element);
- }
- return false;
- }
+ /**
+ * Returns whether the factory adapter for the given element is currently enabled.
+ *
+ * @param element the element to ask for the adapter
+ * @return whether the factory is enabled
+ */
+ private boolean isFactory2Enabled(Object element) {
+ IWatchExpressionFactoryAdapter2 factory = getFactory2(element);
+ if (factory != null) {
+ return factory.canCreateWatchExpression(element);
+ }
+ return false;
+ }
@Override
public void drop(DropTargetEvent event) {
- fCurrentTransferType = event.currentDataType;
- // Unless insert after is explicitly set, insert before
- fInsertBefore = getCurrentLocation() != LOCATION_AFTER;
- super.drop(event);
+ fCurrentTransferType = event.currentDataType;
+ // Unless insert after is explicitly set, insert before
+ fInsertBefore = getCurrentLocation() != LOCATION_AFTER;
+ super.drop(event);
}
- @Override
+ @Override
public boolean performDrop(Object data) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(fCurrentTransferType)) {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- if (fDropType == DROP_TYPE_EXPRESSION){
- return performExpressionDrop(selection);
- } else if (fDropType == DROP_TYPE_VARIABLE || fDropType == DROP_TYPE_WATCH_ADAPTABLE_ELEMENT){
- return performVariableOrWatchAdaptableDrop(selection);
- }
- } else if (TextTransfer.getInstance().isSupportedType(fCurrentTransferType)) {
- if (data != null) {
- return performTextDrop((String)data);
- }
- }
- return false;
- }
-
- /**
- * Performs the drop when the selection is a collection of IExpressions.
- * Moves the given expressions from their original locations to the
- * location of the current target.
- * @param selection the dragged selection
- * @return whether the drop could be completed
- */
- private boolean performExpressionDrop(IStructuredSelection selection) {
- IExpression targetExpression = getTargetExpression(getCurrentTarget());
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(fCurrentTransferType)) {
+ IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
+ if (fDropType == DROP_TYPE_EXPRESSION){
+ return performExpressionDrop(selection);
+ } else if (fDropType == DROP_TYPE_VARIABLE || fDropType == DROP_TYPE_WATCH_ADAPTABLE_ELEMENT){
+ return performVariableOrWatchAdaptableDrop(selection);
+ }
+ } else if (TextTransfer.getInstance().isSupportedType(fCurrentTransferType)) {
+ if (data != null) {
+ return performTextDrop((String)data);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Performs the drop when the selection is a collection of IExpressions.
+ * Moves the given expressions from their original locations to the
+ * location of the current target.
+ * @param selection the dragged selection
+ * @return whether the drop could be completed
+ */
+ private boolean performExpressionDrop(IStructuredSelection selection) {
+ IExpression targetExpression = getTargetExpression(getCurrentTarget());
if (targetExpression != null){
IExpression[] expressions = new IExpression[selection.size()];
Object[] selectionElements = selection.toArray();
for (int i = 0; i < selectionElements.length; i++) {
- expressions[i] = getTargetExpression(selectionElements[i]);
+ expressions[i] = getTargetExpression(selectionElements[i]);
}
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
- if (manager instanceof ExpressionManager){
- ((ExpressionManager)manager).moveExpressions(expressions, targetExpression, fInsertBefore);
- }
- return true;
+ IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
+ if (manager instanceof ExpressionManager){
+ ((ExpressionManager)manager).moveExpressions(expressions, targetExpression, fInsertBefore);
+ }
+ return true;
}
return false;
}
/**
- * If the dragged data is a structured selection, get any IVariables in it
- * and create expressions for each of them. Insert the created expressions
- * at the currently selected target or add them to the end of the collection
- * if no target is selected.
- *
- * @param selection Structured selection containing IVariables
- * @return whether the drop was successful
- */
- private boolean performVariableOrWatchAdaptableDrop(IStructuredSelection selection) {
+ * If the dragged data is a structured selection, get any IVariables in it
+ * and create expressions for each of them. Insert the created expressions
+ * at the currently selected target or add them to the end of the collection
+ * if no target is selected.
+ *
+ * @param selection Structured selection containing IVariables
+ * @return whether the drop was successful
+ */
+ private boolean performVariableOrWatchAdaptableDrop(IStructuredSelection selection) {
List<IExpression> expressions = new ArrayList<>(selection.size());
for (Iterator<?> itr = selection.iterator(); itr.hasNext();) {
- Object element = itr.next();
- String expressionText = createExpressionString(element);
- if (expressionText != null){
- IExpression expression = createExpression(expressionText);
- if (expression != null){
- expressions.add(expression);
- } else {
- DebugUIPlugin.log(new Status(IStatus.ERROR,DebugUIPlugin.getUniqueIdentifier(),"Drop failed. Watch expression could not be created for the text " + expressionText)); //$NON-NLS-1$
- return false;
- }
- } else {
- return false;
- }
- }
- if (expressions.size() == selection.size()){
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
- if (manager instanceof ExpressionManager){
- IExpression targetExpression = getTargetExpression(getCurrentTarget());
- if (targetExpression != null){
- ((ExpressionManager)manager).insertExpressions(expressions.toArray(new IExpression[expressions.size()]), targetExpression, fInsertBefore);
- } else {
- ((ExpressionManager)manager).addExpressions(expressions.toArray(new IExpression[expressions.size()]));
- }
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * Performs the drop when text was dragged. Creates a new watch expression from
- * the text. Inserts the expression at the currently selected target or adds it
- * to the end of the collection if no target is selected.
- *
- * @param text string to use to create the expression
- * @return whether the drop was successful
- */
- private boolean performTextDrop(String text){
- IExpression expression = createExpression(text);
- if (expression != null){
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
- if (manager instanceof ExpressionManager){
- IExpression targetExpression = getTargetExpression(getCurrentTarget());
- if (targetExpression != null){
- ((ExpressionManager)manager).insertExpressions(new IExpression[]{expression}, targetExpression, fInsertBefore);
- } else {
- ((ExpressionManager)manager).addExpression(expression);
- }
- return true;
- }
- }
- DebugUIPlugin.log(new Status(IStatus.ERROR,DebugUIPlugin.getUniqueIdentifier(),"Drop failed. Watch expression could not be created for the text " + text)); //$NON-NLS-1$
- return false;
- }
-
- /**
- * Creates a new watch expression from an IVariable using the watch expression factory
- * adapter for that variable.
- *
- * @param variable the variable to use to create the watch expression
- * @return the string to be used to create expression, return <code>null</code>
- * if no expression is to be created
- */
- private String createExpressionString(Object element) {
- try {
- if (element instanceof IVariable) {
- IVariable variable = (IVariable)element;
- IWatchExpressionFactoryAdapter factory = getFactory(variable);
- String exp = variable.getName();
- if (factory != null) {
- //if a factory exists, use it to create expression,
- //otherwise just use variable name
- exp = factory.createWatchExpression(variable);
- }
- return exp;
- } else {
- IWatchExpressionFactoryAdapter2 factory2 = getFactory2(element);
- if (factory2 != null) {
- return factory2.createWatchExpression(element);
- }
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e.getStatus());
- }
- return null;
- }
-
- /**
- * Creates a new watch expression from a string using the default expression manager.
- *
- * @param exp the string to use to create the expression
- */
- private IExpression createExpression(String exp) {
- IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(exp);
- IAdaptable object = DebugUITools.getPartDebugContext(fSite);
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- expression.setExpressionContext(context);
- return expression;
- }
-
-
- /**
- * Returns the factory adapter for the given variable or <code>null</code> if none.
- *
- * @param variable
- * @return factory or <code>null</code>
- */
- private IWatchExpressionFactoryAdapter getFactory(IVariable variable) {
- return variable.getAdapter(IWatchExpressionFactoryAdapter.class);
- }
-
- /**
- * Returns the factory adapter for the given element or <code>null</code> if none.
- *
- * @param element
- * @return factory or <code>null</code>
- */
- private IWatchExpressionFactoryAdapter2 getFactory2(Object element) {
- if (element instanceof IAdaptable) {
- return ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
- }
- return null;
- }
+ Object element = itr.next();
+ String expressionText = createExpressionString(element);
+ if (expressionText != null){
+ IExpression expression = createExpression(expressionText);
+ if (expression != null){
+ expressions.add(expression);
+ } else {
+ DebugUIPlugin.log(new Status(IStatus.ERROR,DebugUIPlugin.getUniqueIdentifier(),"Drop failed. Watch expression could not be created for the text " + expressionText)); //$NON-NLS-1$
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+ if (expressions.size() == selection.size()){
+ IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
+ if (manager instanceof ExpressionManager){
+ IExpression targetExpression = getTargetExpression(getCurrentTarget());
+ if (targetExpression != null){
+ ((ExpressionManager)manager).insertExpressions(expressions.toArray(new IExpression[expressions.size()]), targetExpression, fInsertBefore);
+ } else {
+ ((ExpressionManager)manager).addExpressions(expressions.toArray(new IExpression[expressions.size()]));
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Performs the drop when text was dragged. Creates a new watch expression from
+ * the text. Inserts the expression at the currently selected target or adds it
+ * to the end of the collection if no target is selected.
+ *
+ * @param text string to use to create the expression
+ * @return whether the drop was successful
+ */
+ private boolean performTextDrop(String text){
+ IExpression expression = createExpression(text);
+ if (expression != null){
+ IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
+ if (manager instanceof ExpressionManager){
+ IExpression targetExpression = getTargetExpression(getCurrentTarget());
+ if (targetExpression != null){
+ ((ExpressionManager)manager).insertExpressions(new IExpression[]{expression}, targetExpression, fInsertBefore);
+ } else {
+ ((ExpressionManager)manager).addExpression(expression);
+ }
+ return true;
+ }
+ }
+ DebugUIPlugin.log(new Status(IStatus.ERROR,DebugUIPlugin.getUniqueIdentifier(),"Drop failed. Watch expression could not be created for the text " + text)); //$NON-NLS-1$
+ return false;
+ }
+
+ /**
+ * Creates a new watch expression from an IVariable using the watch expression factory
+ * adapter for that variable.
+ *
+ * @param variable the variable to use to create the watch expression
+ * @return the string to be used to create expression, return <code>null</code>
+ * if no expression is to be created
+ */
+ private String createExpressionString(Object element) {
+ try {
+ if (element instanceof IVariable) {
+ IVariable variable = (IVariable)element;
+ IWatchExpressionFactoryAdapter factory = getFactory(variable);
+ String exp = variable.getName();
+ if (factory != null) {
+ //if a factory exists, use it to create expression,
+ //otherwise just use variable name
+ exp = factory.createWatchExpression(variable);
+ }
+ return exp;
+ } else {
+ IWatchExpressionFactoryAdapter2 factory2 = getFactory2(element);
+ if (factory2 != null) {
+ return factory2.createWatchExpression(element);
+ }
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e.getStatus());
+ }
+ return null;
+ }
+
+ /**
+ * Creates a new watch expression from a string using the default expression manager.
+ *
+ * @param exp the string to use to create the expression
+ */
+ private IExpression createExpression(String exp) {
+ IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(exp);
+ IAdaptable object = DebugUITools.getPartDebugContext(fSite);
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ expression.setExpressionContext(context);
+ return expression;
+ }
+
+
+ /**
+ * Returns the factory adapter for the given variable or <code>null</code> if none.
+ *
+ * @param variable
+ * @return factory or <code>null</code>
+ */
+ private IWatchExpressionFactoryAdapter getFactory(IVariable variable) {
+ return variable.getAdapter(IWatchExpressionFactoryAdapter.class);
+ }
+
+ /**
+ * Returns the factory adapter for the given element or <code>null</code> if none.
+ *
+ * @param element
+ * @return factory or <code>null</code>
+ */
+ private IWatchExpressionFactoryAdapter2 getFactory2(Object element) {
+ if (element instanceof IAdaptable) {
+ return ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
index 72e48b518..562370436 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
@@ -61,8 +61,8 @@ import org.eclipse.ui.actions.ActionFactory;
*/
public class ExpressionView extends VariablesView {
- private PasteWatchExpressionsAction fPasteAction;
- private EditWatchExpressinInPlaceAction fEditInPlaceAction;
+ private PasteWatchExpressionsAction fPasteAction;
+ private EditWatchExpressinInPlaceAction fEditInPlaceAction;
@Override
protected String getHelpContextId() {
@@ -81,15 +81,15 @@ public class ExpressionView extends VariablesView {
menu.add(new Separator(IDebugUIConstants.EMPTY_EXPRESSION_GROUP));
menu.add(new Separator(IDebugUIConstants.EXPRESSION_GROUP));
menu.add(getAction(FIND_ACTION));
- ChangeVariableValueAction changeValueAction = (ChangeVariableValueAction)getAction("ChangeVariableValue"); //$NON-NLS-1$
- if (changeValueAction.isApplicable()) {
- menu.add(changeValueAction);
- }
+ ChangeVariableValueAction changeValueAction = (ChangeVariableValueAction)getAction("ChangeVariableValue"); //$NON-NLS-1$
+ if (changeValueAction.isApplicable()) {
+ menu.add(changeValueAction);
+ }
menu.add(new Separator());
IAction action = new AvailableLogicalStructuresAction(this);
- if (action.isEnabled()) {
- menu.add(action);
- }
+ if (action.isEnabled()) {
+ menu.add(action);
+ }
action = new AvailableDetailPanesAction(this);
if (isDetailPaneVisible() && action.isEnabled()) {
menu.add(action);
@@ -104,24 +104,24 @@ public class ExpressionView extends VariablesView {
return;
}
if (selection == null || selection.isEmpty()) {
- super.contextActivated(new StructuredSelection(DebugPlugin.getDefault().getExpressionManager()));
+ super.contextActivated(new StructuredSelection(DebugPlugin.getDefault().getExpressionManager()));
} else {
super.contextActivated(selection);
}
- if (isAvailable() && isVisible()) {
- updateAction("ContentAssist"); //$NON-NLS-1$
- }
+ if (isAvailable() && isVisible()) {
+ updateAction("ContentAssist"); //$NON-NLS-1$
+ }
}
@Override
protected void viewerInputUpdateComplete(IViewerInputUpdate update) {
- IStatus status = update.getStatus();
- if ( (status == null || status.isOK()) && update.getElement() != null) {
- setViewerInput(update.getInputElement());
- } else {
- setViewerInput(DebugPlugin.getDefault().getExpressionManager());
- }
- updateAction(FIND_ACTION);
+ IStatus status = update.getStatus();
+ if ( (status == null || status.isOK()) && update.getElement() != null) {
+ setViewerInput(update.getInputElement());
+ } else {
+ setViewerInput(DebugPlugin.getDefault().getExpressionManager());
+ }
+ updateAction(FIND_ACTION);
}
@Override
@@ -139,103 +139,103 @@ public class ExpressionView extends VariablesView {
return IDebugUIConstants.ID_EXPRESSION_VIEW;
}
- @Override
+ @Override
protected void initDragAndDrop(TreeModelViewer viewer) {
- viewer.addDragSupport(DND.DROP_MOVE, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer));
- viewer.addDropSupport(DND.DROP_MOVE|DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance()}, new ExpressionDropAdapter(getSite(), viewer));
- }
+ viewer.addDragSupport(DND.DROP_MOVE, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer));
+ viewer.addDropSupport(DND.DROP_MOVE|DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance()}, new ExpressionDropAdapter(getSite(), viewer));
+ }
- @Override
+ @Override
protected void createActions() {
- super.createActions();
- fPasteAction = new PasteWatchExpressionsAction(this);
- configure(fPasteAction, IWorkbenchCommandConstants.EDIT_PASTE, PASTE_ACTION, ISharedImages.IMG_TOOL_PASTE);
- fEditInPlaceAction = new EditWatchExpressinInPlaceAction(this);
- configure(fEditInPlaceAction, IWorkbenchCommandConstants.FILE_RENAME, ActionFactory.RENAME.getId(), null);
- }
-
- @Override
+ super.createActions();
+ fPasteAction = new PasteWatchExpressionsAction(this);
+ configure(fPasteAction, IWorkbenchCommandConstants.EDIT_PASTE, PASTE_ACTION, ISharedImages.IMG_TOOL_PASTE);
+ fEditInPlaceAction = new EditWatchExpressinInPlaceAction(this);
+ configure(fEditInPlaceAction, IWorkbenchCommandConstants.FILE_RENAME, ActionFactory.RENAME.getId(), null);
+ }
+
+ @Override
public void dispose() {
- fEditInPlaceAction.dispose();
- super.dispose();
- }
-
- /**
- * Configures the action to override the global action, and registers the
- * action with this view.
- *
- * @param action
- * action
- * @param defId
- * action definition id
- * @param globalId
- * global action id
- * @param imgId
- * image identifier
- */
- private void configure(IAction action, String defId, String globalId,
- String imgId) {
- setAction(globalId, action);
- action.setActionDefinitionId(defId);
- setGlobalAction(globalId, action);
- if (imgId != null) {
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imgId));
- }
- }
-
- /**
- * Returns whether the given selection can be pasted into the expressions
- * view.
- *
- * @return whether the given selection can be pasted into the given target
- */
- public boolean canPaste() {
- String clipboardText = getClipboardText();
- if (clipboardText != null && clipboardText.length() > 0) {
- return true;
- }
- return false;
- }
-
- /**
- * Pastes the selection into the given target
- *
- * @return whether successful
- */
- public boolean performPaste() {
- String clipboardText = getClipboardText();
- if (clipboardText != null && clipboardText.length() > 0) {
- IExpressionManager expressionManager = DebugPlugin.getDefault().getExpressionManager();
- IWatchExpression watchExpression = expressionManager
- .newWatchExpression(clipboardText);
- expressionManager.addExpression(watchExpression);
- watchExpression.setExpressionContext(getContext());
- return true;
- }
- return false;
- }
-
- // TODO: duplicate code from WatchExpressionAction
- protected IDebugElement getContext() {
- IAdaptable object = DebugUITools.getPartDebugContext(getSite());
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- return context;
- }
-
- protected String getClipboardText() {
- Clipboard clipboard = new Clipboard(Display.getDefault());
- try {
- TextTransfer textTransfer = TextTransfer.getInstance();
- return (String) clipboard.getContents(textTransfer);
- } finally {
- clipboard.dispose();
- }
- }
+ fEditInPlaceAction.dispose();
+ super.dispose();
+ }
+
+ /**
+ * Configures the action to override the global action, and registers the
+ * action with this view.
+ *
+ * @param action
+ * action
+ * @param defId
+ * action definition id
+ * @param globalId
+ * global action id
+ * @param imgId
+ * image identifier
+ */
+ private void configure(IAction action, String defId, String globalId,
+ String imgId) {
+ setAction(globalId, action);
+ action.setActionDefinitionId(defId);
+ setGlobalAction(globalId, action);
+ if (imgId != null) {
+ action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imgId));
+ }
+ }
+
+ /**
+ * Returns whether the given selection can be pasted into the expressions
+ * view.
+ *
+ * @return whether the given selection can be pasted into the given target
+ */
+ public boolean canPaste() {
+ String clipboardText = getClipboardText();
+ if (clipboardText != null && clipboardText.length() > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Pastes the selection into the given target
+ *
+ * @return whether successful
+ */
+ public boolean performPaste() {
+ String clipboardText = getClipboardText();
+ if (clipboardText != null && clipboardText.length() > 0) {
+ IExpressionManager expressionManager = DebugPlugin.getDefault().getExpressionManager();
+ IWatchExpression watchExpression = expressionManager
+ .newWatchExpression(clipboardText);
+ expressionManager.addExpression(watchExpression);
+ watchExpression.setExpressionContext(getContext());
+ return true;
+ }
+ return false;
+ }
+
+ // TODO: duplicate code from WatchExpressionAction
+ protected IDebugElement getContext() {
+ IAdaptable object = DebugUITools.getPartDebugContext(getSite());
+ IDebugElement context = null;
+ if (object instanceof IDebugElement) {
+ context = (IDebugElement) object;
+ } else if (object instanceof ILaunch) {
+ context = ((ILaunch) object).getDebugTarget();
+ }
+ return context;
+ }
+
+ protected String getClipboardText() {
+ Clipboard clipboard = new Clipboard(Display.getDefault());
+ try {
+ TextTransfer textTransfer = TextTransfer.getInstance();
+ return (String) clipboard.getContents(textTransfer);
+ } finally {
+ clipboard.dispose();
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java
index 8a9e3cbeb..368b7b5bf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java
@@ -32,7 +32,7 @@ class BreadcrumbDropDownAutoExpandAction extends Action {
* Creates a new action to set the debug view mode.
*
* @param view Reference to the debug view.
- * in auto mode.
+ * in auto mode.
*/
public BreadcrumbDropDownAutoExpandAction(LaunchView view) {
super(IInternalDebugCoreConstants.EMPTY_STRING, AS_CHECK_BOX);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
index 51c5cdd0b..8627110ca 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
@@ -27,70 +27,70 @@ import org.eclipse.ui.IWorkbenchPartSite;
*/
class BreadcrumbWorkbenchPart implements IWorkbenchPart {
- private IWorkbenchPartSite fSite = null;
+ private IWorkbenchPartSite fSite = null;
- @Override
+ @Override
public boolean equals(Object obj) {
- return (obj instanceof BreadcrumbWorkbenchPart);
- }
+ return (obj instanceof BreadcrumbWorkbenchPart);
+ }
- @Override
+ @Override
public int hashCode() {
- return getClass().hashCode();
- }
-
- /**
- * Constructs a part for the given console that binds to the given
- * site
- * @param site the backing site
- */
- public BreadcrumbWorkbenchPart(IWorkbenchPartSite site) {
- fSite = site;
- }
-
- @Override
+ return getClass().hashCode();
+ }
+
+ /**
+ * Constructs a part for the given console that binds to the given
+ * site
+ * @param site the backing site
+ */
+ public BreadcrumbWorkbenchPart(IWorkbenchPartSite site) {
+ fSite = site;
+ }
+
+ @Override
public void addPropertyListener(IPropertyListener listener) {
- }
+ }
- @Override
+ @Override
public void createPartControl(Composite parent) {
- }
+ }
- @Override
+ @Override
public void dispose() {
- }
+ }
- @Override
+ @Override
public IWorkbenchPartSite getSite() {
- return fSite;
- }
+ return fSite;
+ }
- @Override
+ @Override
public String getTitle() {
- return ""; //$NON-NLS-1$
- }
+ return ""; //$NON-NLS-1$
+ }
- @Override
+ @Override
public Image getTitleImage() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getTitleToolTip() {
- return ""; //$NON-NLS-1$
- }
+ return ""; //$NON-NLS-1$
+ }
- @Override
+ @Override
public void removePropertyListener(IPropertyListener listener) {
- }
+ }
- @Override
+ @Override
public void setFocus() {
- }
+ }
- @Override
+ @Override
public <T> T getAdapter(Class<T> adapter) {
- return null;
- }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
index de46ada99..6f21df74c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
@@ -99,243 +99,243 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
private static ISourceDisplay fgStackFrameSourceDisplayAdapter = new StackFrameSourceDisplayAdapter();
private static IModelSelectionPolicyFactory fgModelSelectionPolicyFactoryAdapter = new DefaultModelSelectionPolicyFactory();
- private static IAsynchronousLabelAdapter fgDebugLabelAdapter = new AsynchronousDebugLabelAdapter();
- private static IAsynchronousLabelAdapter fgMemoryBlockLabelAdapter = new MemoryBlockLabelAdapter();
- private static IAsynchronousLabelAdapter fgTableRenderingLineLabelAdapter = new MemorySegmentLabelAdapter();
+ private static IAsynchronousLabelAdapter fgDebugLabelAdapter = new AsynchronousDebugLabelAdapter();
+ private static IAsynchronousLabelAdapter fgMemoryBlockLabelAdapter = new MemoryBlockLabelAdapter();
+ private static IAsynchronousLabelAdapter fgTableRenderingLineLabelAdapter = new MemorySegmentLabelAdapter();
- private static IElementLabelProvider fgLPDebugElement = new DebugElementLabelProvider();
- private static IElementLabelProvider fgLPVariable = new VariableLabelProvider();
- private static IElementLabelProvider fgLPExpression = new ExpressionLabelProvider();
- private static IElementLabelProvider fgLPRegisterGroup = new RegisterGroupLabelProvider();
- private static IElementLabelProvider fgLPMemoryBlock = new MemoryBlockLabelProvider();
- private static IElementLabelProvider fgLPBreakpoint = new BreakpointLabelProvider();
- private static IElementLabelProvider fgLPBreakpointContainer = new BreakpointContainerLabelProvider();
- private static IElementEditor fgEEVariable = new VariableEditor();
- private static IElementEditor fgEEWatchExpression = new WatchExpressionEditor();
+ private static IElementLabelProvider fgLPDebugElement = new DebugElementLabelProvider();
+ private static IElementLabelProvider fgLPVariable = new VariableLabelProvider();
+ private static IElementLabelProvider fgLPExpression = new ExpressionLabelProvider();
+ private static IElementLabelProvider fgLPRegisterGroup = new RegisterGroupLabelProvider();
+ private static IElementLabelProvider fgLPMemoryBlock = new MemoryBlockLabelProvider();
+ private static IElementLabelProvider fgLPBreakpoint = new BreakpointLabelProvider();
+ private static IElementLabelProvider fgLPBreakpointContainer = new BreakpointContainerLabelProvider();
+ private static IElementEditor fgEEVariable = new VariableEditor();
+ private static IElementEditor fgEEWatchExpression = new WatchExpressionEditor();
- private static IAsynchronousContentAdapter fgAsyncMemoryRetrieval = new MemoryRetrievalContentAdapter();
- private static IAsynchronousContentAdapter fgAsyncMemoryBlock = new MemoryBlockContentAdapter();
+ private static IAsynchronousContentAdapter fgAsyncMemoryRetrieval = new MemoryRetrievalContentAdapter();
+ private static IAsynchronousContentAdapter fgAsyncMemoryBlock = new MemoryBlockContentAdapter();
- private static IElementContentProvider fgCPLaunchManger = new LaunchManagerContentProvider();
- private static IElementContentProvider fgCPLaunch = new LaunchContentProvider();
- private static IElementContentProvider fgCPProcess = new ProcessContentProvider();
- private static IElementContentProvider fgCPTarget = new DebugTargetContentProvider();
- private static IElementContentProvider fgCPThread = new ThreadContentProvider();
- private static IElementContentProvider fgCPFrame = new StackFrameContentProvider();
- private static IElementContentProvider fgCPVariable = new VariableContentProvider();
- private static IElementContentProvider fgCPExpressionManager = new ExpressionManagerContentProvider();
- private static IElementContentProvider fgCPExpression = new ExpressionContentProvider();
- private static IElementContentProvider fgCPRegisterGroup = new RegisterGroupContentProvider();
- private static IElementContentProvider fgCPMemoryRetrieval = new MemoryRetrievalContentProvider();
- private static IElementContentProvider fgCPMemoryBlock = new MemoryBlockContentProvider();
- private static IElementContentProvider fgCPBreakpointManager = new BreakpointManagerContentProvider();
+ private static IElementContentProvider fgCPLaunchManger = new LaunchManagerContentProvider();
+ private static IElementContentProvider fgCPLaunch = new LaunchContentProvider();
+ private static IElementContentProvider fgCPProcess = new ProcessContentProvider();
+ private static IElementContentProvider fgCPTarget = new DebugTargetContentProvider();
+ private static IElementContentProvider fgCPThread = new ThreadContentProvider();
+ private static IElementContentProvider fgCPFrame = new StackFrameContentProvider();
+ private static IElementContentProvider fgCPVariable = new VariableContentProvider();
+ private static IElementContentProvider fgCPExpressionManager = new ExpressionManagerContentProvider();
+ private static IElementContentProvider fgCPExpression = new ExpressionContentProvider();
+ private static IElementContentProvider fgCPRegisterGroup = new RegisterGroupContentProvider();
+ private static IElementContentProvider fgCPMemoryRetrieval = new MemoryRetrievalContentProvider();
+ private static IElementContentProvider fgCPMemoryBlock = new MemoryBlockContentProvider();
+ private static IElementContentProvider fgCPBreakpointManager = new BreakpointManagerContentProvider();
private static IElementContentProvider fgCPBreakpoint = new BreakpointContentProvider();
- private static IElementMementoProvider fgMPFrame = new StackFrameMementoProvider();
- private static IElementMementoProvider fgMPVariable = new VariableMementoProvider();
- private static IElementMementoProvider fgMPExpression = new ExpressionMementoProvider();
- private static IElementMementoProvider fgMPRegisterGroup = new RegisterGroupMementoProvider();
- private static IElementMementoProvider fgMPExpressionManager = new ExpressionManagerMementoProvider();
- private static IElementMementoProvider fgMPMemory = new MemoryViewElementMementoProvider();
- private static IElementMementoProvider fgMPBreakpointManagerInput = new BreakpointManagerInputMementoProvider();
- private static IElementMementoProvider fgMPBreakpointContainer = new BreakpointContainerMementoProvider();
- private static IElementMementoProvider fgMPBreakpoint = new BreakpointMementoProvider();
+ private static IElementMementoProvider fgMPFrame = new StackFrameMementoProvider();
+ private static IElementMementoProvider fgMPVariable = new VariableMementoProvider();
+ private static IElementMementoProvider fgMPExpression = new ExpressionMementoProvider();
+ private static IElementMementoProvider fgMPRegisterGroup = new RegisterGroupMementoProvider();
+ private static IElementMementoProvider fgMPExpressionManager = new ExpressionManagerMementoProvider();
+ private static IElementMementoProvider fgMPMemory = new MemoryViewElementMementoProvider();
+ private static IElementMementoProvider fgMPBreakpointManagerInput = new BreakpointManagerInputMementoProvider();
+ private static IElementMementoProvider fgMPBreakpointContainer = new BreakpointContainerMementoProvider();
+ private static IElementMementoProvider fgMPBreakpoint = new BreakpointMementoProvider();
- private static IColumnPresentationFactory fgVariableColumnFactory = new VariableColumnFactoryAdapter();
+ private static IColumnPresentationFactory fgVariableColumnFactory = new VariableColumnFactoryAdapter();
- private static IViewerInputProvider fgDefaultViewerInputProvider = new DefaultViewerInputProvider();
- private static IViewerInputProvider fgStackFrameViewerInputProvider = new StackFrameViewerInputProvider();
+ private static IViewerInputProvider fgDefaultViewerInputProvider = new DefaultViewerInputProvider();
+ private static IViewerInputProvider fgStackFrameViewerInputProvider = new StackFrameViewerInputProvider();
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (adapterType.isInstance(adaptableObject)) {
+ if (adapterType.isInstance(adaptableObject)) {
return (T) adaptableObject;
}
- if (adapterType.equals(IAsynchronousContentAdapter.class)) {
- if (adaptableObject instanceof IMemoryBlockRetrieval) {
+ if (adapterType.equals(IAsynchronousContentAdapter.class)) {
+ if (adaptableObject instanceof IMemoryBlockRetrieval) {
return (T) fgAsyncMemoryRetrieval;
- }
- if (adaptableObject instanceof IMemoryBlock) {
+ }
+ if (adaptableObject instanceof IMemoryBlock) {
return (T) fgAsyncMemoryBlock;
- }
- }
+ }
+ }
- if (adapterType.equals(IElementContentProvider.class)) {
- if (adaptableObject instanceof ILaunchManager) {
+ if (adapterType.equals(IElementContentProvider.class)) {
+ if (adaptableObject instanceof ILaunchManager) {
return (T) fgCPLaunchManger;
- }
- if (adaptableObject instanceof ILaunch) {
+ }
+ if (adaptableObject instanceof ILaunch) {
return (T) fgCPLaunch;
- }
- if (adaptableObject instanceof IProcess) {
+ }
+ if (adaptableObject instanceof IProcess) {
return (T) fgCPProcess;
- }
- if (adaptableObject instanceof IDebugTarget) {
+ }
+ if (adaptableObject instanceof IDebugTarget) {
return (T) fgCPTarget;
- }
- if (adaptableObject instanceof IMemoryBlockRetrieval)
- {
+ }
+ if (adaptableObject instanceof IMemoryBlockRetrieval)
+ {
return (T) fgCPMemoryRetrieval;
- }
- if (adaptableObject instanceof IThread) {
+ }
+ if (adaptableObject instanceof IThread) {
return (T) fgCPThread;
- }
- if (adaptableObject instanceof IStackFrame) {
+ }
+ if (adaptableObject instanceof IStackFrame) {
return (T) fgCPFrame;
- }
- if (adaptableObject instanceof IVariable) {
+ }
+ if (adaptableObject instanceof IVariable) {
return (T) fgCPVariable;
- }
- if (adaptableObject instanceof IExpressionManager) {
+ }
+ if (adaptableObject instanceof IExpressionManager) {
return (T) fgCPExpressionManager;
- }
- if (adaptableObject instanceof IExpression) {
+ }
+ if (adaptableObject instanceof IExpression) {
return (T) fgCPExpression;
- }
- if (adaptableObject instanceof IRegisterGroup) {
+ }
+ if (adaptableObject instanceof IRegisterGroup) {
return (T) fgCPRegisterGroup;
- }
- if (adaptableObject instanceof IMemoryBlock) {
+ }
+ if (adaptableObject instanceof IMemoryBlock) {
return (T) fgCPMemoryBlock;
- }
- if (adaptableObject instanceof DefaultBreakpointsViewInput) {
+ }
+ if (adaptableObject instanceof DefaultBreakpointsViewInput) {
return (T) fgCPBreakpointManager;
- }
- if (adaptableObject instanceof IBreakpoint) {
+ }
+ if (adaptableObject instanceof IBreakpoint) {
return (T) fgCPBreakpoint;
- }
- }
+ }
+ }
- if (adapterType.equals(IAsynchronousLabelAdapter.class)) {
- if (adaptableObject instanceof IMemoryBlock) {
+ if (adapterType.equals(IAsynchronousLabelAdapter.class)) {
+ if (adaptableObject instanceof IMemoryBlock) {
return (T) fgMemoryBlockLabelAdapter;
- }
+ }
- if (adaptableObject instanceof MemorySegment) {
+ if (adaptableObject instanceof MemorySegment) {
return (T) fgTableRenderingLineLabelAdapter;
- }
+ }
return (T) fgDebugLabelAdapter;
- }
+ }
- if (adapterType.equals(IElementLabelProvider.class)) {
- if (adaptableObject instanceof IVariable) {
+ if (adapterType.equals(IElementLabelProvider.class)) {
+ if (adaptableObject instanceof IVariable) {
return (T) fgLPVariable;
- }
- if (adaptableObject instanceof IExpression) {
+ }
+ if (adaptableObject instanceof IExpression) {
return (T) fgLPExpression;
- }
- if (adaptableObject instanceof IRegisterGroup) {
+ }
+ if (adaptableObject instanceof IRegisterGroup) {
return (T) fgLPRegisterGroup;
- }
- if (adaptableObject instanceof IMemoryBlock) {
+ }
+ if (adaptableObject instanceof IMemoryBlock) {
return (T) fgLPMemoryBlock;
- }
- if (adaptableObject instanceof IBreakpoint) {
+ }
+ if (adaptableObject instanceof IBreakpoint) {
return (T) fgLPBreakpoint;
- }
- if (adaptableObject instanceof IBreakpointContainer) {
+ }
+ if (adaptableObject instanceof IBreakpointContainer) {
return (T) fgLPBreakpointContainer;
- }
+ }
return (T) fgLPDebugElement;
- }
+ }
- if (adapterType.equals(IModelProxyFactory.class)) {
- if (adaptableObject instanceof ILaunch || adaptableObject instanceof IDebugTarget ||
- adaptableObject instanceof IProcess || adaptableObject instanceof ILaunchManager ||
- adaptableObject instanceof IStackFrame || adaptableObject instanceof IExpressionManager ||
- adaptableObject instanceof IExpression || adaptableObject instanceof IMemoryBlockRetrieval ||
- adaptableObject instanceof IMemoryBlock ||
- adaptableObject instanceof DefaultBreakpointsViewInput ||
- adaptableObject instanceof IBreakpoint ||
- adaptableObject instanceof IBreakpointContainer) {
+ if (adapterType.equals(IModelProxyFactory.class)) {
+ if (adaptableObject instanceof ILaunch || adaptableObject instanceof IDebugTarget ||
+ adaptableObject instanceof IProcess || adaptableObject instanceof ILaunchManager ||
+ adaptableObject instanceof IStackFrame || adaptableObject instanceof IExpressionManager ||
+ adaptableObject instanceof IExpression || adaptableObject instanceof IMemoryBlockRetrieval ||
+ adaptableObject instanceof IMemoryBlock ||
+ adaptableObject instanceof DefaultBreakpointsViewInput ||
+ adaptableObject instanceof IBreakpoint ||
+ adaptableObject instanceof IBreakpointContainer) {
return (T) fgModelProxyFactoryAdapter;
}
- }
+ }
- if (adapterType.equals(ISourceDisplay.class)) {
- if (adaptableObject instanceof IStackFrame) {
+ if (adapterType.equals(ISourceDisplay.class)) {
+ if (adaptableObject instanceof IStackFrame) {
return (T) fgStackFrameSourceDisplayAdapter;
- }
- }
+ }
+ }
- if (adapterType.equals(IModelSelectionPolicyFactory.class)) {
- if (adaptableObject instanceof IDebugElement) {
+ if (adapterType.equals(IModelSelectionPolicyFactory.class)) {
+ if (adaptableObject instanceof IDebugElement) {
return (T) fgModelSelectionPolicyFactoryAdapter;
- }
- }
+ }
+ }
- if (adapterType.equals(IColumnPresentationFactory.class)) {
- if (adaptableObject instanceof IStackFrame || adaptableObject instanceof IExpressionManager) {
+ if (adapterType.equals(IColumnPresentationFactory.class)) {
+ if (adaptableObject instanceof IStackFrame || adaptableObject instanceof IExpressionManager) {
return (T) fgVariableColumnFactory;
- }
- }
+ }
+ }
- if (adapterType.equals(IElementMementoProvider.class)) {
- if (adaptableObject instanceof IStackFrame) {
+ if (adapterType.equals(IElementMementoProvider.class)) {
+ if (adaptableObject instanceof IStackFrame) {
return (T) fgMPFrame;
- }
- if (adaptableObject instanceof IVariable) {
+ }
+ if (adaptableObject instanceof IVariable) {
return (T) fgMPVariable;
- }
- if (adaptableObject instanceof IRegisterGroup) {
+ }
+ if (adaptableObject instanceof IRegisterGroup) {
return (T) fgMPRegisterGroup;
- }
- if (adaptableObject instanceof IExpression) {
+ }
+ if (adaptableObject instanceof IExpression) {
return (T) fgMPExpression;
- }
- if (adaptableObject instanceof IExpressionManager) {
+ }
+ if (adaptableObject instanceof IExpressionManager) {
return (T) fgMPExpressionManager;
- }
- if (adaptableObject instanceof IMemoryBlockRetrieval) {
+ }
+ if (adaptableObject instanceof IMemoryBlockRetrieval) {
return (T) fgMPMemory;
- }
- if (adaptableObject instanceof IBreakpoint) {
+ }
+ if (adaptableObject instanceof IBreakpoint) {
return (T) fgMPBreakpoint;
- }
- if (adaptableObject instanceof IBreakpointContainer) {
+ }
+ if (adaptableObject instanceof IBreakpointContainer) {
return (T) fgMPBreakpointContainer;
- }
- if (adaptableObject instanceof DefaultBreakpointsViewInput) {
+ }
+ if (adaptableObject instanceof DefaultBreakpointsViewInput) {
return (T) fgMPBreakpointManagerInput;
- }
- }
+ }
+ }
- if (adapterType.equals(IElementEditor.class)) {
- if (adaptableObject instanceof IVariable) {
+ if (adapterType.equals(IElementEditor.class)) {
+ if (adaptableObject instanceof IVariable) {
return (T) fgEEVariable;
- }
- if (adaptableObject instanceof IWatchExpression) {
+ }
+ if (adaptableObject instanceof IWatchExpression) {
return (T) fgEEWatchExpression;
- }
- }
+ }
+ }
- if (adapterType.equals(IViewerInputProvider.class)) {
- if (adaptableObject instanceof IStackFrame) {
+ if (adapterType.equals(IViewerInputProvider.class)) {
+ if (adaptableObject instanceof IStackFrame) {
return (T) fgStackFrameViewerInputProvider;
- } else {
+ } else {
return (T) fgDefaultViewerInputProvider;
- }
- }
+ }
+ }
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public Class<?>[] getAdapterList() {
- return new Class[] {
- IAsynchronousLabelAdapter.class,
- IAsynchronousContentAdapter.class,
- IModelProxyFactory.class,
- ISourceDisplay.class,
- IModelSelectionPolicyFactory.class,
- IColumnPresentationFactory.class,
- IElementContentProvider.class,
- IElementLabelProvider.class,
- IElementMementoProvider.class,
- IElementEditor.class,
- IViewerInputProvider.class};
- }
+ return new Class[] {
+ IAsynchronousLabelAdapter.class,
+ IAsynchronousContentAdapter.class,
+ IModelProxyFactory.class,
+ ISourceDisplay.class,
+ IModelSelectionPolicyFactory.class,
+ IColumnPresentationFactory.class,
+ IElementContentProvider.class,
+ IElementLabelProvider.class,
+ IElementMementoProvider.class,
+ IElementEditor.class,
+ IViewerInputProvider.class};
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java
index 9dcb0f44c..dd2b56008 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugToolBarAction.java
@@ -36,14 +36,14 @@ class DebugToolBarAction extends Action {
super(IInternalDebugCoreConstants.EMPTY_STRING, AS_CHECK_BOX);
fLaunchView = view;
- setText(LaunchViewMessages.DebugToolBarAction_View_label);
- setToolTipText(LaunchViewMessages.DebugToolBarAction_View_tooltip);
- setDescription(LaunchViewMessages.DebugToolBarAction_View_description);
+ setText(LaunchViewMessages.DebugToolBarAction_View_label);
+ setToolTipText(LaunchViewMessages.DebugToolBarAction_View_tooltip);
+ setDescription(LaunchViewMessages.DebugToolBarAction_View_description);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_TOOLBAR_VIEW_ACTION);
}
public void setShowingDebugToolbar(boolean showingToolbar) {
- setChecked(showingToolbar);
+ setChecked(showingToolbar);
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java
index 90a129906..bf93dfeb6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java
@@ -41,7 +41,7 @@ class DebugViewModeAction extends Action {
* @param view Reference to the debug view.
* @param mode The mode to be set by this action.
* @param parent The view's parent control used to calculate view size
- * in auto mode.
+ * in auto mode.
*/
public DebugViewModeAction(LaunchView view, String mode, Composite parent) {
super(IInternalDebugCoreConstants.EMPTY_STRING, AS_RADIO_BUTTON);
@@ -83,7 +83,7 @@ class DebugViewModeAction extends Action {
* @return the mode of the action
*/
public String getMode() {
- return fMode;
+ return fMode;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
index e287c7474..c1db62b27 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
@@ -141,43 +141,43 @@ import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.texteditor.IUpdate;
public class LaunchView extends AbstractDebugView
- implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IShowInTarget, IShowInSource,
- IShowInTargetList, IPartListener2, IViewerUpdateListener, IContextManagerListener, IModelChangedListener
+ implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IShowInTarget, IShowInSource,
+ IShowInTargetList, IPartListener2, IViewerUpdateListener, IContextManagerListener, IModelChangedListener
{
public static final String ID_CONTEXT_ACTIVITY_BINDINGS = "contextActivityBindings"; //$NON-NLS-1$
- private static final String TERMINATE = "terminate"; //$NON-NLS-1$
+ private static final String TERMINATE = "terminate"; //$NON-NLS-1$
- private static final String DISCONNECT = "disconnect"; //$NON-NLS-1$
+ private static final String DISCONNECT = "disconnect"; //$NON-NLS-1$
- private static final String SUSPEND = "suspend"; //$NON-NLS-1$
+ private static final String SUSPEND = "suspend"; //$NON-NLS-1$
- private static final String RESUME = "resume"; //$NON-NLS-1$
+ private static final String RESUME = "resume"; //$NON-NLS-1$
- private static final String STEP_RETURN = "step_return"; //$NON-NLS-1$
+ private static final String STEP_RETURN = "step_return"; //$NON-NLS-1$
- private static final String STEP_OVER = "step_over"; //$NON-NLS-1$
+ private static final String STEP_OVER = "step_over"; //$NON-NLS-1$
- private static final String DROP_TO_FRAME = "drop_to_frame"; //$NON-NLS-1$
+ private static final String DROP_TO_FRAME = "drop_to_frame"; //$NON-NLS-1$
- private static final String STEP_INTO = "step_into"; //$NON-NLS-1$
+ private static final String STEP_INTO = "step_into"; //$NON-NLS-1$
- public static final String TERMINATE_AND_REMOVE = "terminate_and_remove"; //$NON-NLS-1$
+ public static final String TERMINATE_AND_REMOVE = "terminate_and_remove"; //$NON-NLS-1$
- private static final String TERMINATE_ALL = "terminate_all"; //$NON-NLS-1$
+ private static final String TERMINATE_ALL = "terminate_all"; //$NON-NLS-1$
- public static final String TERMINATE_AND_RELAUNCH = "terminate_relaunch"; //$NON-NLS-1$
+ public static final String TERMINATE_AND_RELAUNCH = "terminate_relaunch"; //$NON-NLS-1$
- private static final String TOGGLE_STEP_FILTERS = "toggle_step_filters"; //$NON-NLS-1$
+ private static final String TOGGLE_STEP_FILTERS = "toggle_step_filters"; //$NON-NLS-1$
- private static final String RESTART = "restart"; //$NON-NLS-1$
+ private static final String RESTART = "restart"; //$NON-NLS-1$
- private static final int BREADCRUMB_TRIGGER_HEIGHT_DEFAULT = 30; // pixels
+ private static final int BREADCRUMB_TRIGGER_HEIGHT_DEFAULT = 30; // pixels
- private static final int BREADCRUMB_TRIGGER_RANGE = 5; // pixels
+ private static final int BREADCRUMB_TRIGGER_RANGE = 5; // pixels
- private static final int BREADCRUMB_STICKY_RANGE = 20; // pixels
+ private static final int BREADCRUMB_STICKY_RANGE = 20; // pixels
/**
* Whether this view is in the active page of a perspective.
@@ -201,114 +201,114 @@ public class LaunchView extends AbstractDebugView
*
* @since 3.5
*/
- private String fCurrentViewMode = IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO;
-
- /**
- * Actions for selecting the view mode (auto vs. breadcrumb, vs. tree view).
- *
- * @since 3.5
- */
- private DebugViewModeAction[] fDebugViewModeActions;
-
- /**
- * Action which shows or hides the Debug view toolbar.
- */
- private DebugToolBarAction fDebugToolBarAction;
-
- /**
- * Action that controls the breadcrumb drop-down auto-expand behavior.
- *
- * @since 3.5
- */
- private BreadcrumbDropDownAutoExpandAction fBreadcrumbDropDownAutoExpandAction;
-
- /**
- * Context service for this view. Used to track whether debug toolbar
- * action set is active.
- *
- * @since 3.8
- */
- private IContextService fContextService;
-
- /**
- * Preference name for the view's memento.
- *
- * @since 3.5
- */
- private String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
-
- /**
- * Key for a view preference for whether the elements in breadcrumb's
- * drop-down viewer should be automatically expanded.
- *
- * @since 3.5
- */
- private static final String BREADCRUMB_DROPDOWN_AUTO_EXPAND = DebugUIPlugin.getUniqueIdentifier() + ".BREADCRUMB_DROPDOWN_AUTO_EXPAND"; //$NON-NLS-1$
-
- /**
- * Preference for whether the elements in breadcrumb's
- * drop-down viewer should be automatically expanded.
- *
- * @since 3.5
- */
+ private String fCurrentViewMode = IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO;
+
+ /**
+ * Actions for selecting the view mode (auto vs. breadcrumb, vs. tree view).
+ *
+ * @since 3.5
+ */
+ private DebugViewModeAction[] fDebugViewModeActions;
+
+ /**
+ * Action which shows or hides the Debug view toolbar.
+ */
+ private DebugToolBarAction fDebugToolBarAction;
+
+ /**
+ * Action that controls the breadcrumb drop-down auto-expand behavior.
+ *
+ * @since 3.5
+ */
+ private BreadcrumbDropDownAutoExpandAction fBreadcrumbDropDownAutoExpandAction;
+
+ /**
+ * Context service for this view. Used to track whether debug toolbar
+ * action set is active.
+ *
+ * @since 3.8
+ */
+ private IContextService fContextService;
+
+ /**
+ * Preference name for the view's memento.
+ *
+ * @since 3.5
+ */
+ private String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
+
+ /**
+ * Key for a view preference for whether the elements in breadcrumb's
+ * drop-down viewer should be automatically expanded.
+ *
+ * @since 3.5
+ */
+ private static final String BREADCRUMB_DROPDOWN_AUTO_EXPAND = DebugUIPlugin.getUniqueIdentifier() + ".BREADCRUMB_DROPDOWN_AUTO_EXPAND"; //$NON-NLS-1$
+
+ /**
+ * Preference for whether the elements in breadcrumb's
+ * drop-down viewer should be automatically expanded.
+ *
+ * @since 3.5
+ */
private boolean fBreadcrumbDropDownAutoExpand;
- /**
- * Action handlers. Maps action identifiers to IHandler's.
- *
- * @since 3.6
- */
+ /**
+ * Action handlers. Maps action identifiers to IHandler's.
+ *
+ * @since 3.6
+ */
private Map<String, IHandler2> fHandlers = new HashMap<>();
- private boolean fDebugToolbarInView = true;
+ private boolean fDebugToolbarInView = true;
private Set<String> fDebugToolbarPerspectives = new TreeSet<>();
/**
* Page-book page for the breadcrumb viewer. This page is activated in
* Debug view when the height of the view is reduced to just one line.
- *
- * @since 3.5
+ *
+ * @since 3.5
*/
private class BreadcrumbPage extends Page {
- LaunchViewBreadcrumb fCrumb;
- Control fControl;
+ LaunchViewBreadcrumb fCrumb;
+ Control fControl;
- @Override
+ @Override
public void createControl(Composite parent) {
- fCrumb = new LaunchViewBreadcrumb(LaunchView.this, (TreeModelViewer)getViewer(), fTreeViewerDebugContextProvider);
- fControl = fCrumb.createContent(parent);
- }
+ fCrumb = new LaunchViewBreadcrumb(LaunchView.this, (TreeModelViewer)getViewer(), fTreeViewerDebugContextProvider);
+ fControl = fCrumb.createContent(parent);
+ }
- @Override
+ @Override
public void init(IPageSite pageSite) {
- super.init(pageSite);
- pageSite.setSelectionProvider(fCrumb.getSelectionProvider());
- }
+ super.init(pageSite);
+ pageSite.setSelectionProvider(fCrumb.getSelectionProvider());
+ }
- @Override
+ @Override
public Control getControl() {
- return fControl;
- }
+ return fControl;
+ }
- @Override
+ @Override
public void setFocus() {
- fCrumb.activate();
- }
+ fCrumb.activate();
+ }
- IDebugContextProvider getContextProvider() {
- return fCrumb.getContextProvider();
- }
+ IDebugContextProvider getContextProvider() {
+ return fCrumb.getContextProvider();
+ }
- int getHeight() {
- return fCrumb.getHeight();
- }
+ int getHeight() {
+ return fCrumb.getHeight();
+ }
- @Override
+ @Override
public void dispose() {
- fCrumb.dispose();
- }
+ fCrumb.dispose();
+ }
}
private BreadcrumbPage fBreadcrumbPage;
@@ -380,20 +380,20 @@ public class LaunchView extends AbstractDebugView
fire(new DebugContextEvent(this, selection, DebugContextEvent.ACTIVATED));
}
- protected void possibleChange(TreePath element, int type) {
- DebugContextEvent event = null;
- synchronized (this) {
- if (fContext instanceof ITreeSelection) {
- ITreeSelection ss = (ITreeSelection) fContext;
- TreePath[] ssPaths = ss.getPaths();
- for (int i = 0; i < ssPaths.length; i++) {
- if (ssPaths[i].startsWith(element, null)) {
- if (ssPaths[i].getSegmentCount() == element.getSegmentCount()) {
- event = new DebugContextEvent(this, fContext, type);
- } else {
- // if parent of the currently selected element
- // changes, issue event to update STATE only
- event = new DebugContextEvent(this, fContext, DebugContextEvent.STATE);
+ protected void possibleChange(TreePath element, int type) {
+ DebugContextEvent event = null;
+ synchronized (this) {
+ if (fContext instanceof ITreeSelection) {
+ ITreeSelection ss = (ITreeSelection) fContext;
+ TreePath[] ssPaths = ss.getPaths();
+ for (int i = 0; i < ssPaths.length; i++) {
+ if (ssPaths[i].startsWith(element, null)) {
+ if (ssPaths[i].getSegmentCount() == element.getSegmentCount()) {
+ event = new DebugContextEvent(this, fContext, type);
+ } else {
+ // if parent of the currently selected element
+ // changes, issue event to update STATE only
+ event = new DebugContextEvent(this, fContext, DebugContextEvent.STATE);
}
}
}
@@ -472,59 +472,59 @@ public class LaunchView extends AbstractDebugView
private PageRec fDefaultPageRec = null;
private ISelectionChangedListener fTreeViewerSelectionChangedListener = new ISelectionChangedListener() {
- @Override
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
fTreeViewerDebugContextProvider.activate(event.getSelection());
- }
+ }
};
private class ContextProviderProxy extends AbstractDebugContextProvider implements IDebugContextListener {
- private IDebugContextProvider fActiveProvider;
- private IDebugContextProvider[] fProviders;
-
- ContextProviderProxy(IDebugContextProvider[] providers) {
- super(LaunchView.this);
- fProviders = providers;
- fActiveProvider = providers[0];
- for (int i = 0; i < fProviders.length; i++) {
- fProviders[i].addDebugContextListener(this);
- }
- }
-
- void setActiveProvider(IDebugContextProvider provider) {
- if (!provider.equals(fActiveProvider)) {
- ISelection activeContext = getActiveContext();
- fActiveProvider = provider;
- ISelection newActiveContext = getActiveContext();
- if (!activeContext.equals(newActiveContext)) {
- fire(new DebugContextEvent(this, getActiveContext(), DebugContextEvent.ACTIVATED));
- }
- }
- }
-
- @Override
+ private IDebugContextProvider fActiveProvider;
+ private IDebugContextProvider[] fProviders;
+
+ ContextProviderProxy(IDebugContextProvider[] providers) {
+ super(LaunchView.this);
+ fProviders = providers;
+ fActiveProvider = providers[0];
+ for (int i = 0; i < fProviders.length; i++) {
+ fProviders[i].addDebugContextListener(this);
+ }
+ }
+
+ void setActiveProvider(IDebugContextProvider provider) {
+ if (!provider.equals(fActiveProvider)) {
+ ISelection activeContext = getActiveContext();
+ fActiveProvider = provider;
+ ISelection newActiveContext = getActiveContext();
+ if (!activeContext.equals(newActiveContext)) {
+ fire(new DebugContextEvent(this, getActiveContext(), DebugContextEvent.ACTIVATED));
+ }
+ }
+ }
+
+ @Override
public ISelection getActiveContext() {
- ISelection activeContext = fActiveProvider.getActiveContext();
- if (activeContext != null) {
- return activeContext;
- }
- return TreeSelection.EMPTY;
- }
-
- @Override
+ ISelection activeContext = fActiveProvider.getActiveContext();
+ if (activeContext != null) {
+ return activeContext;
+ }
+ return TreeSelection.EMPTY;
+ }
+
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- if (event.getSource().equals(fActiveProvider)) {
- fire(new DebugContextEvent(this, event.getContext(), event.getFlags()));
- }
- }
+ if (event.getSource().equals(fActiveProvider)) {
+ fire(new DebugContextEvent(this, event.getContext(), event.getFlags()));
+ }
+ }
- void dispose() {
- for (int i = 0; i < fProviders.length; i++) {
- fProviders[i].removeDebugContextListener(this);
- }
- fProviders = null;
- fActiveProvider = null;
- }
+ void dispose() {
+ for (int i = 0; i < fProviders.length; i++) {
+ fProviders[i].removeDebugContextListener(this);
+ }
+ fProviders = null;
+ fActiveProvider = null;
+ }
}
private ContextProviderProxy fContextProviderProxy;
@@ -543,23 +543,23 @@ public class LaunchView extends AbstractDebugView
fLookupAction = new LookupSourceAction(this);
setAction(FIND_ACTION, new VirtualFindAction((TreeModelViewer) getViewer()));
- addCapabilityAction(new TerminateCommandAction(), TERMINATE);
- addCapabilityAction(new DisconnectCommandAction(), DISCONNECT);
- addCapabilityAction(new SuspendCommandAction(), SUSPEND);
- addCapabilityAction(new ResumeCommandAction(), RESUME);
- addCapabilityAction(new StepReturnCommandAction(), STEP_RETURN);
- addCapabilityAction(new StepOverCommandAction(), STEP_OVER);
- addCapabilityAction(new StepIntoCommandAction(), STEP_INTO);
- addCapabilityAction(new DropToFrameCommandAction(), DROP_TO_FRAME);
- DebugCommandAction action = new TerminateAndRemoveAction();
- addCapabilityAction(action, TERMINATE_AND_REMOVE);
- setHandler(TERMINATE_AND_REMOVE, new ActionHandler(action));
- action = new TerminateAndRelaunchAction();
- addCapabilityAction(action, TERMINATE_AND_RELAUNCH);
- setHandler(TERMINATE_AND_RELAUNCH, new ActionHandler(action));
- addCapabilityAction(new RestartCommandAction(), RESTART);
- addCapabilityAction(new TerminateAllAction(), TERMINATE_ALL);
- addCapabilityAction(new ToggleStepFiltersAction(), TOGGLE_STEP_FILTERS);
+ addCapabilityAction(new TerminateCommandAction(), TERMINATE);
+ addCapabilityAction(new DisconnectCommandAction(), DISCONNECT);
+ addCapabilityAction(new SuspendCommandAction(), SUSPEND);
+ addCapabilityAction(new ResumeCommandAction(), RESUME);
+ addCapabilityAction(new StepReturnCommandAction(), STEP_RETURN);
+ addCapabilityAction(new StepOverCommandAction(), STEP_OVER);
+ addCapabilityAction(new StepIntoCommandAction(), STEP_INTO);
+ addCapabilityAction(new DropToFrameCommandAction(), DROP_TO_FRAME);
+ DebugCommandAction action = new TerminateAndRemoveAction();
+ addCapabilityAction(action, TERMINATE_AND_REMOVE);
+ setHandler(TERMINATE_AND_REMOVE, new ActionHandler(action));
+ action = new TerminateAndRelaunchAction();
+ addCapabilityAction(action, TERMINATE_AND_RELAUNCH);
+ setHandler(TERMINATE_AND_RELAUNCH, new ActionHandler(action));
+ addCapabilityAction(new RestartCommandAction(), RESTART);
+ addCapabilityAction(new TerminateAllAction(), TERMINATE_ALL);
+ addCapabilityAction(new ToggleStepFiltersAction(), TOGGLE_STEP_FILTERS);
}
/**
@@ -604,62 +604,62 @@ public class LaunchView extends AbstractDebugView
}
/**
- * Override the default implementation to create the breadcrumb page.
+ * Override the default implementation to create the breadcrumb page.
*
* @since 3.5
* @see #fDefaultPageRec
*/
@Override
public void createPartControl(final Composite parent) {
- super.createPartControl(parent);
-
- // Copy the global action handlers to the default page.
- setGlobalActionBarsToPage((IPageBookViewPage)getDefaultPage());
-
- // Add view as a selection listener to the site.
- getSite().getSelectionProvider().addSelectionChangedListener(this);
-
- // Set the tree viewer as the selection provider to the default page.
- // The page book view handles switching the between page selection
- // providers as needed.
- ((IPageBookViewPage)getDefaultPage()).getSite().setSelectionProvider(getViewer());
-
- // Call the PageBookView part listener to indirectly create the breadcrumb page.
- // This call eventually calls doCreatePage() implemented below.
- partActivated(new BreadcrumbWorkbenchPart(getSite()));
-
- fContextProviderProxy = new ContextProviderProxy(
- new IDebugContextProvider[] {fTreeViewerDebugContextProvider, fBreadcrumbPage.getContextProvider()});
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextProvider(fContextProviderProxy);
-
- // Create and configure actions for selecting view mode.
- createViewModeActions(parent);
- IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore();
- String mode = prefStore.getString(IDebugPreferenceConstants.DEBUG_VIEW_MODE);
- setViewMode(mode, parent);
- for (int i = 0; i < fDebugViewModeActions.length; i++) {
- fDebugViewModeActions[i].setChecked(fDebugViewModeActions[i].getMode().equals(mode));
- }
+ super.createPartControl(parent);
+
+ // Copy the global action handlers to the default page.
+ setGlobalActionBarsToPage((IPageBookViewPage)getDefaultPage());
+
+ // Add view as a selection listener to the site.
+ getSite().getSelectionProvider().addSelectionChangedListener(this);
+
+ // Set the tree viewer as the selection provider to the default page.
+ // The page book view handles switching the between page selection
+ // providers as needed.
+ ((IPageBookViewPage)getDefaultPage()).getSite().setSelectionProvider(getViewer());
+
+ // Call the PageBookView part listener to indirectly create the breadcrumb page.
+ // This call eventually calls doCreatePage() implemented below.
+ partActivated(new BreadcrumbWorkbenchPart(getSite()));
+
+ fContextProviderProxy = new ContextProviderProxy(
+ new IDebugContextProvider[] {fTreeViewerDebugContextProvider, fBreadcrumbPage.getContextProvider()});
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextProvider(fContextProviderProxy);
+
+ // Create and configure actions for selecting view mode.
+ createViewModeActions(parent);
+ IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore();
+ String mode = prefStore.getString(IDebugPreferenceConstants.DEBUG_VIEW_MODE);
+ setViewMode(mode, parent);
+ for (int i = 0; i < fDebugViewModeActions.length; i++) {
+ fDebugViewModeActions[i].setChecked(fDebugViewModeActions[i].getMode().equals(mode));
+ }
- createDebugToolBarInViewActions(parent);
+ createDebugToolBarInViewActions(parent);
- // Add a resize listener for the view to activate breadcrumb as needed.
- parent.addControlListener(new ControlListener() {
- @Override
+ // Add a resize listener for the view to activate breadcrumb as needed.
+ parent.addControlListener(new ControlListener() {
+ @Override
public void controlMoved(ControlEvent e) {
- }
- @Override
+ }
+ @Override
public void controlResized(ControlEvent e) {
- if (parent.isDisposed()) {
- return;
- }
- if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO.equals(fCurrentViewMode)) {
- autoSelectViewPage(parent);
- }
- }
- });
+ if (parent.isDisposed()) {
+ return;
+ }
+ if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO.equals(fCurrentViewMode)) {
+ autoSelectViewPage(parent);
+ }
+ }
+ });
- fContextService.addContextManagerListener(this);
+ fContextService.addContextManagerListener(this);
}
/**
@@ -673,201 +673,201 @@ public class LaunchView extends AbstractDebugView
* @since 3.5
*/
private void setGlobalActionBarsToPage(IPageBookViewPage page) {
- IActionBars pageActionBars = page.getSite().getActionBars();
- // Set the view site action bars created by createActions() to the
- // default page site.
- IActionBars bars = getViewSite().getActionBars();
- pageActionBars.setGlobalActionHandler(FIND_ACTION, bars.getGlobalActionHandler(FIND_ACTION));
- pageActionBars.setGlobalActionHandler(COPY_ACTION, bars.getGlobalActionHandler(COPY_ACTION));
- }
-
- /**
- * Override the default implementation to create the breadcrumb page.
- *
- * @since 3.5
- * @see #fDefaultPageRec
- */
+ IActionBars pageActionBars = page.getSite().getActionBars();
+ // Set the view site action bars created by createActions() to the
+ // default page site.
+ IActionBars bars = getViewSite().getActionBars();
+ pageActionBars.setGlobalActionHandler(FIND_ACTION, bars.getGlobalActionHandler(FIND_ACTION));
+ pageActionBars.setGlobalActionHandler(COPY_ACTION, bars.getGlobalActionHandler(COPY_ACTION));
+ }
+
+ /**
+ * Override the default implementation to create the breadcrumb page.
+ *
+ * @since 3.5
+ * @see #fDefaultPageRec
+ */
@Override
protected PageRec doCreatePage(IWorkbenchPart part) {
- if (part instanceof BreadcrumbWorkbenchPart) {
- fBreadcrumbPage = new BreadcrumbPage();
- fBreadcrumbPage.createControl(getPageBook());
- initPage(fBreadcrumbPage);
- setGlobalActionBarsToPage(fBreadcrumbPage);
- return new PageRec(part, fBreadcrumbPage);
- }
- return null;
- }
-
- /**
- * Override the default implementation to create the breadcrumb page.
- *
- * @since 3.5
- * @see #fDefaultPageRec
- */
+ if (part instanceof BreadcrumbWorkbenchPart) {
+ fBreadcrumbPage = new BreadcrumbPage();
+ fBreadcrumbPage.createControl(getPageBook());
+ initPage(fBreadcrumbPage);
+ setGlobalActionBarsToPage(fBreadcrumbPage);
+ return new PageRec(part, fBreadcrumbPage);
+ }
+ return null;
+ }
+
+ /**
+ * Override the default implementation to create the breadcrumb page.
+ *
+ * @since 3.5
+ * @see #fDefaultPageRec
+ */
@Override
protected boolean isImportant(IWorkbenchPart part) {
- return part instanceof BreadcrumbWorkbenchPart;
+ return part instanceof BreadcrumbWorkbenchPart;
}
- /**
- * Override the default implementation to gain access at the default
- * page record.
- *
- * @since 3.5
- * @see #fDefaultPageRec
- */
+ /**
+ * Override the default implementation to gain access at the default
+ * page record.
+ *
+ * @since 3.5
+ * @see #fDefaultPageRec
+ */
@Override
protected void showPageRec(PageRec pageRec) {
- if (pageRec.page == getDefaultPage()) {
- fDefaultPageRec = pageRec;
- }
+ if (pageRec.page == getDefaultPage()) {
+ fDefaultPageRec = pageRec;
+ }
- super.showPageRec(pageRec);
+ super.showPageRec(pageRec);
}
/**
* Creates actions for controlling view mode.
*
* @param parent The view's parent control used to calculate view size
- * in auto mode.
+ * in auto mode.
*/
- private void createViewModeActions(final Composite parent) {
- IActionBars actionBars = getViewSite().getActionBars();
- IMenuManager viewMenu = actionBars.getMenuManager();
-
- fDebugViewModeActions = new DebugViewModeAction[3];
- fDebugViewModeActions[0] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO, parent);
- fDebugViewModeActions[1] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL, parent);
- fDebugViewModeActions[2] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT, parent);
- fBreadcrumbDropDownAutoExpandAction = new BreadcrumbDropDownAutoExpandAction(this);
- viewMenu.add(new Separator());
-
- final MenuManager modeSubmenu = new MenuManager(LaunchViewMessages.LaunchView_ViewModeMenu_label);
- modeSubmenu.setRemoveAllWhenShown(true);
- modeSubmenu.add(fDebugViewModeActions[0]);
- modeSubmenu.add(fDebugViewModeActions[1]);
- modeSubmenu.add(fDebugViewModeActions[2]);
- modeSubmenu.add(new Separator());
- modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
- viewMenu.add(modeSubmenu);
-
- modeSubmenu.addMenuListener(new IMenuListener() {
- @Override
+ private void createViewModeActions(final Composite parent) {
+ IActionBars actionBars = getViewSite().getActionBars();
+ IMenuManager viewMenu = actionBars.getMenuManager();
+
+ fDebugViewModeActions = new DebugViewModeAction[3];
+ fDebugViewModeActions[0] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO, parent);
+ fDebugViewModeActions[1] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL, parent);
+ fDebugViewModeActions[2] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT, parent);
+ fBreadcrumbDropDownAutoExpandAction = new BreadcrumbDropDownAutoExpandAction(this);
+ viewMenu.add(new Separator());
+
+ final MenuManager modeSubmenu = new MenuManager(LaunchViewMessages.LaunchView_ViewModeMenu_label);
+ modeSubmenu.setRemoveAllWhenShown(true);
+ modeSubmenu.add(fDebugViewModeActions[0]);
+ modeSubmenu.add(fDebugViewModeActions[1]);
+ modeSubmenu.add(fDebugViewModeActions[2]);
+ modeSubmenu.add(new Separator());
+ modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
+ viewMenu.add(modeSubmenu);
+
+ modeSubmenu.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
- modeSubmenu.add(fDebugViewModeActions[0]);
- modeSubmenu.add(fDebugViewModeActions[1]);
- modeSubmenu.add(fDebugViewModeActions[2]);
- modeSubmenu.add(new Separator());
- modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
- }
- });
- }
-
- /**
- * Creates actions for controlling view mode.
- *
- * @param parent The view's parent control used to calculate view size
- * in auto mode.
- */
- private void createDebugToolBarInViewActions(final Composite parent) {
- IActionBars actionBars = getViewSite().getActionBars();
- IMenuManager viewMenu = actionBars.getMenuManager();
-
- fDebugToolBarAction = new DebugToolBarAction(this);
- viewMenu.add(fDebugToolBarAction);
- updateCheckedDebugToolBarAction();
- }
-
-
- /**
- * Sets the current view mode. If needed, the active view page is changed.
- *
- * @param mode New mode to set.
- * @param parent The view's parent control used to calculate view size
- * in auto mode.
- *
- * @since 3.5
- */
- void setViewMode(String mode, Composite parent) {
- if (fCurrentViewMode.equals(mode)) {
- return;
- }
-
- fCurrentViewMode = mode;
- if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT.equals(mode)) {
- showBreadcrumbPage();
- } else if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL.equals(mode)) {
- showTreeViewerPage();
- } else {
- autoSelectViewPage(parent);
- }
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_MODE, mode);
- }
-
- /**
- * Based on the current view size, select the active view page
- * (tree viewer vs. breadcrumb).
- *
- * @param parent View pane control.
- *
- * @since 3.5
- */
- private void autoSelectViewPage(Composite parent) {
- int breadcrumbHeight = fBreadcrumbPage.getHeight();
- // Breadcrumb may report size 0 if it hasn't been shown yet.
- // Bug 335536.
- if (breadcrumbHeight == 0) {
- breadcrumbHeight = BREADCRUMB_TRIGGER_HEIGHT_DEFAULT;
- }
- if (parent.getClientArea().height < breadcrumbHeight + BREADCRUMB_TRIGGER_RANGE) {
- showBreadcrumbPage();
- }
- else if (parent.getClientArea().height > breadcrumbHeight + BREADCRUMB_STICKY_RANGE)
- {
- showTreeViewerPage();
- }
- }
-
-
- /**
- * Shows the tree viewer in the Debug view.
- *
- * @since 3.5
- */
+ modeSubmenu.add(fDebugViewModeActions[0]);
+ modeSubmenu.add(fDebugViewModeActions[1]);
+ modeSubmenu.add(fDebugViewModeActions[2]);
+ modeSubmenu.add(new Separator());
+ modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
+ }
+ });
+ }
+
+ /**
+ * Creates actions for controlling view mode.
+ *
+ * @param parent The view's parent control used to calculate view size
+ * in auto mode.
+ */
+ private void createDebugToolBarInViewActions(final Composite parent) {
+ IActionBars actionBars = getViewSite().getActionBars();
+ IMenuManager viewMenu = actionBars.getMenuManager();
+
+ fDebugToolBarAction = new DebugToolBarAction(this);
+ viewMenu.add(fDebugToolBarAction);
+ updateCheckedDebugToolBarAction();
+ }
+
+
+ /**
+ * Sets the current view mode. If needed, the active view page is changed.
+ *
+ * @param mode New mode to set.
+ * @param parent The view's parent control used to calculate view size
+ * in auto mode.
+ *
+ * @since 3.5
+ */
+ void setViewMode(String mode, Composite parent) {
+ if (fCurrentViewMode.equals(mode)) {
+ return;
+ }
+
+ fCurrentViewMode = mode;
+ if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT.equals(mode)) {
+ showBreadcrumbPage();
+ } else if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL.equals(mode)) {
+ showTreeViewerPage();
+ } else {
+ autoSelectViewPage(parent);
+ }
+ DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_MODE, mode);
+ }
+
+ /**
+ * Based on the current view size, select the active view page
+ * (tree viewer vs. breadcrumb).
+ *
+ * @param parent View pane control.
+ *
+ * @since 3.5
+ */
+ private void autoSelectViewPage(Composite parent) {
+ int breadcrumbHeight = fBreadcrumbPage.getHeight();
+ // Breadcrumb may report size 0 if it hasn't been shown yet.
+ // Bug 335536.
+ if (breadcrumbHeight == 0) {
+ breadcrumbHeight = BREADCRUMB_TRIGGER_HEIGHT_DEFAULT;
+ }
+ if (parent.getClientArea().height < breadcrumbHeight + BREADCRUMB_TRIGGER_RANGE) {
+ showBreadcrumbPage();
+ }
+ else if (parent.getClientArea().height > breadcrumbHeight + BREADCRUMB_STICKY_RANGE)
+ {
+ showTreeViewerPage();
+ }
+ }
+
+
+ /**
+ * Shows the tree viewer in the Debug view.
+ *
+ * @since 3.5
+ */
void showTreeViewerPage() {
- if (fDefaultPageRec != null && !getDefaultPage().equals(getCurrentPage())) {
- showPageRec(fDefaultPageRec);
- fContextProviderProxy.setActiveProvider(fTreeViewerDebugContextProvider);
- // Clear the selection in the breadcrumb to avoid having it re-selected
- // when the breadcrumb is activated again (bug 268124).
- fBreadcrumbPage.fCrumb.clearSelection();
- }
+ if (fDefaultPageRec != null && !getDefaultPage().equals(getCurrentPage())) {
+ showPageRec(fDefaultPageRec);
+ fContextProviderProxy.setActiveProvider(fTreeViewerDebugContextProvider);
+ // Clear the selection in the breadcrumb to avoid having it re-selected
+ // when the breadcrumb is activated again (bug 268124).
+ fBreadcrumbPage.fCrumb.clearSelection();
+ }
}
/**
- * Shows the breadcrumb in the Debug view.
- *
- * @since 3.5
+ * Shows the breadcrumb in the Debug view.
+ *
+ * @since 3.5
*/
void showBreadcrumbPage() {
- PageRec rec = getPageRec(fBreadcrumbPage);
- if (rec != null && !fBreadcrumbPage.equals(getCurrentPage())) {
- showPageRec(rec);
- // Ask the breadcrumb to take focus if we're the active part.
- if (getSite().getPage().getActivePart() == this) {
- setFocus();
- }
- ISelection activeContext = fTreeViewerDebugContextProvider.getActiveContext();
+ PageRec rec = getPageRec(fBreadcrumbPage);
+ if (rec != null && !fBreadcrumbPage.equals(getCurrentPage())) {
+ showPageRec(rec);
+ // Ask the breadcrumb to take focus if we're the active part.
+ if (getSite().getPage().getActivePart() == this) {
+ setFocus();
+ }
+ ISelection activeContext = fTreeViewerDebugContextProvider.getActiveContext();
if (activeContext == null) {
activeContext = StructuredSelection.EMPTY;
}
fBreadcrumbPage.fCrumb.debugContextChanged(new DebugContextEvent(
- fTreeViewerDebugContextProvider,
- activeContext,
- DebugContextEvent.ACTIVATED));
- fContextProviderProxy.setActiveProvider(fBreadcrumbPage.getContextProvider());
- }
+ fTreeViewerDebugContextProvider,
+ activeContext,
+ DebugContextEvent.ACTIVATED));
+ fContextProviderProxy.setActiveProvider(fBreadcrumbPage.getContextProvider());
+ }
}
@Override
@@ -878,9 +878,9 @@ public class LaunchView extends AbstractDebugView
SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL,
fPresentationContext);
- viewer.addSelectionChangedListener(fTreeViewerSelectionChangedListener);
- viewer.addViewerUpdateListener(this);
- viewer.addModelChangedListener(this);
+ viewer.addSelectionChangedListener(fTreeViewerSelectionChangedListener);
+ viewer.addViewerUpdateListener(this);
+ viewer.addModelChangedListener(this);
viewer.setInput(DebugPlugin.getDefault().getLaunchManager());
//setEventHandler(new LaunchViewEventHandler(this));
@@ -896,33 +896,33 @@ public class LaunchView extends AbstractDebugView
}
private void preferenceInit(IViewSite site) {
- PREF_STATE_MEMENTO = PREF_STATE_MEMENTO + site.getId();
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- String string = store.getString(PREF_STATE_MEMENTO);
- if(string.length() > 0) {
+ PREF_STATE_MEMENTO = PREF_STATE_MEMENTO + site.getId();
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ String string = store.getString(PREF_STATE_MEMENTO);
+ if(string.length() > 0) {
try (ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes()); InputStreamReader reader = new InputStreamReader(bin)) {
- XMLMemento stateMemento = XMLMemento.createReadRoot(reader);
- setMemento(stateMemento);
- } catch (WorkbenchException e) {
+ XMLMemento stateMemento = XMLMemento.createReadRoot(reader);
+ setMemento(stateMemento);
+ } catch (WorkbenchException e) {
} catch (IOException e1) {
}
- }
- IMemento mem = getMemento();
+ }
+ IMemento mem = getMemento();
- if (mem != null) {
- Boolean auto = mem.getBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND);
- if(auto != null) {
- setBreadcrumbDropDownAutoExpand(auto.booleanValue());
- }
- }
+ if (mem != null) {
+ Boolean auto = mem.getBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND);
+ if(auto != null) {
+ setBreadcrumbDropDownAutoExpand(auto.booleanValue());
+ }
+ }
- String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString(
- IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES);
- if (preference != null) {
- fDebugToolbarPerspectives = ViewContextService.parseList(preference);
- }
- IPerspectiveDescriptor perspective = getSite().getPage().getPerspective();
- fDebugToolbarInView = isDebugToolbarShownInPerspective(perspective);
+ String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString(
+ IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES);
+ if (preference != null) {
+ fDebugToolbarPerspectives = ViewContextService.parseList(preference);
+ }
+ IPerspectiveDescriptor perspective = getSite().getPage().getPerspective();
+ fDebugToolbarInView = isDebugToolbarShownInPerspective(perspective);
}
@Override
@@ -937,42 +937,42 @@ public class LaunchView extends AbstractDebugView
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
commonInit(site);
- preferenceInit(site);
- fContextService = site.getService(IContextService.class);
+ preferenceInit(site);
+ fContextService = site.getService(IContextService.class);
}
- @Override
+ @Override
public void partDeactivated(IWorkbenchPart part) {
- String id = part.getSite().getId();
- if (id.equals(getSite().getId())) {
+ String id = part.getSite().getId();
+ if (id.equals(getSite().getId())) {
try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(bout);) {
- XMLMemento memento = XMLMemento.createWriteRoot("DebugViewMemento"); //$NON-NLS-1$
- saveViewerState(memento);
- memento.save(writer);
-
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- String xmlString = bout.toString();
- store.putValue(PREF_STATE_MEMENTO, xmlString);
- } catch (IOException e) {
- }
- }
-
- StringBuilder buffer= new StringBuilder();
+ XMLMemento memento = XMLMemento.createWriteRoot("DebugViewMemento"); //$NON-NLS-1$
+ saveViewerState(memento);
+ memento.save(writer);
+
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ String xmlString = bout.toString();
+ store.putValue(PREF_STATE_MEMENTO, xmlString);
+ } catch (IOException e) {
+ }
+ }
+
+ StringBuilder buffer= new StringBuilder();
for (Iterator<String> itr = fDebugToolbarPerspectives.iterator(); itr.hasNext();) {
- buffer.append(itr.next()).append(',');
- }
- getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES, buffer.toString());
+ buffer.append(itr.next()).append(',');
+ }
+ getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES, buffer.toString());
- super.partDeactivated(part);
- }
+ super.partDeactivated(part);
+ }
- /**
- * Saves the current state of the viewer
- * @param memento the memento to write the viewer state into
- */
- public void saveViewerState(IMemento memento) {
- memento.putBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND, getBreadcrumbDropDownAutoExpand());
- }
+ /**
+ * Saves the current state of the viewer
+ * @param memento the memento to write the viewer state into
+ */
+ public void saveViewerState(IMemento memento) {
+ memento.putBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND, getBreadcrumbDropDownAutoExpand());
+ }
@Override
protected void configureToolBar(IToolBarManager tbm) {
@@ -985,98 +985,98 @@ public class LaunchView extends AbstractDebugView
tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
if (fDebugToolbarInView) {
- addDebugToolbarActions(tbm);
+ addDebugToolbarActions(tbm);
}
}
- protected void addDebugToolbarActions(IToolBarManager tbm) {
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME));
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND));
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE));
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT));
-
- tbm.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO));
- tbm.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER));
- tbm.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN));
-
- tbm.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME));
-
- tbm.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS));
- }
-
- /**
- * Removes the toolbar actions contributed by this view from the toolbar
- * manager.
- * @param tbm
- */
- protected void removeDebugToolbarActions(IToolBarManager tbm) {
- tbm.remove(new ActionContributionItem(getAction(RESUME)));
- tbm.remove(new ActionContributionItem(getAction(SUSPEND)));
- tbm.remove(new ActionContributionItem(getAction(TERMINATE)));
- tbm.remove(new ActionContributionItem(getAction(DISCONNECT)));
-
- tbm.remove(new ActionContributionItem(getAction(STEP_INTO)));
- tbm.remove(new ActionContributionItem(getAction(STEP_OVER)));
- tbm.remove(new ActionContributionItem(getAction(STEP_RETURN)));
-
- tbm.remove(new ActionContributionItem(getAction(DROP_TO_FRAME)));
-
- tbm.remove(new ActionContributionItem(getAction(TOGGLE_STEP_FILTERS)));
- }
-
- public boolean isDebugToolbarInView() {
- return fDebugToolbarInView;
- }
-
- public boolean isDebugToolbarShownInPerspective(IPerspectiveDescriptor perspective) {
- return perspective == null || fDebugToolbarPerspectives.contains(perspective.getId());
- }
-
- public void setDebugToolbarInView(boolean show) {
- if (show == isDebugToolbarInView()) {
- return;
- }
- fDebugToolbarInView = show;
-
- // Update the perspectives set.
- IPerspectiveDescriptor perspective = getSite().getPage().getPerspective();
- if (perspective != null) {
- if (show) {
- fDebugToolbarPerspectives.add(perspective.getId());
- } else {
- fDebugToolbarPerspectives.remove(perspective.getId());
- }
- }
-
- // Update the toolbar manager.
- IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
- if (show) {
- addDebugToolbarActions(tbm);
- } else {
- removeDebugToolbarActions(tbm);
- }
- getViewSite().getActionBars().updateActionBars();
-
- // Update system property used by contributed actions.
- System.setProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE, Boolean.toString(show));
- }
+ protected void addDebugToolbarActions(IToolBarManager tbm) {
+ tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME));
+ tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND));
+ tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE));
+ tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT));
+
+ tbm.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO));
+ tbm.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER));
+ tbm.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN));
+
+ tbm.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME));
+
+ tbm.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS));
+ }
+
+ /**
+ * Removes the toolbar actions contributed by this view from the toolbar
+ * manager.
+ * @param tbm
+ */
+ protected void removeDebugToolbarActions(IToolBarManager tbm) {
+ tbm.remove(new ActionContributionItem(getAction(RESUME)));
+ tbm.remove(new ActionContributionItem(getAction(SUSPEND)));
+ tbm.remove(new ActionContributionItem(getAction(TERMINATE)));
+ tbm.remove(new ActionContributionItem(getAction(DISCONNECT)));
+
+ tbm.remove(new ActionContributionItem(getAction(STEP_INTO)));
+ tbm.remove(new ActionContributionItem(getAction(STEP_OVER)));
+ tbm.remove(new ActionContributionItem(getAction(STEP_RETURN)));
+
+ tbm.remove(new ActionContributionItem(getAction(DROP_TO_FRAME)));
+
+ tbm.remove(new ActionContributionItem(getAction(TOGGLE_STEP_FILTERS)));
+ }
+
+ public boolean isDebugToolbarInView() {
+ return fDebugToolbarInView;
+ }
+
+ public boolean isDebugToolbarShownInPerspective(IPerspectiveDescriptor perspective) {
+ return perspective == null || fDebugToolbarPerspectives.contains(perspective.getId());
+ }
+
+ public void setDebugToolbarInView(boolean show) {
+ if (show == isDebugToolbarInView()) {
+ return;
+ }
+ fDebugToolbarInView = show;
+
+ // Update the perspectives set.
+ IPerspectiveDescriptor perspective = getSite().getPage().getPerspective();
+ if (perspective != null) {
+ if (show) {
+ fDebugToolbarPerspectives.add(perspective.getId());
+ } else {
+ fDebugToolbarPerspectives.remove(perspective.getId());
+ }
+ }
+
+ // Update the toolbar manager.
+ IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
+ if (show) {
+ addDebugToolbarActions(tbm);
+ } else {
+ removeDebugToolbarActions(tbm);
+ }
+ getViewSite().getActionBars().updateActionBars();
+
+ // Update system property used by contributed actions.
+ System.setProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE, Boolean.toString(show));
+ }
@Override
public void dispose() {
- fContextService.removeContextManagerListener(this);
- getSite().getSelectionProvider().removeSelectionChangedListener(this);
+ fContextService.removeContextManagerListener(this);
+ getSite().getSelectionProvider().removeSelectionChangedListener(this);
DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextProvider(fContextProviderProxy);
- fContextProviderProxy.dispose();
- fTreeViewerDebugContextProvider.dispose();
- disposeActions();
- Viewer viewer = getViewer();
+ fContextProviderProxy.dispose();
+ fTreeViewerDebugContextProvider.dispose();
+ disposeActions();
+ Viewer viewer = getViewer();
if (viewer != null) {
viewer.removeSelectionChangedListener(fTreeViewerSelectionChangedListener);
- ((TreeModelViewer)viewer).removeViewerUpdateListener(this);
- ((TreeModelViewer)viewer).removeModelChangedListener(this);
+ ((TreeModelViewer)viewer).removeViewerUpdateListener(this);
+ ((TreeModelViewer)viewer).removeModelChangedListener(this);
}
if (fPresentationContext != null) {
- fPresentationContext.dispose();
+ fPresentationContext.dispose();
}
IWorkbenchPage page = getSite().getPage();
page.removePartListener((IPartListener2) this);
@@ -1095,25 +1095,25 @@ public class LaunchView extends AbstractDebugView
}
private void disposeActions() {
- PropertyDialogAction properties = (PropertyDialogAction) getAction("Properties"); //$NON-NLS-1$
- properties.dispose();
-
- disposeCommandAction(TERMINATE);
- disposeCommandAction(DISCONNECT);
- disposeCommandAction(SUSPEND);
- disposeCommandAction(RESUME);
- disposeCommandAction(STEP_RETURN);
- disposeCommandAction(STEP_OVER);
- disposeCommandAction(STEP_INTO);
- disposeCommandAction(DROP_TO_FRAME);
- disposeCommandAction(TERMINATE_AND_REMOVE);
- disposeCommandAction(TERMINATE_AND_RELAUNCH);
- disposeCommandAction(RESTART);
- disposeCommandAction(TERMINATE_ALL);
- disposeCommandAction(TOGGLE_STEP_FILTERS);
- }
-
- /**
+ PropertyDialogAction properties = (PropertyDialogAction) getAction("Properties"); //$NON-NLS-1$
+ properties.dispose();
+
+ disposeCommandAction(TERMINATE);
+ disposeCommandAction(DISCONNECT);
+ disposeCommandAction(SUSPEND);
+ disposeCommandAction(RESUME);
+ disposeCommandAction(STEP_RETURN);
+ disposeCommandAction(STEP_OVER);
+ disposeCommandAction(STEP_INTO);
+ disposeCommandAction(DROP_TO_FRAME);
+ disposeCommandAction(TERMINATE_AND_REMOVE);
+ disposeCommandAction(TERMINATE_AND_RELAUNCH);
+ disposeCommandAction(RESTART);
+ disposeCommandAction(TERMINATE_ALL);
+ disposeCommandAction(TOGGLE_STEP_FILTERS);
+ }
+
+ /**
* The selection has changed in the viewer. Show the
* associated source code if it is a stack frame.
*
@@ -1144,7 +1144,7 @@ public class LaunchView extends AbstractDebugView
setActive(page.findView(getSite().getId()) != null);
updateObjects();
setDebugToolbarInView( isDebugToolbarShownInPerspective(getSite().getPage().getPerspective()) );
- updateCheckedDebugToolBarAction();
+ updateCheckedDebugToolBarAction();
}
@Override
@@ -1179,8 +1179,8 @@ public class LaunchView extends AbstractDebugView
@Override
protected void fillContextMenu(IMenuManager menu) {
- TreeSelection sel = (TreeSelection) fTreeViewerDebugContextProvider.getActiveContext();
- Object element = sel != null && sel.size() > 0 ? sel.getFirstElement() : null;
+ TreeSelection sel = (TreeSelection) fTreeViewerDebugContextProvider.getActiveContext();
+ Object element = sel != null && sel.size() > 0 ? sel.getFirstElement() : null;
menu.add(new Separator(IDebugUIConstants.EMPTY_EDIT_GROUP));
menu.add(new Separator(IDebugUIConstants.EDIT_GROUP));
@@ -1211,42 +1211,42 @@ public class LaunchView extends AbstractDebugView
menu.add(action);
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.appendToGroup(IDebugUIConstants.LAUNCH_GROUP, getAction(TERMINATE_AND_REMOVE));
- menu.appendToGroup(IDebugUIConstants.LAUNCH_GROUP, getAction(TERMINATE_ALL));
+ menu.appendToGroup(IDebugUIConstants.LAUNCH_GROUP, getAction(TERMINATE_AND_REMOVE));
+ menu.appendToGroup(IDebugUIConstants.LAUNCH_GROUP, getAction(TERMINATE_ALL));
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME));
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND));
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE));
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE_AND_RELAUNCH));
- if (element instanceof IAdaptable && ((IAdaptable)element).getAdapter(IRestartHandler.class) != null) {
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESTART));
- }
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT));
+ menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME));
+ menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND));
+ menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE));
+ menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE_AND_RELAUNCH));
+ if (element instanceof IAdaptable && ((IAdaptable)element).getAdapter(IRestartHandler.class) != null) {
+ menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESTART));
+ }
+ menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT));
- menu.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO));
- menu.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER));
- menu.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN));
+ menu.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO));
+ menu.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER));
+ menu.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN));
- menu.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME));
+ menu.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME));
- menu.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS));
- }
+ menu.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS));
+ }
@Override
public void contextManagerChanged(ContextManagerEvent event) {
- if (event.isActiveContextsChanged()) {
+ if (event.isActiveContextsChanged()) {
Set<?> oldContexts = event.getPreviouslyActiveContextIds();
Set<?> newContexts = event.getContextManager().getActiveContextIds();
- if (oldContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET) !=
- newContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET))
- {
- updateCheckedDebugToolBarAction();
- }
- }
+ if (oldContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET) !=
+ newContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET))
+ {
+ updateCheckedDebugToolBarAction();
+ }
+ }
}
private void updateCheckedDebugToolBarAction() {
- fDebugToolBarAction.setChecked(isDebugToolbarInView());
+ fDebugToolBarAction.setChecked(isDebugToolbarInView());
}
/**
@@ -1402,76 +1402,76 @@ public class LaunchView extends AbstractDebugView
getViewer().refresh();
}
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {
- if (!update.isCanceled()) {
- if (TreePath.EMPTY.equals(update.getElementPath())) {
- updateFindAction();
- }
- }
- }
-
- @Override
+ if (!update.isCanceled()) {
+ if (TreePath.EMPTY.equals(update.getElementPath())) {
+ updateFindAction();
+ }
+ }
+ }
+
+ @Override
public void updateStarted(IViewerUpdate update) {
- }
+ }
- @Override
+ @Override
public synchronized void viewerUpdatesBegin() {
- IWorkbenchSiteProgressService progressService =
- getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (progressService != null) {
- progressService.incrementBusy();
- }
- }
-
- @Override
+ IWorkbenchSiteProgressService progressService =
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ if (progressService != null) {
+ progressService.incrementBusy();
+ }
+ }
+
+ @Override
public synchronized void viewerUpdatesComplete() {
- IWorkbenchSiteProgressService progressService =
- getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (progressService != null) {
- progressService.decrementBusy();
- }
- }
-
- @Override
+ IWorkbenchSiteProgressService progressService =
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ if (progressService != null) {
+ progressService.decrementBusy();
+ }
+ }
+
+ @Override
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- updateFindAction();
- }
-
- private void updateFindAction() {
- IAction action= getAction(FIND_ACTION);
- if (action instanceof IUpdate) {
- ((IUpdate) action).update();
- }
- }
-
- /**
- * Returns whether the breadcrumb viewer is currently visible in the view.
- *
- * @since 3.5
- */
- boolean isBreadcrumbVisible() {
- return fBreadcrumbPage.equals(getCurrentPage());
- }
-
- /**
- * Returns whether the elements in breadcrumb's drop-down viewer should be
- * automatically expanded.
- *
- * @since 3.5
- */
- boolean getBreadcrumbDropDownAutoExpand() {
- return fBreadcrumbDropDownAutoExpand;
- }
-
- /**
- * Sets whether the elements in breadcrumb's drop-down viewer should be
- * automatically expanded.
- *
- * @since 3.5
- */
- void setBreadcrumbDropDownAutoExpand(boolean expand) {
- fBreadcrumbDropDownAutoExpand = expand;
- }
+ updateFindAction();
+ }
+
+ private void updateFindAction() {
+ IAction action= getAction(FIND_ACTION);
+ if (action instanceof IUpdate) {
+ ((IUpdate) action).update();
+ }
+ }
+
+ /**
+ * Returns whether the breadcrumb viewer is currently visible in the view.
+ *
+ * @since 3.5
+ */
+ boolean isBreadcrumbVisible() {
+ return fBreadcrumbPage.equals(getCurrentPage());
+ }
+
+ /**
+ * Returns whether the elements in breadcrumb's drop-down viewer should be
+ * automatically expanded.
+ *
+ * @since 3.5
+ */
+ boolean getBreadcrumbDropDownAutoExpand() {
+ return fBreadcrumbDropDownAutoExpand;
+ }
+
+ /**
+ * Sets whether the elements in breadcrumb's drop-down viewer should be
+ * automatically expanded.
+ *
+ * @since 3.5
+ */
+ void setBreadcrumbDropDownAutoExpand(boolean expand) {
+ fBreadcrumbDropDownAutoExpand = expand;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java
index 338adc355..ccb12f2c1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java
@@ -66,497 +66,497 @@ import org.eclipse.ui.progress.UIJob;
*/
public class LaunchViewBreadcrumb extends AbstractBreadcrumb implements IDebugContextListener, ILabelUpdateListener {
- private static class Input {
- final TreePath fPath;
+ private static class Input {
+ final TreePath fPath;
- Input(TreePath path) {
- fPath = path;
- }
+ Input(TreePath path) {
+ fPath = path;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof Input &&
- ((fPath == null && ((Input)obj).fPath == null) ||
- (fPath != null && fPath.equals( ((Input)obj).fPath )));
- }
+ return obj instanceof Input &&
+ ((fPath == null && ((Input)obj).fPath == null) ||
+ (fPath != null && fPath.equals( ((Input)obj).fPath )));
+ }
- @Override
+ @Override
public int hashCode() {
- return fPath == null ? 0 : fPath.hashCode();
- }
- }
+ return fPath == null ? 0 : fPath.hashCode();
+ }
+ }
- private static class ContentProvider implements ITreePathContentProvider {
+ private static class ContentProvider implements ITreePathContentProvider {
- private static final Object[] EMPTY_ELEMENTS_ARRAY = new Object[0];
+ private static final Object[] EMPTY_ELEMENTS_ARRAY = new Object[0];
- public Input fInput;
+ public Input fInput;
- @Override
+ @Override
public Object[] getChildren(TreePath parentPath) {
- if (hasChildren(parentPath)) {
- return new Object[] { fInput.fPath.getSegment(parentPath.getSegmentCount()) };
- }
- return EMPTY_ELEMENTS_ARRAY;
- }
+ if (hasChildren(parentPath)) {
+ return new Object[] { fInput.fPath.getSegment(parentPath.getSegmentCount()) };
+ }
+ return EMPTY_ELEMENTS_ARRAY;
+ }
- @Override
+ @Override
public TreePath[] getParents(Object element) {
- // Not supported
- return new TreePath[] { TreePath.EMPTY };
- }
+ // Not supported
+ return new TreePath[] { TreePath.EMPTY };
+ }
- @Override
+ @Override
public boolean hasChildren(TreePath parentPath) {
- if ( parentPath.getSegmentCount() == 0) {
- return fInput != null;
- } else if (fInput != null &&
- fInput.fPath != null &&
- fInput.fPath.getSegmentCount() > parentPath.getSegmentCount())
- {
- for (int i = 0; i < parentPath.getSegmentCount(); i++) {
- if (i >= fInput.fPath.getSegmentCount()) {
- return false;
- } else {
- Object parentElement = parentPath.getSegment(i);
- Object contextElement = fInput.fPath.getSegment(i);
- if (!parentElement.equals(contextElement)) {
- return false;
- }
- }
- }
- return true;
- }
- return false;
- }
-
- @Override
+ if ( parentPath.getSegmentCount() == 0) {
+ return fInput != null;
+ } else if (fInput != null &&
+ fInput.fPath != null &&
+ fInput.fPath.getSegmentCount() > parentPath.getSegmentCount())
+ {
+ for (int i = 0; i < parentPath.getSegmentCount(); i++) {
+ if (i >= fInput.fPath.getSegmentCount()) {
+ return false;
+ } else {
+ Object parentElement = parentPath.getSegment(i);
+ Object contextElement = fInput.fPath.getSegment(i);
+ if (!parentElement.equals(contextElement)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
public Object[] getElements(Object inputElement) {
- if (fInput != null &&
- fInput.fPath != null)
- {
- return getChildren(TreePath.EMPTY);
- } else {
- return new Object[] { fgEmptyDebugContextElement };
- }
- }
-
- @Override
+ if (fInput != null &&
+ fInput.fPath != null)
+ {
+ return getChildren(TreePath.EMPTY);
+ } else {
+ return new Object[] { fgEmptyDebugContextElement };
+ }
+ }
+
+ @Override
public void dispose() {
- fInput = null;
- }
+ fInput = null;
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof Input) {
- fInput = ((Input)newInput);
- } else {
- fInput = null;
- }
- }
- }
-
- private class LabelProvider extends BaseLabelProvider implements ITreePathLabelProvider {
- @Override
+ if (newInput instanceof Input) {
+ fInput = ((Input)newInput);
+ } else {
+ fInput = null;
+ }
+ }
+ }
+
+ private class LabelProvider extends BaseLabelProvider implements ITreePathLabelProvider {
+ @Override
public void updateLabel(ViewerLabel label, TreePath elementPath) {
- if (fgEmptyDebugContextElement.equals(elementPath.getLastSegment())) {
- label.setText(LaunchViewMessages.Breadcrumb_NoActiveContext);
- label.setImage(null);
- } else {
- ViewerLabel treeViewerLabel = fTreeViewer.getElementLabel(elementPath, null);
- if (treeViewerLabel == null) {
- label.setText(LaunchViewMessages.Breadcrumb_NoActiveContext);
- label.setImage(null);
- } else {
- label.setText(treeViewerLabel.getText());
- label.setTooltipText(treeViewerLabel.getText());
- label.setImage(treeViewerLabel.getImage());
- label.setFont(treeViewerLabel.getFont());
- label.setForeground(treeViewerLabel.getForeground());
- label.setBackground(treeViewerLabel.getBackground());
-
- }
- }
- }
- }
-
- private final LaunchView fView;
- private final TreeModelViewer fTreeViewer;
- private final IDebugContextProvider fTreeViewerContextProvider;
- private Input fBreadcrumbInput;
- static final private Object fgEmptyDebugContextElement = new Object();
- private BreadcrumbViewer fViewer;
- private boolean fRefreshBreadcrumb = false;
-
- private class BreadcrumbContextProvider extends AbstractDebugContextProvider implements IDebugContextListener, ISelectionChangedListener {
-
- private ISelection fBreadcrumbSelection = null;
-
- BreadcrumbContextProvider() {
- super(fView);
- fViewer.addSelectionChangedListener(this);
- fBreadcrumbSelection = fViewer.getSelection();
- fTreeViewerContextProvider.addDebugContextListener(this);
- }
-
- @Override
+ if (fgEmptyDebugContextElement.equals(elementPath.getLastSegment())) {
+ label.setText(LaunchViewMessages.Breadcrumb_NoActiveContext);
+ label.setImage(null);
+ } else {
+ ViewerLabel treeViewerLabel = fTreeViewer.getElementLabel(elementPath, null);
+ if (treeViewerLabel == null) {
+ label.setText(LaunchViewMessages.Breadcrumb_NoActiveContext);
+ label.setImage(null);
+ } else {
+ label.setText(treeViewerLabel.getText());
+ label.setTooltipText(treeViewerLabel.getText());
+ label.setImage(treeViewerLabel.getImage());
+ label.setFont(treeViewerLabel.getFont());
+ label.setForeground(treeViewerLabel.getForeground());
+ label.setBackground(treeViewerLabel.getBackground());
+
+ }
+ }
+ }
+ }
+
+ private final LaunchView fView;
+ private final TreeModelViewer fTreeViewer;
+ private final IDebugContextProvider fTreeViewerContextProvider;
+ private Input fBreadcrumbInput;
+ static final private Object fgEmptyDebugContextElement = new Object();
+ private BreadcrumbViewer fViewer;
+ private boolean fRefreshBreadcrumb = false;
+
+ private class BreadcrumbContextProvider extends AbstractDebugContextProvider implements IDebugContextListener, ISelectionChangedListener {
+
+ private ISelection fBreadcrumbSelection = null;
+
+ BreadcrumbContextProvider() {
+ super(fView);
+ fViewer.addSelectionChangedListener(this);
+ fBreadcrumbSelection = fViewer.getSelection();
+ fTreeViewerContextProvider.addDebugContextListener(this);
+ }
+
+ @Override
public ISelection getActiveContext() {
- if (fBreadcrumbSelection != null && !fBreadcrumbSelection.isEmpty()) {
- return fBreadcrumbSelection;
- } else {
- ISelection treeViewerSelection = fTreeViewerContextProvider.getActiveContext();
- return treeViewerSelection != null ? treeViewerSelection : StructuredSelection.EMPTY;
- }
- }
-
- void dispose() {
- fViewer.removeSelectionChangedListener(this);
- fTreeViewerContextProvider.removeDebugContextListener(this);
- }
-
- @Override
+ if (fBreadcrumbSelection != null && !fBreadcrumbSelection.isEmpty()) {
+ return fBreadcrumbSelection;
+ } else {
+ ISelection treeViewerSelection = fTreeViewerContextProvider.getActiveContext();
+ return treeViewerSelection != null ? treeViewerSelection : StructuredSelection.EMPTY;
+ }
+ }
+
+ void dispose() {
+ fViewer.removeSelectionChangedListener(this);
+ fTreeViewerContextProvider.removeDebugContextListener(this);
+ }
+
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- fire(new DebugContextEvent(this, getActiveContext(), event.getFlags()));
- }
+ fire(new DebugContextEvent(this, getActiveContext(), event.getFlags()));
+ }
- @Override
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- ISelection oldContext = getActiveContext();
- fBreadcrumbSelection = event.getSelection();
- if (!getActiveContext().equals(oldContext)) {
- fire(new DebugContextEvent(this, getActiveContext(), DebugContextEvent.ACTIVATED));
- }
- }
- }
-
- private BreadcrumbContextProvider fBreadcrumbContextProvider;
-
- public LaunchViewBreadcrumb(LaunchView view, TreeModelViewer treeViewer, IDebugContextProvider contextProvider) {
- fView = view;
- fTreeViewer = treeViewer;
- fTreeViewer.addLabelUpdateListener(this);
- fTreeViewerContextProvider = contextProvider;
- fBreadcrumbInput = new Input( getPathForSelection(fTreeViewerContextProvider.getActiveContext()) );
- fTreeViewerContextProvider.addDebugContextListener(this);
- }
-
- @Override
+ ISelection oldContext = getActiveContext();
+ fBreadcrumbSelection = event.getSelection();
+ if (!getActiveContext().equals(oldContext)) {
+ fire(new DebugContextEvent(this, getActiveContext(), DebugContextEvent.ACTIVATED));
+ }
+ }
+ }
+
+ private BreadcrumbContextProvider fBreadcrumbContextProvider;
+
+ public LaunchViewBreadcrumb(LaunchView view, TreeModelViewer treeViewer, IDebugContextProvider contextProvider) {
+ fView = view;
+ fTreeViewer = treeViewer;
+ fTreeViewer.addLabelUpdateListener(this);
+ fTreeViewerContextProvider = contextProvider;
+ fBreadcrumbInput = new Input( getPathForSelection(fTreeViewerContextProvider.getActiveContext()) );
+ fTreeViewerContextProvider.addDebugContextListener(this);
+ }
+
+ @Override
protected void activateBreadcrumb() {
- }
+ }
- @Override
+ @Override
protected void deactivateBreadcrumb() {
- if (fViewer.isDropDownOpen()) {
- Shell shell = fViewer.getDropDownShell();
- if (shell != null && !shell.isDisposed()) {
- shell.close();
- }
- }
- }
-
- @Override
+ if (fViewer.isDropDownOpen()) {
+ Shell shell = fViewer.getDropDownShell();
+ if (shell != null && !shell.isDisposed()) {
+ shell.close();
+ }
+ }
+ }
+
+ @Override
protected BreadcrumbViewer createViewer(Composite parent) {
- fViewer = new BreadcrumbViewer(parent, SWT.NONE) {
- @Override
+ fViewer = new BreadcrumbViewer(parent, SWT.NONE) {
+ @Override
protected Control createDropDown(Composite dropDownParent, IBreadcrumbDropDownSite site, TreePath path) {
- return createDropDownControl(dropDownParent, site, path);
- }
- };
+ return createDropDownControl(dropDownParent, site, path);
+ }
+ };
- // Force the layout of the breadcrumb viewer so that we may calcualte
- // its proper size.
- parent.pack(true);
+ // Force the layout of the breadcrumb viewer so that we may calcualte
+ // its proper size.
+ parent.pack(true);
- fViewer.setContentProvider(new ContentProvider());
- fViewer.setLabelProvider(new LabelProvider());
+ fViewer.setContentProvider(new ContentProvider());
+ fViewer.setLabelProvider(new LabelProvider());
- createMenuManager();
+ createMenuManager();
- fViewer.setInput(getCurrentInput());
+ fViewer.setInput(getCurrentInput());
- fBreadcrumbContextProvider = new BreadcrumbContextProvider();
+ fBreadcrumbContextProvider = new BreadcrumbContextProvider();
- return fViewer;
- }
+ return fViewer;
+ }
- protected void createMenuManager() {
- MenuManager menuMgr = new MenuManager("#PopUp"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
+ protected void createMenuManager() {
+ MenuManager menuMgr = new MenuManager("#PopUp"); //$NON-NLS-1$
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager mgr) {
- fView.fillContextMenu(mgr);
- }
- });
- final Menu menu= menuMgr.createContextMenu(fViewer.getControl());
-
- // register the context menu such that other plug-ins may contribute to it
- if (fView.getSite() != null) {
- fView.getSite().registerContextMenu(menuMgr, fViewer);
- }
- fView.addContextMenuManager(menuMgr);
-
- fViewer.addMenuDetectListener(new MenuDetectListener() {
- @Override
+ fView.fillContextMenu(mgr);
+ }
+ });
+ final Menu menu= menuMgr.createContextMenu(fViewer.getControl());
+
+ // register the context menu such that other plug-ins may contribute to it
+ if (fView.getSite() != null) {
+ fView.getSite().registerContextMenu(menuMgr, fViewer);
+ }
+ fView.addContextMenuManager(menuMgr);
+
+ fViewer.addMenuDetectListener(new MenuDetectListener() {
+ @Override
public void menuDetected(MenuDetectEvent event) {
- menu.setLocation(event.x + 10, event.y + 10);
- menu.setVisible(true);
- while (!menu.isDisposed() && menu.isVisible()) {
- if (!menu.getDisplay().readAndDispatch()) {
+ menu.setLocation(event.x + 10, event.y + 10);
+ menu.setVisible(true);
+ while (!menu.isDisposed() && menu.isVisible()) {
+ if (!menu.getDisplay().readAndDispatch()) {
menu.getDisplay().sleep();
}
- }
- }
- });
- }
+ }
+ }
+ });
+ }
- @Override
+ @Override
protected Object getCurrentInput() {
- return fBreadcrumbInput;
- }
+ return fBreadcrumbInput;
+ }
- @Override
+ @Override
protected boolean open(ISelection selection) {
- // Let the drop-down control implementation itself handle activating a new context.
- return false;
- }
+ // Let the drop-down control implementation itself handle activating a new context.
+ return false;
+ }
- @Override
+ @Override
public void dispose() {
- fTreeViewerContextProvider.removeDebugContextListener(this);
- fTreeViewer.removeLabelUpdateListener(this);
- if (fBreadcrumbContextProvider != null) {
- fBreadcrumbContextProvider.dispose();
- fBreadcrumbContextProvider = null;
- }
- fViewer = null;
- super.dispose();
- }
-
- @Override
+ fTreeViewerContextProvider.removeDebugContextListener(this);
+ fTreeViewer.removeLabelUpdateListener(this);
+ if (fBreadcrumbContextProvider != null) {
+ fBreadcrumbContextProvider.dispose();
+ fBreadcrumbContextProvider = null;
+ }
+ fViewer = null;
+ super.dispose();
+ }
+
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- if (fView.isBreadcrumbVisible()) {
- fBreadcrumbInput = new Input(getPathForSelection(event.getContext()));
- if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
- setInput(getCurrentInput());
-
- // If the context was activated, then clear the selection in breadcrumb
- // so that the activated context will become the active context for the
- // window.
- fViewer.setSelection(StructuredSelection.EMPTY);
- } else {
- refresh();
- }
- }
- }
-
- @Override
+ if (fView.isBreadcrumbVisible()) {
+ fBreadcrumbInput = new Input(getPathForSelection(event.getContext()));
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
+ setInput(getCurrentInput());
+
+ // If the context was activated, then clear the selection in breadcrumb
+ // so that the activated context will become the active context for the
+ // window.
+ fViewer.setSelection(StructuredSelection.EMPTY);
+ } else {
+ refresh();
+ }
+ }
+ }
+
+ @Override
public void labelUpdateStarted(ILabelUpdate update) {
- }
+ }
- @Override
+ @Override
public void labelUpdateComplete(ILabelUpdate update) {
- if (fBreadcrumbInput != null && fBreadcrumbInput.fPath != null) {
- if (fBreadcrumbInput.fPath.startsWith(update.getElementPath(), null)) {
- synchronized (this) {
- fRefreshBreadcrumb = true;
- }
- }
- }
- }
-
- @Override
+ if (fBreadcrumbInput != null && fBreadcrumbInput.fPath != null) {
+ if (fBreadcrumbInput.fPath.startsWith(update.getElementPath(), null)) {
+ synchronized (this) {
+ fRefreshBreadcrumb = true;
+ }
+ }
+ }
+ }
+
+ @Override
public void labelUpdatesBegin() {
- }
+ }
- @Override
+ @Override
public void labelUpdatesComplete() {
- boolean refresh = false;
- synchronized(this) {
- refresh = fRefreshBreadcrumb;
- fRefreshBreadcrumb = false;
- }
- if (fView.isBreadcrumbVisible() && refresh) {
- new UIJob(fViewer.getControl().getDisplay(), "refresh breadcrumb") { //$NON-NLS-1$
- { setSystem(true); }
- @Override
+ boolean refresh = false;
+ synchronized(this) {
+ refresh = fRefreshBreadcrumb;
+ fRefreshBreadcrumb = false;
+ }
+ if (fView.isBreadcrumbVisible() && refresh) {
+ new UIJob(fViewer.getControl().getDisplay(), "refresh breadcrumb") { //$NON-NLS-1$
+ { setSystem(true); }
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- refresh();
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- }
+ refresh();
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ }
- IDebugContextProvider getContextProvider() {
- return fBreadcrumbContextProvider;
- }
+ IDebugContextProvider getContextProvider() {
+ return fBreadcrumbContextProvider;
+ }
- int getHeight() {
- return fViewer.getControl().getSize().y;
- }
+ int getHeight() {
+ return fViewer.getControl().getSize().y;
+ }
- void clearSelection() {
- fViewer.setSelection(StructuredSelection.EMPTY);
- }
+ void clearSelection() {
+ fViewer.setSelection(StructuredSelection.EMPTY);
+ }
- private TreePath getPathForSelection(ISelection selection) {
- if (selection instanceof ITreeSelection && !selection.isEmpty()) {
- return ((ITreeSelection)selection).getPaths()[0];
- }
- return null;
- }
+ private TreePath getPathForSelection(ISelection selection) {
+ if (selection instanceof ITreeSelection && !selection.isEmpty()) {
+ return ((ITreeSelection)selection).getPaths()[0];
+ }
+ return null;
+ }
- public Control createDropDownControl(Composite parent, final IBreadcrumbDropDownSite site, TreePath paramPath) {
+ public Control createDropDownControl(Composite parent, final IBreadcrumbDropDownSite site, TreePath paramPath) {
- TreeViewerDropDown dropDownTreeViewer = new TreeViewerDropDown() {
+ TreeViewerDropDown dropDownTreeViewer = new TreeViewerDropDown() {
- SubTreeModelViewer fDropDownViewer;
+ SubTreeModelViewer fDropDownViewer;
- @Override
+ @Override
protected TreeViewer createTreeViewer(Composite composite, int style, final TreePath path) {
- fDropDownViewer = new SubTreeModelViewer(
- composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL | SWT.POP_UP,
- fTreeViewer.getPresentationContext());
-
- Object launchViewInput = fTreeViewer.getInput();
- fDropDownViewer.setInput(launchViewInput, path.getParentPath());
-
- ViewerFilter[] filters = fTreeViewer.getFilters();
- fDropDownViewer.setFilters(filters);
-
- ModelDelta stateDelta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
- fTreeViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- // If we do not want to expand the elements in the drop-down.
- // Prune the delta to only select the element in the
- // top-most list.
- if (!fView.getBreadcrumbDropDownAutoExpand()) {
- final ModelDelta prunedDelta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
- stateDelta.accept(new IModelDeltaVisitor() {
- ModelDelta copy = prunedDelta;
- @Override
+ fDropDownViewer = new SubTreeModelViewer(
+ composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL | SWT.POP_UP,
+ fTreeViewer.getPresentationContext());
+
+ Object launchViewInput = fTreeViewer.getInput();
+ fDropDownViewer.setInput(launchViewInput, path.getParentPath());
+
+ ViewerFilter[] filters = fTreeViewer.getFilters();
+ fDropDownViewer.setFilters(filters);
+
+ ModelDelta stateDelta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
+ fTreeViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND | IModelDelta.SELECT);
+
+ // If we do not want to expand the elements in the drop-down.
+ // Prune the delta to only select the element in the
+ // top-most list.
+ if (!fView.getBreadcrumbDropDownAutoExpand()) {
+ final ModelDelta prunedDelta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
+ stateDelta.accept(new IModelDeltaVisitor() {
+ ModelDelta copy = prunedDelta;
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- TreePath deltaPath = getViewerTreePath(delta);
- if (deltaPath.getSegmentCount() == 0) {
- // skip copying the root element, only copy it's child count
- copy.setChildCount(delta.getChildCount());
- } else if (deltaPath.getSegmentCount() != 0 && path.startsWith(deltaPath, null) ) {
- // Build up the delta copy along the path of the drop-down element.
- copy = copy.addNode(
- delta.getElement(), delta.getIndex(), delta.getFlags(), delta.getChildCount());
- }
-
- // If the delta is for the drop-down element, set its select flag and stop traversing
- // the delta..
- if (deltaPath.equals(path)) {
- copy.setFlags(IModelDelta.SELECT | IModelDelta.REVEAL);
- return false;
- }
-
- // Continue traversing the delta.
- return true;
- }
-
- private TreePath getViewerTreePath(IModelDelta node) {
+ TreePath deltaPath = getViewerTreePath(delta);
+ if (deltaPath.getSegmentCount() == 0) {
+ // skip copying the root element, only copy it's child count
+ copy.setChildCount(delta.getChildCount());
+ } else if (deltaPath.getSegmentCount() != 0 && path.startsWith(deltaPath, null) ) {
+ // Build up the delta copy along the path of the drop-down element.
+ copy = copy.addNode(
+ delta.getElement(), delta.getIndex(), delta.getFlags(), delta.getChildCount());
+ }
+
+ // If the delta is for the drop-down element, set its select flag and stop traversing
+ // the delta..
+ if (deltaPath.equals(path)) {
+ copy.setFlags(IModelDelta.SELECT | IModelDelta.REVEAL);
+ return false;
+ }
+
+ // Continue traversing the delta.
+ return true;
+ }
+
+ private TreePath getViewerTreePath(IModelDelta node) {
ArrayList<Object> list = new ArrayList<>();
- IModelDelta parentDelta = node.getParentDelta();
- while (parentDelta != null) {
- list.add(0, node.getElement());
- node = parentDelta;
- parentDelta = node.getParentDelta();
- }
- return new TreePath(list.toArray());
- }
- });
- stateDelta = prunedDelta;
- }
-
- fDropDownViewer.updateViewer(stateDelta);
-
- fDropDownViewer.addLabelUpdateListener(new ILabelUpdateListener() {
- @Override
+ IModelDelta parentDelta = node.getParentDelta();
+ while (parentDelta != null) {
+ list.add(0, node.getElement());
+ node = parentDelta;
+ parentDelta = node.getParentDelta();
+ }
+ return new TreePath(list.toArray());
+ }
+ });
+ stateDelta = prunedDelta;
+ }
+
+ fDropDownViewer.updateViewer(stateDelta);
+
+ fDropDownViewer.addLabelUpdateListener(new ILabelUpdateListener() {
+ @Override
public void labelUpdateComplete(ILabelUpdate update) {}
- @Override
+ @Override
public void labelUpdatesBegin() {}
- @Override
+ @Override
public void labelUpdateStarted(ILabelUpdate update) {}
- @Override
+ @Override
public void labelUpdatesComplete() {
- new UIJob(fViewer.getControl().getDisplay(), "resize breadcrub dropdown") { //$NON-NLS-1$
- { setSystem(true); }
- @Override
+ new UIJob(fViewer.getControl().getDisplay(), "resize breadcrub dropdown") { //$NON-NLS-1$
+ { setSystem(true); }
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- site.updateSize();
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- });
+ site.updateSize();
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ });
- return fDropDownViewer;
- }
+ return fDropDownViewer;
+ }
- @Override
+ @Override
protected void openElement(ISelection selection) {
- if (fTreeViewer.getControl().isDisposed()) {
- return;
- }
-
- if (selection != null && (selection instanceof ITreeSelection) && !selection.isEmpty()) {
- // Create the path to the root element of the drop-down viewer. Need to calcualte
- // indexes and counts for the delta in order for the selection from the drop-down
- // viewer to work properly.
- TreeModelContentProvider contentProvider = (TreeModelContentProvider)fTreeViewer.getContentProvider();
- TreePath path = TreePath.EMPTY;
- int count = fTreeViewer.getChildCount(path);
- count = contentProvider.viewToModelCount(path, count);
- ModelDelta rootDelta =
- new ModelDelta(fTreeViewer.getInput(), -1, IModelDelta.NO_CHANGE, count);
- TreePath rootPath = fDropDownViewer.getRootPath();
- ModelDelta delta = rootDelta;
- for (int i = 0; i < rootPath.getSegmentCount(); i++) {
- Object element = rootPath.getSegment(i);
- int index = fTreeViewer.findElementIndex(path, element);
- index = contentProvider.viewToModelIndex(path, index);
- path = path.createChildPath(element);
- count = fTreeViewer.getChildCount(path);
- count = contentProvider.viewToModelCount(path, count);
- delta = delta.addNode(rootPath.getSegment(i), index, IModelDelta.NO_CHANGE, count);
- }
-
- // Create the delta and save the drop-down viewer's state to it.
- fDropDownViewer.saveElementState(TreePath.EMPTY, delta, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- // Add the IModelDelta.FORCE flag to override the current selection in view.
- rootDelta.accept(new IModelDeltaVisitor(){
- @Override
+ if (fTreeViewer.getControl().isDisposed()) {
+ return;
+ }
+
+ if (selection != null && (selection instanceof ITreeSelection) && !selection.isEmpty()) {
+ // Create the path to the root element of the drop-down viewer. Need to calcualte
+ // indexes and counts for the delta in order for the selection from the drop-down
+ // viewer to work properly.
+ TreeModelContentProvider contentProvider = (TreeModelContentProvider)fTreeViewer.getContentProvider();
+ TreePath path = TreePath.EMPTY;
+ int count = fTreeViewer.getChildCount(path);
+ count = contentProvider.viewToModelCount(path, count);
+ ModelDelta rootDelta =
+ new ModelDelta(fTreeViewer.getInput(), -1, IModelDelta.NO_CHANGE, count);
+ TreePath rootPath = fDropDownViewer.getRootPath();
+ ModelDelta delta = rootDelta;
+ for (int i = 0; i < rootPath.getSegmentCount(); i++) {
+ Object element = rootPath.getSegment(i);
+ int index = fTreeViewer.findElementIndex(path, element);
+ index = contentProvider.viewToModelIndex(path, index);
+ path = path.createChildPath(element);
+ count = fTreeViewer.getChildCount(path);
+ count = contentProvider.viewToModelCount(path, count);
+ delta = delta.addNode(rootPath.getSegment(i), index, IModelDelta.NO_CHANGE, count);
+ }
+
+ // Create the delta and save the drop-down viewer's state to it.
+ fDropDownViewer.saveElementState(TreePath.EMPTY, delta, IModelDelta.EXPAND | IModelDelta.SELECT);
+
+ // Add the IModelDelta.FORCE flag to override the current selection in view.
+ rootDelta.accept(new IModelDeltaVisitor(){
+ @Override
public boolean visit(IModelDelta paramDelta, int depth) {
- if ((paramDelta.getFlags() & IModelDelta.SELECT) != 0) {
- ((ModelDelta)paramDelta).setFlags(paramDelta.getFlags() | IModelDelta.FORCE);
- }
- return true;
- }
- });
-
- // If elements in the drop-down were auto-expanded, then collapse the drop-down's sub tree in the
- // full viewer. After the drop-down's full expansion state is saved out to the tree viewer, the
- // tree viewer will accurately reflect the state changes made by the user.
- if (fView.getBreadcrumbDropDownAutoExpand()) {
- fTreeViewer.collapseToLevel(rootPath, AbstractTreeViewer.ALL_LEVELS);
- }
-
- // Save the state of the drop-down out into the tree viewer.
- fTreeViewer.updateViewer(rootDelta);
- fViewer.setSelection(StructuredSelection.EMPTY);
- site.close();
- }
-
- super.openElement(selection);
- }
- };
-
-
- return dropDownTreeViewer.createDropDown(parent, site, paramPath);
- }
+ if ((paramDelta.getFlags() & IModelDelta.SELECT) != 0) {
+ ((ModelDelta)paramDelta).setFlags(paramDelta.getFlags() | IModelDelta.FORCE);
+ }
+ return true;
+ }
+ });
+
+ // If elements in the drop-down were auto-expanded, then collapse the drop-down's sub tree in the
+ // full viewer. After the drop-down's full expansion state is saved out to the tree viewer, the
+ // tree viewer will accurately reflect the state changes made by the user.
+ if (fView.getBreadcrumbDropDownAutoExpand()) {
+ fTreeViewer.collapseToLevel(rootPath, AbstractTreeViewer.ALL_LEVELS);
+ }
+
+ // Save the state of the drop-down out into the tree viewer.
+ fTreeViewer.updateViewer(rootDelta);
+ fViewer.setSelection(StructuredSelection.EMPTY);
+ site.close();
+ }
+
+ super.openElement(selection);
+ }
+ };
+
+
+ return dropDownTreeViewer.createDropDown(parent, site, paramPath);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java
index 74215ac06..6edd222ea 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java
@@ -40,58 +40,58 @@ import org.eclipse.swt.widgets.Widget;
*/
public class LaunchViewCopyToClipboardActionDelegate extends VirtualCopyToClipboardActionDelegate {
- @Override
+ @Override
protected TreeItem[] getSelectedItems(TreeModelViewer clientViewer) {
- LaunchView view = (LaunchView)getView();
- if (view.isBreadcrumbVisible()) {
- ISelection selection = getSelection();
- if (selection instanceof ITreeSelection && getViewer() != null) {
- TreePath path = TreePath.EMPTY;
- if (!selection.isEmpty()) {
- path = ((ITreeSelection)selection).getPaths()[0];
- }
- return getSelectedItemsInTreeViewer(getViewer(), path);
- }
- return new TreeItem[0];
- } else {
- // Return tree selection plus children.
- TreeItem[] selection = clientViewer.getTree().getSelection();
+ LaunchView view = (LaunchView)getView();
+ if (view.isBreadcrumbVisible()) {
+ ISelection selection = getSelection();
+ if (selection instanceof ITreeSelection && getViewer() != null) {
+ TreePath path = TreePath.EMPTY;
+ if (!selection.isEmpty()) {
+ path = ((ITreeSelection)selection).getPaths()[0];
+ }
+ return getSelectedItemsInTreeViewer(getViewer(), path);
+ }
+ return new TreeItem[0];
+ } else {
+ // Return tree selection plus children.
+ TreeItem[] selection = clientViewer.getTree().getSelection();
Set<Widget> set = new HashSet<>();
- collectChildItems(set, selection);
- return set.toArray(new TreeItem[set.size()]);
- }
- }
+ collectChildItems(set, selection);
+ return set.toArray(new TreeItem[set.size()]);
+ }
+ }
- /**
- * Calculates selected items in viewer for given tree path.
- * @param viewer Viewer to get items from.
- * @param path Path for desired selection.
- * @return Selected items. If no selected items found, returns an empty
- * array.
- */
- private TreeItem[] getSelectedItemsInTreeViewer(TreeModelViewer viewer, TreePath path) {
- Widget item = viewer.findItem(path);
+ /**
+ * Calculates selected items in viewer for given tree path.
+ * @param viewer Viewer to get items from.
+ * @param path Path for desired selection.
+ * @return Selected items. If no selected items found, returns an empty
+ * array.
+ */
+ private TreeItem[] getSelectedItemsInTreeViewer(TreeModelViewer viewer, TreePath path) {
+ Widget item = viewer.findItem(path);
Set<Widget> set = new HashSet<>();
- if (item instanceof TreeItem) {
- set.add(item);
- if (((TreeItem) item).getExpanded()) {
- collectChildItems(set, ((TreeItem) item).getItems());
- }
- } else if (item instanceof Tree) {
- collectChildItems(set, ((Tree)item).getItems());
- }
- return set.toArray(new TreeItem[set.size()]);
- }
+ if (item instanceof TreeItem) {
+ set.add(item);
+ if (((TreeItem) item).getExpanded()) {
+ collectChildItems(set, ((TreeItem) item).getItems());
+ }
+ } else if (item instanceof Tree) {
+ collectChildItems(set, ((Tree)item).getItems());
+ }
+ return set.toArray(new TreeItem[set.size()]);
+ }
private void collectChildItems(Set<Widget> set, TreeItem[] items) {
- if (items == null) {
- return;
- }
- for (int i = 0; i < items.length; i++) {
- set.add(items[i]);
- if (items[i].getExpanded()) {
- collectChildItems(set, items[i].getItems());
- }
- }
- }
+ if (items == null) {
+ return;
+ }
+ for (int i = 0; i < items.length; i++) {
+ set.add(items[i]);
+ if (items[i].getExpanded()) {
+ collectChildItems(set, items[i].getItems());
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java
index 4e054ec35..281a42437 100755
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java
@@ -20,24 +20,24 @@ public class LaunchViewMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.launch.LaunchViewMessages";//$NON-NLS-1$
public static String Breadcrumb_NoActiveContext;
- public static String LaunchView_ViewModeMenu_label;
- public static String DebugViewModeAction_Auto_label;
- public static String DebugViewModeAction_Auto_tooltip;
- public static String DebugViewModeAction_Auto_description;
- public static String DebugViewModeAction_Full_label;
- public static String DebugViewModeAction_Full_tooltip;
- public static String DebugViewModeAction_Full_description;
- public static String DebugViewModeAction_Compact_label;
- public static String DebugViewModeAction_Compact_tooltip;
- public static String DebugViewModeAction_Compact_description;
+ public static String LaunchView_ViewModeMenu_label;
+ public static String DebugViewModeAction_Auto_label;
+ public static String DebugViewModeAction_Auto_tooltip;
+ public static String DebugViewModeAction_Auto_description;
+ public static String DebugViewModeAction_Full_label;
+ public static String DebugViewModeAction_Full_tooltip;
+ public static String DebugViewModeAction_Full_description;
+ public static String DebugViewModeAction_Compact_label;
+ public static String DebugViewModeAction_Compact_tooltip;
+ public static String DebugViewModeAction_Compact_description;
- public static String BreadcrumbDropDownAutoExpandAction_label;
- public static String BreadcrumbDropDownAutoExpandAction_tooltip;
- public static String BreadcrumbDropDownAutoExpandAction_description;
+ public static String BreadcrumbDropDownAutoExpandAction_label;
+ public static String BreadcrumbDropDownAutoExpandAction_tooltip;
+ public static String BreadcrumbDropDownAutoExpandAction_description;
- public static String DebugToolBarAction_View_label;
- public static String DebugToolBarAction_View_tooltip;
- public static String DebugToolBarAction_View_description;
+ public static String DebugToolBarAction_View_label;
+ public static String DebugToolBarAction_View_tooltip;
+ public static String DebugToolBarAction_View_description;
static {
// load message values from bundle file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingCellModifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingCellModifier.java
index a48396771..9312bf799 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingCellModifier.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingCellModifier.java
@@ -40,16 +40,16 @@ import org.eclipse.swt.widgets.TableItem;
// to plug cell modifier in case the element is not MemorySegment
public class AsyncTableRenderingCellModifier implements ICellModifier {
- private AbstractAsyncTableRendering fRendering;
- private boolean fMBSupportsValueModification = false;
+ private AbstractAsyncTableRendering fRendering;
+ private boolean fMBSupportsValueModification = false;
- private ICellModifier fCustomModifier;
+ private ICellModifier fCustomModifier;
- public AsyncTableRenderingCellModifier(AbstractAsyncTableRendering rendering, ICellModifier customModifier) {
- fRendering = rendering;
- fCustomModifier = customModifier;
+ public AsyncTableRenderingCellModifier(AbstractAsyncTableRendering rendering, ICellModifier customModifier) {
+ fRendering = rendering;
+ fCustomModifier = customModifier;
- Job job = new Job("AsyncTableRenderingCellModifier"){ //$NON-NLS-1$
+ Job job = new Job("AsyncTableRenderingCellModifier"){ //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -58,126 +58,126 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
}};
job.setSystem(true);
job.schedule();
- }
+ }
- @Override
+ @Override
public boolean canModify(Object element, String property) {
- boolean canModify = true;
- try {
- if (!(element instanceof MemorySegment)) {
+ boolean canModify = true;
+ try {
+ if (!(element instanceof MemorySegment)) {
return false;
}
- if (!isValueModificationSupported()) {
- return false;
- }
-
- MemorySegment line = (MemorySegment) element;
- if (TableRenderingLine.P_ADDRESS.equals(property)) {
- return false;
- }
-
- // property is stored as number of addressable unit away from the
- // line address
- // to calculate offset to the memory line array, offset =
- // numberofAddressableUnit * addressableSize
- int addressableSize = getAddressableSize();
-
- int offset = Integer.valueOf(property, 16).intValue() * addressableSize;
-
- MemoryByte[] bytes = line.getBytes(offset, fRendering.getBytesPerColumn());
-
- if (fCustomModifier != null)
- {
- BigInteger address = line.getAddress().add(BigInteger.valueOf(offset));
- MemoryRenderingElement mElement = new MemoryRenderingElement(fRendering, address, bytes);
- return fCustomModifier.canModify(mElement, null);
- }
-
- for (int i = 0; i < bytes.length; i++) {
- if (!bytes[i].isWritable()) {
- canModify = false;
- }
- }
- return canModify;
- } catch (NumberFormatException e) {
- canModify = false;
- return canModify;
- }
- }
-
- /**
- * @return the rendering addressable size
- */
- private int getAddressableSize() {
- int addressableSize = fRendering.getAddressableSize();
- if (addressableSize < 1) {
+ if (!isValueModificationSupported()) {
+ return false;
+ }
+
+ MemorySegment line = (MemorySegment) element;
+ if (TableRenderingLine.P_ADDRESS.equals(property)) {
+ return false;
+ }
+
+ // property is stored as number of addressable unit away from the
+ // line address
+ // to calculate offset to the memory line array, offset =
+ // numberofAddressableUnit * addressableSize
+ int addressableSize = getAddressableSize();
+
+ int offset = Integer.valueOf(property, 16).intValue() * addressableSize;
+
+ MemoryByte[] bytes = line.getBytes(offset, fRendering.getBytesPerColumn());
+
+ if (fCustomModifier != null)
+ {
+ BigInteger address = line.getAddress().add(BigInteger.valueOf(offset));
+ MemoryRenderingElement mElement = new MemoryRenderingElement(fRendering, address, bytes);
+ return fCustomModifier.canModify(mElement, null);
+ }
+
+ for (int i = 0; i < bytes.length; i++) {
+ if (!bytes[i].isWritable()) {
+ canModify = false;
+ }
+ }
+ return canModify;
+ } catch (NumberFormatException e) {
+ canModify = false;
+ return canModify;
+ }
+ }
+
+ /**
+ * @return the rendering addressable size
+ */
+ private int getAddressableSize() {
+ int addressableSize = fRendering.getAddressableSize();
+ if (addressableSize < 1) {
addressableSize = 1;
}
- return addressableSize;
- }
+ return addressableSize;
+ }
- @Override
+ @Override
public Object getValue(Object element, String property) {
- // give back the value of the column
+ // give back the value of the column
- if (!(element instanceof MemorySegment)) {
+ if (!(element instanceof MemorySegment)) {
return null;
}
- MemorySegment line = (MemorySegment) element;
- try {
- if (TableRenderingLine.P_ADDRESS.equals(property)) {
+ MemorySegment line = (MemorySegment) element;
+ try {
+ if (TableRenderingLine.P_ADDRESS.equals(property)) {
return line.getAddress();
}
- int offsetToLineBuffer = Integer.valueOf(property, 16).intValue() * getAddressableSize();
- MemoryByte[] memory = line.getBytes(offsetToLineBuffer, fRendering.getBytesPerColumn());
+ int offsetToLineBuffer = Integer.valueOf(property, 16).intValue() * getAddressableSize();
+ MemoryByte[] memory = line.getBytes(offsetToLineBuffer, fRendering.getBytesPerColumn());
- int offsetFromLineAddress = Integer.valueOf(property, 16).intValue();
- BigInteger address = line.getAddress().add(BigInteger.valueOf(offsetFromLineAddress));
+ int offsetFromLineAddress = Integer.valueOf(property, 16).intValue();
+ BigInteger address = line.getAddress().add(BigInteger.valueOf(offsetFromLineAddress));
- if (fCustomModifier != null)
- {
- MemoryRenderingElement mElement = new MemoryRenderingElement(fRendering, address, memory);
- return fCustomModifier.getValue(mElement, null);
- }
+ if (fCustomModifier != null)
+ {
+ MemoryRenderingElement mElement = new MemoryRenderingElement(fRendering, address, memory);
+ return fCustomModifier.getValue(mElement, null);
+ }
- // ask the rendering for a string representation of the bytes
- return fRendering.getString(fRendering.getRenderingId(), address, memory);
+ // ask the rendering for a string representation of the bytes
+ return fRendering.getString(fRendering.getRenderingId(), address, memory);
- } catch (NumberFormatException e) {
- return "00"; //$NON-NLS-1$
- }
- }
+ } catch (NumberFormatException e) {
+ return "00"; //$NON-NLS-1$
+ }
+ }
- @Override
+ @Override
public void modify(Object element, final String property, final Object value) {
- MemorySegment segment = null;
- if (element instanceof TableItem) {
- Object data = ((TableItem)element).getData();
- if (data != null && data instanceof MemorySegment) {
+ MemorySegment segment = null;
+ if (element instanceof TableItem) {
+ Object data = ((TableItem)element).getData();
+ if (data != null && data instanceof MemorySegment) {
segment = (MemorySegment)data;
}
- } else if (element instanceof MemorySegment){
- segment = (MemorySegment) element;
- }
+ } else if (element instanceof MemorySegment){
+ segment = (MemorySegment) element;
+ }
- if (segment == null) {
+ if (segment == null) {
return;
}
- final MemorySegment line = segment;
+ final MemorySegment line = segment;
- Job job = new Job("Set Values"){ //$NON-NLS-1$
+ Job job = new Job("Set Values"){ //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- // calculate offset to update
+ // calculate offset to update
final IMemoryBlock memoryBlk = fRendering.getMemoryBlock();
// number of addressable units from the line's start address
@@ -198,7 +198,7 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
address = address.add(BigInteger.valueOf(offsetFromLineAddress));
if (fCustomModifier != null) {
- MemoryRenderingElement mElement = new MemoryRenderingElement(fRendering, address, oldArray);
+ MemoryRenderingElement mElement = new MemoryRenderingElement(fRendering, address, oldArray);
fCustomModifier.modify(mElement, null, value);
return Status.OK_STATUS;
}
@@ -209,77 +209,77 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
return Status.OK_STATUS;
}
- byte[] bytes = null;
- String oldValue = (String) getValue(line, property);
- if (!oldValue.equals(value)) {
- bytes = fRendering.getBytes(fRendering.getRenderingId(), address, oldArray, (String) value);
+ byte[] bytes = null;
+ String oldValue = (String) getValue(line, property);
+ if (!oldValue.equals(value)) {
+ bytes = fRendering.getBytes(fRendering.getRenderingId(), address, oldArray, (String) value);
- if (bytes == null) {
+ if (bytes == null) {
return Status.OK_STATUS;
}
- if (bytes.length == 0) {
+ if (bytes.length == 0) {
return Status.OK_STATUS;
}
- if (bytes.length <= oldArray.length) {
- boolean changed = false;
- // check that the bytes returned has actually changed
- for (int i = 0; i < bytes.length; i++) {
- if (bytes[i] != oldArray[i].getValue()) {
- changed = true;
- break;
- }
- }
- if (!changed) {
+ if (bytes.length <= oldArray.length) {
+ boolean changed = false;
+ // check that the bytes returned has actually changed
+ for (int i = 0; i < bytes.length; i++) {
+ if (bytes[i] != oldArray[i].getValue()) {
+ changed = true;
+ break;
+ }
+ }
+ if (!changed) {
return Status.OK_STATUS;
}
- }
- } else {
- // return if value has not changed
- return Status.OK_STATUS;
- }
+ }
+ } else {
+ // return if value has not changed
+ return Status.OK_STATUS;
+ }
- final byte[] newByteValues = bytes;
+ final byte[] newByteValues = bytes;
- if (memoryBlk instanceof IMemoryBlockExtension) {
+ if (memoryBlk instanceof IMemoryBlockExtension) {
((IMemoryBlockExtension) memoryBlk).setValue(offsetFromMBBase, newByteValues);
} else {
memoryBlk.setValue(offsetFromMBBase.longValue(), newByteValues);
}
- } catch (DebugException e) {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed, e);
- } catch (NumberFormatException e) {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed + "\n" + DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null); //$NON-NLS-1$
- }
- return Status.OK_STATUS;
+ } catch (DebugException e) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed, e);
+ } catch (NumberFormatException e) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed + "\n" + DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null); //$NON-NLS-1$
+ }
+ return Status.OK_STATUS;
}};
- job.setSystem(true);
- job.schedule();
- }
+ job.setSystem(true);
+ job.schedule();
+ }
- private BigInteger getOffset(IMemoryBlock memory, BigInteger lineAddress, int lineOffset) throws DebugException {
+ private BigInteger getOffset(IMemoryBlock memory, BigInteger lineAddress, int lineOffset) throws DebugException {
- BigInteger memoryAddr;
+ BigInteger memoryAddr;
- if (memory instanceof IMemoryBlockExtension) {
- memoryAddr = ((IMemoryBlockExtension) memory).getBigBaseAddress();
- } else {
- memoryAddr = BigInteger.valueOf(memory.getStartAddress());
- }
+ if (memory instanceof IMemoryBlockExtension) {
+ memoryAddr = ((IMemoryBlockExtension) memory).getBigBaseAddress();
+ } else {
+ memoryAddr = BigInteger.valueOf(memory.getStartAddress());
+ }
- if (memoryAddr == null)
+ if (memoryAddr == null)
{
memoryAddr = new BigInteger("0"); //$NON-NLS-1$
}
- return lineAddress.subtract(memoryAddr).add(BigInteger.valueOf(lineOffset));
- }
+ return lineAddress.subtract(memoryAddr).add(BigInteger.valueOf(lineOffset));
+ }
- private boolean isValueModificationSupported()
- {
- return fMBSupportsValueModification;
- }
+ private boolean isValueModificationSupported()
+ {
+ return fMBSupportsValueModification;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
index bdb80ff7d..cf12bcc2b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java
@@ -310,7 +310,7 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
private synchronized void attemptSetKeySelection()
{
if (fPendingSelection != null) {
- doAttemptSetKeySelection(fPendingSelection);
+ doAttemptSetKeySelection(fPendingSelection);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java
index e0617e1b9..4db332fb7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java
@@ -96,7 +96,7 @@ public class CreateRendering extends AbstractMemoryRendering implements IMemoryR
String label = ((IMemoryRenderingType)element).getLabel();
return label;
}
- return element.toString();
+ return element.toString();
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
index 3ee45d4db..c3e126253 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
@@ -47,7 +47,7 @@ import org.eclipse.ui.PlatformUI;
*/
public class GoToAddressAction extends Action
{
- private IMemoryRenderingContainer fContainer;
+ private IMemoryRenderingContainer fContainer;
private IRepositionableMemoryRendering fRendering;
public GoToAddressAction(IMemoryRenderingContainer container, IRepositionableMemoryRendering rendering)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRendering.java
index 5c811e18f..53280662e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRendering.java
@@ -38,13 +38,13 @@ public class HexIntegerRendering extends AbstractIntegerRendering {
String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
- if (endianess == RenderingsUtil.LITTLE_ENDIAN) {
- MemoryByte[] swapped = new MemoryByte[data.length];
- for (int i = 0; i < data.length; i++){
- swapped[data.length-i-1] = data[i];
- }
- data = swapped;
- }
+ if (endianess == RenderingsUtil.LITTLE_ENDIAN) {
+ MemoryByte[] swapped = new MemoryByte[data.length];
+ for (int i = 0; i < data.length; i++){
+ swapped[data.length-i-1] = data[i];
+ }
+ data = swapped;
+ }
for (int i=0; i<data.length; i++)
{
@@ -62,20 +62,20 @@ public class HexIntegerRendering extends AbstractIntegerRendering {
return strBuffer.toString().toUpperCase();
}
- /**
- * @todo davidp needs to add a method comment.
- * @param data
- * @return
- */
- private int getEndianness (MemoryByte[] data) {
- // if the user has not set an endianess to the rendering
- // take default
- int endianess = getDisplayEndianess();
- if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN) {
+ /**
+ * @todo davidp needs to add a method comment.
+ * @param data
+ * @return
+ */
+ private int getEndianness (MemoryByte[] data) {
+ // if the user has not set an endianess to the rendering
+ // take default
+ int endianess = getDisplayEndianess();
+ if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN) {
endianess = getBytesEndianess(data);
}
- return endianess;
- }
+ return endianess;
+ }
@Override
public byte[] getBytes(String dataType, BigInteger address,
@@ -85,13 +85,13 @@ public class HexIntegerRendering extends AbstractIntegerRendering {
byte[] bytes = RenderingsUtil.convertHexStringToByteArray(data, currentValues.length, getNumCharsPerByte());
- if (endianess == RenderingsUtil.LITTLE_ENDIAN) {
- byte[] swapped = new byte[bytes.length];
- for (int i = 0; i < bytes.length; i++){
- swapped[bytes.length-i-1] = bytes[i];
- }
- bytes = swapped;
- }
+ if (endianess == RenderingsUtil.LITTLE_ENDIAN) {
+ byte[] swapped = new byte[bytes.length];
+ for (int i = 0; i < bytes.length; i++){
+ swapped[bytes.length-i-1] = bytes[i];
+ }
+ bytes = swapped;
+ }
return bytes;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java
index 5e64ee17d..b39ea5133 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java
@@ -53,23 +53,23 @@ public class RenderingsUtil {
array = temp;
return array;
}
- byte[] temp = new byte[size];
-
- for (int i=0; i<size - array.length; i++)
- {
- temp[i] = 0;
- }
-
- int j=0;
- // fill up the rest of the array
- for (int i=size - array.length; i<size; i++)
- {
- temp[i] = array[j];
- j++;
- }
-
- array = temp;
- return array;
+ byte[] temp = new byte[size];
+
+ for (int i=0; i<size - array.length; i++)
+ {
+ temp[i] = 0;
+ }
+
+ int j=0;
+ // fill up the rest of the array
+ for (int i=size - array.length; i<size; i++)
+ {
+ temp[i] = array[j];
+ j++;
+ }
+
+ array = temp;
+ return array;
}
static public BigInteger convertByteArrayToUnsignedLong(byte[] array, int endianess)
@@ -130,15 +130,15 @@ public class RenderingsUtil {
}
return value;
}
- long value = 0;
- for (int i=0; i< 8; i++)
- {
- long b = array[i];
- b &= 0xff;
- value |= (b<<((7-i)*8));
- }
+ long value = 0;
+ for (int i=0; i< 8; i++)
+ {
+ long b = array[i];
+ b &= 0xff;
+ value |= (b<<((7-i)*8));
+ }
- return value;
+ return value;
}
static public BigInteger convertByteArrayToSignedBigInt(byte[] array, int endianess)
@@ -162,8 +162,8 @@ public class RenderingsUtil {
BigInteger value = new BigInteger(holder);
return value;
}
- BigInteger value = new BigInteger(array);
- return value;
+ BigInteger value = new BigInteger(array);
+ return value;
}
static public BigInteger convertByteArrayToSignedBigInt(byte[] array, int endianess, int arraySize)
@@ -187,8 +187,8 @@ public class RenderingsUtil {
BigInteger value = new BigInteger(holder);
return value;
}
- BigInteger value = new BigInteger(array);
- return value;
+ BigInteger value = new BigInteger(array);
+ return value;
}
static public BigInteger convertByteArrayToUnsignedBigInt(byte[] array, int endianess)
@@ -284,15 +284,15 @@ public class RenderingsUtil {
}
return value;
}
- int value = 0;
- for (int i=0; i< 4; i++)
- {
- int b = array[i];
- b &= 0xff;
- value |= (b<<((3-i)*8));
- }
+ int value = 0;
+ for (int i=0; i< 4; i++)
+ {
+ int b = array[i];
+ b &= 0xff;
+ value |= (b<<((3-i)*8));
+ }
- return value;
+ return value;
}
/**
@@ -318,14 +318,14 @@ public class RenderingsUtil {
}
return value;
}
- short value = 0;
- for (int i=0; i< 2; i++)
- {
- short b = array[i];
- b &= 0xff;
- value |= (b<<((1-i)*8));
- }
- return value;
+ short value = 0;
+ for (int i=0; i< 2; i++)
+ {
+ short b = array[i];
+ b &= 0xff;
+ value |= (b<<((1-i)*8));
+ }
+ return value;
}
/**
@@ -347,12 +347,12 @@ public class RenderingsUtil {
}
return buf;
}
- for (int j=15; j>=0; j--)
- {
- BigInteger x = i.shiftRight((15-j)*8);
- buf[j] = x.byteValue();
- }
- return buf;
+ for (int j=15; j>=0; j--)
+ {
+ BigInteger x = i.shiftRight((15-j)*8);
+ buf[j] = x.byteValue();
+ }
+ return buf;
}
static public byte[] convertSignedBigIntToByteArray(BigInteger i, int endianess, int arraySize)
@@ -368,12 +368,12 @@ public class RenderingsUtil {
}
return buf;
}
- for (int j=arraySize-1; j>=0; j--)
- {
- BigInteger x = i.shiftRight((arraySize-1-j)*8);
- buf[j] = x.byteValue();
- }
- return buf;
+ for (int j=arraySize-1; j>=0; j--)
+ {
+ BigInteger x = i.shiftRight((arraySize-1-j)*8);
+ buf[j] = x.byteValue();
+ }
+ return buf;
}
/**
@@ -395,12 +395,12 @@ public class RenderingsUtil {
}
return buf;
}
- for (int j=31; j>=0; j--)
- {
- BigInteger x = i.shiftRight((31-j)*8);
- buf[j] = x.byteValue();
- }
- return buf;
+ for (int j=31; j>=0; j--)
+ {
+ BigInteger x = i.shiftRight((31-j)*8);
+ buf[j] = x.byteValue();
+ }
+ return buf;
}
static public byte[] convertUnsignedBigIntToByteArray(BigInteger i, int endianess, int arraySize)
@@ -416,12 +416,12 @@ public class RenderingsUtil {
}
return buf;
}
- for (int j=(arraySize*2)-1; j>=0; j--)
- {
- BigInteger x = i.shiftRight(((arraySize*2)-1-j)*8);
- buf[j] = x.byteValue();
- }
- return buf;
+ for (int j=(arraySize*2)-1; j>=0; j--)
+ {
+ BigInteger x = i.shiftRight(((arraySize*2)-1-j)*8);
+ buf[j] = x.byteValue();
+ }
+ return buf;
}
/**
@@ -442,11 +442,11 @@ public class RenderingsUtil {
}
return buf;
}
- for (int j=7; j>=0; j--)
- {
- buf[j] = Long.valueOf(i>>(7-j)*8).byteValue();
- }
- return buf;
+ for (int j=7; j>=0; j--)
+ {
+ buf[j] = Long.valueOf(i>>(7-j)*8).byteValue();
+ }
+ return buf;
}
/**
@@ -539,17 +539,17 @@ public class RenderingsUtil {
*/
public static byte[] convertHexStringToByteArray(String str, int numBytes, int numCharsPerByte) throws NumberFormatException
{
- if (str.length() == 0)
- return null;
+ if (str.length() == 0)
+ return null;
StringBuilder buf = new StringBuilder(str);
- // pad string with zeros
- int requiredPadding = numBytes * numCharsPerByte - str.length();
- while (requiredPadding > 0) {
- buf.insert(0, "0"); //$NON-NLS-1$
- requiredPadding--;
- }
+ // pad string with zeros
+ int requiredPadding = numBytes * numCharsPerByte - str.length();
+ while (requiredPadding > 0) {
+ buf.insert(0, "0"); //$NON-NLS-1$
+ requiredPadding--;
+ }
byte[] bytes = new byte[numBytes];
str = buf.toString();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingCellModifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingCellModifier.java
index c1b8e826a..c88de3fff 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingCellModifier.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingCellModifier.java
@@ -33,229 +33,229 @@ import org.eclipse.swt.widgets.TableItem;
*/
public class TableRenderingCellModifier implements ICellModifier {
- private boolean editActionInvoked = false;
+ private boolean editActionInvoked = false;
- private AbstractTableRendering fRendering;
+ private AbstractTableRendering fRendering;
- public TableRenderingCellModifier(AbstractTableRendering rendering) {
- fRendering = rendering;
- }
+ public TableRenderingCellModifier(AbstractTableRendering rendering) {
+ fRendering = rendering;
+ }
- @Override
+ @Override
public boolean canModify(Object element, String property) {
- boolean canModify = true;
- try {
- if (!(element instanceof TableRenderingLine)) {
+ boolean canModify = true;
+ try {
+ if (!(element instanceof TableRenderingLine)) {
return false;
}
- if (!editActionInvoked) {
+ if (!editActionInvoked) {
return false;
}
- if (fRendering == null) {
+ if (fRendering == null) {
return false;
}
- if (fRendering.getMemoryBlock().supportsValueModification() == false) {
- return false;
- }
-
- TableRenderingLine line = (TableRenderingLine) element;
- if (TableRenderingLine.P_ADDRESS.equals(property)) {
- return false;
- }
-
- // property is stored as number of addressable unit away from the
- // line address
- // to calculate offset to the memory line array, offset =
- // numberofAddressableUnit * addressableSize
- int addressableSize = getAddressableSize();
-
- int offset = Integer.valueOf(property, 16).intValue() * addressableSize;
- int end = offset + fRendering.getBytesPerColumn();
-
- for (int i = offset; i < end; i++) {
- MemoryByte oneByte = line.getByte(i);
-
- if (!oneByte.isWritable()) {
- canModify = false;
- }
- }
- return canModify;
- } catch (NumberFormatException e) {
- canModify = false;
- return canModify;
- }
- }
-
- /**
- * @return
- */
- private int getAddressableSize() {
- int addressableSize = fRendering.getAddressableSize();
- if (addressableSize < 1) {
+ if (fRendering.getMemoryBlock().supportsValueModification() == false) {
+ return false;
+ }
+
+ TableRenderingLine line = (TableRenderingLine) element;
+ if (TableRenderingLine.P_ADDRESS.equals(property)) {
+ return false;
+ }
+
+ // property is stored as number of addressable unit away from the
+ // line address
+ // to calculate offset to the memory line array, offset =
+ // numberofAddressableUnit * addressableSize
+ int addressableSize = getAddressableSize();
+
+ int offset = Integer.valueOf(property, 16).intValue() * addressableSize;
+ int end = offset + fRendering.getBytesPerColumn();
+
+ for (int i = offset; i < end; i++) {
+ MemoryByte oneByte = line.getByte(i);
+
+ if (!oneByte.isWritable()) {
+ canModify = false;
+ }
+ }
+ return canModify;
+ } catch (NumberFormatException e) {
+ canModify = false;
+ return canModify;
+ }
+ }
+
+ /**
+ * @return
+ */
+ private int getAddressableSize() {
+ int addressableSize = fRendering.getAddressableSize();
+ if (addressableSize < 1) {
addressableSize = 1;
}
- return addressableSize;
- }
+ return addressableSize;
+ }
- @Override
+ @Override
public Object getValue(Object element, String property) {
- // give back the value of the column
+ // give back the value of the column
- if (!(element instanceof TableRenderingLine)) {
+ if (!(element instanceof TableRenderingLine)) {
return null;
}
- TableRenderingLine line = (TableRenderingLine) element;
- try {
- if (TableRenderingLine.P_ADDRESS.equals(property)) {
+ TableRenderingLine line = (TableRenderingLine) element;
+ try {
+ if (TableRenderingLine.P_ADDRESS.equals(property)) {
return line.getAddress();
}
- int offset = Integer.valueOf(property, 16).intValue() * getAddressableSize();
- int end = offset + fRendering.getBytesPerColumn();
+ int offset = Integer.valueOf(property, 16).intValue() * getAddressableSize();
+ int end = offset + fRendering.getBytesPerColumn();
- // Ask for label provider
- MemoryByte[] memory = line.getBytes(offset, end);
+ // Ask for label provider
+ MemoryByte[] memory = line.getBytes(offset, end);
- if (line.isAvailable(offset, end)) {
- // ask the renderer for a string representation of the bytes
- offset = Integer.valueOf(property, 16).intValue();
+ if (line.isAvailable(offset, end)) {
+ // ask the renderer for a string representation of the bytes
+ offset = Integer.valueOf(property, 16).intValue();
- BigInteger address = new BigInteger(((TableRenderingLine) element).getAddress(), 16);
- address = address.add(BigInteger.valueOf(offset));
+ BigInteger address = new BigInteger(((TableRenderingLine) element).getAddress(), 16);
+ address = address.add(BigInteger.valueOf(offset));
- return fRendering.getString(fRendering.getRenderingId(), address, memory);
- }
- // if the range is not available, just return padded string
- return getPaddedString(offset, end);
- } catch (NumberFormatException e) {
- return "00"; //$NON-NLS-1$
- }
- }
+ return fRendering.getString(fRendering.getRenderingId(), address, memory);
+ }
+ // if the range is not available, just return padded string
+ return getPaddedString(offset, end);
+ } catch (NumberFormatException e) {
+ return "00"; //$NON-NLS-1$
+ }
+ }
- @Override
+ @Override
public void modify(Object element, String property, Object value) {
- TableRenderingLine line = null;
- if (!(element instanceof TableRenderingLine)) {
- line = (TableRenderingLine) ((TableItem) element).getData();
- } else {
- line = (TableRenderingLine) element;
- }
-
- // validate data
- if (!(value instanceof String)) {
+ TableRenderingLine line = null;
+ if (!(element instanceof TableRenderingLine)) {
+ line = (TableRenderingLine) ((TableItem) element).getData();
+ } else {
+ line = (TableRenderingLine) element;
+ }
+
+ // validate data
+ if (!(value instanceof String)) {
return;
}
- try {
- // calculate offset to update
- IMemoryBlock memoryBlk = fRendering.getMemoryBlock();
+ try {
+ // calculate offset to update
+ IMemoryBlock memoryBlk = fRendering.getMemoryBlock();
- int lineOffset = Integer.valueOf(property, 16).intValue();
+ int lineOffset = Integer.valueOf(property, 16).intValue();
- // this offset is number of addressable unit from the line address
- BigInteger offset = getOffset(memoryBlk, line.getAddress(), lineOffset);
+ // this offset is number of addressable unit from the line address
+ BigInteger offset = getOffset(memoryBlk, line.getAddress(), lineOffset);
- byte[] bytes = null;
+ byte[] bytes = null;
- String oldValue = (String) getValue(line, property);
+ String oldValue = (String) getValue(line, property);
- if (!oldValue.equals(value)) {
+ if (!oldValue.equals(value)) {
- // property is number of addressable unit from line address
- // to calculate proper offset in the memoryViewLine's array
- // offset = numberOfAddressableUnit * addressableSize
- int offsetToLine = Integer.valueOf(property, 16).intValue() * getAddressableSize();
- int end = offsetToLine + fRendering.getBytesPerColumn();
+ // property is number of addressable unit from line address
+ // to calculate proper offset in the memoryViewLine's array
+ // offset = numberOfAddressableUnit * addressableSize
+ int offsetToLine = Integer.valueOf(property, 16).intValue() * getAddressableSize();
+ int end = offsetToLine + fRendering.getBytesPerColumn();
- MemoryByte[] oldArray = line.getBytes(offsetToLine, end);
+ MemoryByte[] oldArray = line.getBytes(offsetToLine, end);
- BigInteger address = new BigInteger(line.getAddress(), 16);
- address = address.add(BigInteger.valueOf(offsetToLine));
+ BigInteger address = new BigInteger(line.getAddress(), 16);
+ address = address.add(BigInteger.valueOf(offsetToLine));
- bytes = fRendering.getBytes(fRendering.getRenderingId(), address, oldArray, (String) value);
+ bytes = fRendering.getBytes(fRendering.getRenderingId(), address, oldArray, (String) value);
- if (bytes == null) {
+ if (bytes == null) {
return;
}
- if (bytes.length == 0) {
+ if (bytes.length == 0) {
return;
}
- if (bytes.length <= oldArray.length) {
- boolean changed = false;
- // check that the bytes returned has actually changed
- for (int i = 0; i < bytes.length; i++) {
- if (bytes[i] != oldArray[i].getValue()) {
- changed = true;
- break;
- }
- }
- if (!changed) {
+ if (bytes.length <= oldArray.length) {
+ boolean changed = false;
+ // check that the bytes returned has actually changed
+ for (int i = 0; i < bytes.length; i++) {
+ if (bytes[i] != oldArray[i].getValue()) {
+ changed = true;
+ break;
+ }
+ }
+ if (!changed) {
return;
}
- }
- } else {
- // return if value has not changed
- return;
- }
+ }
+ } else {
+ // return if value has not changed
+ return;
+ }
- if (memoryBlk instanceof IMemoryBlockExtension) {
+ if (memoryBlk instanceof IMemoryBlockExtension) {
((IMemoryBlockExtension) memoryBlk).setValue(offset, bytes);
} else {
memoryBlk.setValue(offset.longValue(), bytes);
}
- } catch (DebugException e) {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed, e);
- } catch (NumberFormatException e) {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed + "\n" + DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null); //$NON-NLS-1$
- }
+ } catch (DebugException e) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed, e);
+ } catch (NumberFormatException e) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title, DebugUIMessages.MemoryViewCellModifier_failed + "\n" + DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null); //$NON-NLS-1$
+ }
- }
+ }
- private BigInteger getOffset(IMemoryBlock memory, String lineAddress, int lineOffset) throws DebugException {
+ private BigInteger getOffset(IMemoryBlock memory, String lineAddress, int lineOffset) throws DebugException {
- BigInteger lineAddr = new BigInteger(lineAddress, 16);
- BigInteger memoryAddr;
+ BigInteger lineAddr = new BigInteger(lineAddress, 16);
+ BigInteger memoryAddr;
- if (memory instanceof IMemoryBlockExtension) {
- memoryAddr = ((IMemoryBlockExtension) memory).getBigBaseAddress();
- } else {
- memoryAddr = BigInteger.valueOf(memory.getStartAddress());
- }
+ if (memory instanceof IMemoryBlockExtension) {
+ memoryAddr = ((IMemoryBlockExtension) memory).getBigBaseAddress();
+ } else {
+ memoryAddr = BigInteger.valueOf(memory.getStartAddress());
+ }
- if (memoryAddr == null)
+ if (memoryAddr == null)
{
memoryAddr = new BigInteger("0"); //$NON-NLS-1$
}
- return lineAddr.subtract(memoryAddr).add(BigInteger.valueOf(lineOffset));
- }
-
- /**
- * @param editActionInvoked
- * The editActionInvoked to set.
- */
- public void setEditActionInvoked(boolean editActionInvoked) {
- this.editActionInvoked = editActionInvoked;
- }
-
- /**
- * @param start
- * @param end
- * @return padded string
- */
- public String getPaddedString(int start, int end) {
- StringBuilder buf = new StringBuilder();
- String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
- for (int i = start; i < end; i++) {
- buf.append(paddedStr);
- }
- return buf.toString();
- }
+ return lineAddr.subtract(memoryAddr).add(BigInteger.valueOf(lineOffset));
+ }
+
+ /**
+ * @param editActionInvoked
+ * The editActionInvoked to set.
+ */
+ public void setEditActionInvoked(boolean editActionInvoked) {
+ this.editActionInvoked = editActionInvoked;
+ }
+
+ /**
+ * @param start
+ * @param end
+ * @return padded string
+ */
+ public String getPaddedString(int start, int end) {
+ StringBuilder buf = new StringBuilder();
+ String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
+ for (int i = start; i < end; i++) {
+ buf.append(paddedStr);
+ }
+ return buf.toString();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java
index 9d0fec797..8f17f8989 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java
@@ -47,26 +47,26 @@ public class ModulesView extends VariablesView {
@Override
protected void configureToolBar(IToolBarManager tbm) {
- tbm.add(new Separator(this.getClass().getName()));
- tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
- tbm.add(getAction("CollapseAll")); //$NON-NLS-1$
- tbm.add( new Separator( IDebugUIConstants.MODULES_GROUP ) );
+ tbm.add(new Separator(this.getClass().getName()));
+ tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
+ tbm.add(getAction("CollapseAll")); //$NON-NLS-1$
+ tbm.add( new Separator( IDebugUIConstants.MODULES_GROUP ) );
}
- @Override
+ @Override
protected void fillContextMenu( IMenuManager menu ) {
- menu.add( new Separator( IDebugUIConstants.EMPTY_MODULES_GROUP ) );
- menu.add( new Separator( IDebugUIConstants.MODULES_GROUP ) );
- menu.add(getAction(FIND_ACTION));
- menu.add(new Separator());
- IAction action = new AvailableDetailPanesAction(this);
- if (isDetailPaneVisible() && action.isEnabled()) {
- menu.add(action);
- }
- menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
- menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
- menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
- }
+ menu.add( new Separator( IDebugUIConstants.EMPTY_MODULES_GROUP ) );
+ menu.add( new Separator( IDebugUIConstants.MODULES_GROUP ) );
+ menu.add(getAction(FIND_ACTION));
+ menu.add(new Separator());
+ IAction action = new AvailableDetailPanesAction(this);
+ if (isDetailPaneVisible() && action.isEnabled()) {
+ menu.add(action);
+ }
+ menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
+ menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
+ menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
+ }
@Override
protected String getDetailPanePreferenceKey() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesViewMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesViewMessages.java
index ca89e7d9f..f10a8bedd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesViewMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesViewMessages.java
@@ -20,7 +20,7 @@ import org.eclipse.osgi.util.NLS;
public class ModulesViewMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.modules.ModulesViewMessages";//$NON-NLS-1$
- public static String ModulesView_0;
+ public static String ModulesView_0;
public static String ModulesView_1;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java
index f8d76a38c..6c6b2630e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java
@@ -19,7 +19,7 @@ import org.eclipse.osgi.util.NLS;
public class RegistersViewMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.registers.RegistersViewMessages";//$NON-NLS-1$
- public static String RegistersView_0;
+ public static String RegistersView_0;
static {
// load message values from bundle file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java
index c032a0ea6..f5a5c9354 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java
@@ -95,20 +95,20 @@ public class AvailableLogicalStructuresAction extends Action implements IMenuCre
fMenu= new Menu(parent);
ILogicalStructureType[] types = getTypes();
- ILogicalStructureType enabledType = DebugPlugin.getDefaultStructureType(types);
+ ILogicalStructureType enabledType = DebugPlugin.getDefaultStructureType(types);
if (types != null && types.length > 0) {
for (int i = 0; i < types.length; i++) {
- ILogicalStructureType type= types[i];
+ ILogicalStructureType type= types[i];
Action action = new SelectLogicalStructureAction(getView(), type, getValue(), types);
action.setChecked((enabledType == type) && getView().isShowLogicalStructure());
- StringBuilder label= new StringBuilder();
- //add the numerical accelerator
- if (i < 9) {
- label.append('&');
- label.append(i + 1);
- label.append(' ');
- }
- label.append(action.getText());
+ StringBuilder label= new StringBuilder();
+ //add the numerical accelerator
+ if (i < 9) {
+ label.append('&');
+ label.append(i + 1);
+ label.append(' ');
+ }
+ label.append(action.getText());
if (enabledType == type) {
action.setText(label.toString() + " " + VariablesViewMessages.AvailableLogicalStructuresAction_2); //$NON-NLS-1$
} else {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/EditVariableLogicalStructureAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/EditVariableLogicalStructureAction.java
index 4dc0e525c..8950b9602 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/EditVariableLogicalStructureAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/EditVariableLogicalStructureAction.java
@@ -32,10 +32,10 @@ import org.eclipse.ui.dialogs.PreferencesUtil;
*/
public class EditVariableLogicalStructureAction extends Action {
- /**
- * The editable structure for the currently selected variable or
- * <code>null</code> if none.
- */
+ /**
+ * The editable structure for the currently selected variable or
+ * <code>null</code> if none.
+ */
private ILogicalStructureType fStructure = null;
private VariablesView fView = null;
@@ -49,12 +49,12 @@ public class EditVariableLogicalStructureAction extends Action {
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
+ }
- /**
- * Prompt the user to edit the logical structure associated with the currently
- * selected variable.
- */
+ /**
+ * Prompt the user to edit the logical structure associated with the currently
+ * selected variable.
+ */
@Override
public void run() {
PreferencesUtil.createPreferenceDialogOn(DebugUIPlugin.getShell(), "org.eclipse.jdt.debug.ui.JavaLogicalStructuresPreferencePage", //$NON-NLS-1$
@@ -64,37 +64,37 @@ public class EditVariableLogicalStructureAction extends Action {
"org.eclipse.jdt.debug.ui.JavaPrimitivesPreferencePage" }, (fStructure != null) //$NON-NLS-1$
? fStructure.getId() + fStructure.getDescription() + fStructure.hashCode()
: null).open();
- }
+ }
private void init(ISelection selection) {
- fStructure= null;
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof IVariable) {
- try {
- IValue value= ((IVariable) element).getValue();
- ILogicalStructureType type= getLogicalStructure(value);
+ fStructure= null;
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if (element instanceof IVariable) {
+ try {
+ IValue value= ((IVariable) element).getValue();
+ ILogicalStructureType type= getLogicalStructure(value);
fStructure = type;
- } catch (DebugException e) {
+ } catch (DebugException e) {
DebugUIPlugin.log(e.getStatus());
- }
- }
+ }
+ }
setEnabled(fView.isShowLogicalStructure());
- }
+ }
- /**
- * Returns the logical structure currently associated with the given
- * value or <code>null</code> if none.
- * @param value the value
- * @return the logical structure currently associated with the given
- * value or <code>null</code> if none.
- */
+ /**
+ * Returns the logical structure currently associated with the given
+ * value or <code>null</code> if none.
+ * @param value the value
+ * @return the logical structure currently associated with the given
+ * value or <code>null</code> if none.
+ */
private ILogicalStructureType getLogicalStructure(IValue value) {
- // This code is based on VariablesViewContentProvider#getLogicalValue(IValue)
- ILogicalStructureType type = null;
- ILogicalStructureType[] types = DebugPlugin.getLogicalStructureTypes(value);
- if (types.length > 0) {
- type= DebugPlugin.getDefaultStructureType(types);
- }
- return type;
- }
+ // This code is based on VariablesViewContentProvider#getLogicalValue(IValue)
+ ILogicalStructureType type = null;
+ ILogicalStructureType[] types = DebugPlugin.getLogicalStructureTypes(value);
+ if (types.length > 0) {
+ type= DebugPlugin.getDefaultStructureType(types);
+ }
+ return type;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java
index f7d8139f9..4b18fe3cc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java
@@ -27,8 +27,8 @@ import org.eclipse.swt.custom.BusyIndicator;
public class SelectLogicalStructureAction extends Action {
private VariablesView fView;
- private ILogicalStructureType fType;
- private ILogicalStructureType[] fAvailableTypes;
+ private ILogicalStructureType fType;
+ private ILogicalStructureType[] fAvailableTypes;
/**
*
@@ -36,12 +36,12 @@ public class SelectLogicalStructureAction extends Action {
* @param type the type that this action will turn on/off
* @param value the value for which logical structures are to be chosen
* @param availableTypes the set of logical structure types that are being offered
- * to the user in addition to the type controlled by this action
+ * to the user in addition to the type controlled by this action
*/
public SelectLogicalStructureAction(VariablesView view, ILogicalStructureType type, IValue value, ILogicalStructureType[] availableTypes) {
super(type.getDescription(value), IAction.AS_CHECK_BOX);
setView(view);
- fAvailableTypes= availableTypes;
+ fAvailableTypes= availableTypes;
fType= type;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectionDragAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectionDragAdapter.java
index eac9916cb..109f4c3f9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectionDragAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectionDragAdapter.java
@@ -32,44 +32,44 @@ import org.eclipse.swt.dnd.Transfer;
*/
public class SelectionDragAdapter extends DragSourceAdapter implements TransferDragSourceListener {
- /**
- * The associated viewer for the adapter
- */
- private TreeModelViewer fViewer;
+ /**
+ * The associated viewer for the adapter
+ */
+ private TreeModelViewer fViewer;
- /**
- * Constructor, takes the viewer that contains the selection provider
- * @param view the associated view, <b>must</b> implement <code>ISelectionProvider</code>
- */
- public SelectionDragAdapter(TreeModelViewer viewer) {
- Assert.isNotNull(viewer);
- fViewer = viewer;
- }
+ /**
+ * Constructor, takes the viewer that contains the selection provider
+ * @param view the associated view, <b>must</b> implement <code>ISelectionProvider</code>
+ */
+ public SelectionDragAdapter(TreeModelViewer viewer) {
+ Assert.isNotNull(viewer);
+ fViewer = viewer;
+ }
- @Override
+ @Override
public Transfer getTransfer() {
- return LocalSelectionTransfer.getTransfer();
- }
+ return LocalSelectionTransfer.getTransfer();
+ }
- @Override
+ @Override
public void dragStart(DragSourceEvent event) {
- ISelection selection = fViewer.getSelection();
- LocalSelectionTransfer.getTransfer().setSelection(selection);
- LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL);
- event.doit = !selection.isEmpty();
- }
+ ISelection selection = fViewer.getSelection();
+ LocalSelectionTransfer.getTransfer().setSelection(selection);
+ LocalSelectionTransfer.getTransfer().setSelectionSetTime(event.time & 0xFFFFFFFFL);
+ event.doit = !selection.isEmpty();
+ }
- @Override
+ @Override
public void dragSetData(DragSourceEvent event) {
- // For consistency set the data to the selection even though
- // the selection is provided by the LocalSelectionTransfer
- // to the drop target adapter.
- event.data = LocalSelectionTransfer.getTransfer().getSelection();
- }
+ // For consistency set the data to the selection even though
+ // the selection is provided by the LocalSelectionTransfer
+ // to the drop target adapter.
+ event.data = LocalSelectionTransfer.getTransfer().getSelection();
+ }
- @Override
+ @Override
public void dragFinished(DragSourceEvent event) {
- LocalSelectionTransfer.getTransfer().setSelection(null);
- LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
- }
+ LocalSelectionTransfer.getTransfer().setSelection(null);
+ LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
index 348e59a05..ae9dfed9e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
@@ -297,7 +297,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
@Override
public void viewerInputComplete(IViewerInputUpdate update) {
if (!update.isCanceled()) {
- viewerInputUpdateComplete(update);
+ viewerInputUpdateComplete(update);
}
}
};
@@ -313,7 +313,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
private ToggleDetailPaneAction[] fToggleDetailPaneActions;
private ConfigureColumnsAction fConfigureColumnsAction;
- protected String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
+ protected String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
public static final String LOGICAL_STRUCTURE_TYPE_PREFIX = "VAR_LS_"; //$NON-NLS-1$
@@ -339,16 +339,16 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
protected static final String DETAIL_PANE_TYPE = "DETAIL_PANE_TYPE"; //$NON-NLS-1$
- /**
- * Visits deltas to determine if details should be displayed
- */
- class Visitor implements IModelDeltaVisitor {
- /**
- * Whether to trigger details display.
- *
- * @since 3.3
- */
- private boolean fTriggerDetails = false;
+ /**
+ * Visits deltas to determine if details should be displayed
+ */
+ class Visitor implements IModelDeltaVisitor {
+ /**
+ * Whether to trigger details display.
+ *
+ * @since 3.3
+ */
+ private boolean fTriggerDetails = false;
@Override
public boolean visit(IModelDelta delta, int depth) {
if ((delta.getFlags() & IModelDelta.CONTENT) > 0) {
@@ -366,16 +366,16 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
return fTriggerDetails;
}
- }
- /**
- * Delta visitor
- */
- private Visitor fVisitor = new Visitor();
+ }
+ /**
+ * Delta visitor
+ */
+ private Visitor fVisitor = new Visitor();
- /**
- * Job to update details in the UI thread.
- */
- private Job fTriggerDetailsJob = new UIJob("trigger details") { //$NON-NLS-1$
+ /**
+ * Job to update details in the UI thread.
+ */
+ private Job fTriggerDetailsJob = new UIJob("trigger details") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
@@ -406,7 +406,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
@Override
public void dispose() {
- DebugUITools.removePartDebugContextListener(getSite(), this);
+ DebugUITools.removePartDebugContextListener(getSite(), this);
getSite().getWorkbenchWindow().removePerspectiveListener(this);
DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
JFaceResources.getFontRegistry().removeListener(this);
@@ -416,14 +416,14 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
viewer.removeViewerUpdateListener(this);
}
if (fPresentationContext != null) {
- fPresentationContext.dispose();
- fPresentationContext = null;
+ fPresentationContext.dispose();
+ fPresentationContext = null;
}
if (fDetailPane != null) {
fDetailPane.dispose();
}
- fInputService.dispose();
- fSelectionProvider.dispose();
+ fInputService.dispose();
+ fSelectionProvider.dispose();
super.dispose();
}
@@ -435,8 +435,8 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @param update Completed viewer input update.
*/
protected void viewerInputUpdateComplete(IViewerInputUpdate update) {
- setViewerInput(update.getInputElement());
- updateAction(FIND_ACTION);
+ setViewerInput(update.getInputElement());
+ updateAction(FIND_ACTION);
}
/**
@@ -444,24 +444,24 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @param context the object context
*/
protected void setViewerInput(Object context) {
- if (context == null) {
- // Clear the detail pane
- refreshDetailPaneContents();
- }
+ if (context == null) {
+ // Clear the detail pane
+ refreshDetailPaneContents();
+ }
- Object current = getViewer().getInput();
+ Object current = getViewer().getInput();
- if (current == null && context == null) {
- return;
- }
+ if (current == null && context == null) {
+ return;
+ }
- if (current != null && current.equals(context)) {
- return;
- }
+ if (current != null && current.equals(context)) {
+ return;
+ }
- showViewer();
- getViewer().setInput(context);
- updateObjects();
+ showViewer();
+ getViewer().setInput(context);
+ updateObjects();
}
@Override
@@ -521,39 +521,39 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
variablesViewer.addModelChangedListener(this);
variablesViewer.addViewerUpdateListener(this);
- initDragAndDrop(variablesViewer);
+ initDragAndDrop(variablesViewer);
return variablesViewer;
}
- /**
- * Initializes the drag and/or drop adapters for this view. Called from createViewer().
- *
- * @param viewer the viewer to add drag/drop support to.
- * @since 3.4
- */
- protected void initDragAndDrop(TreeModelViewer viewer) {
- // Drag only
- viewer.addDragSupport(DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer));
- }
+ /**
+ * Initializes the drag and/or drop adapters for this view. Called from createViewer().
+ *
+ * @param viewer the viewer to add drag/drop support to.
+ * @since 3.4
+ */
+ protected void initDragAndDrop(TreeModelViewer viewer) {
+ // Drag only
+ viewer.addDragSupport(DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer));
+ }
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
PREF_STATE_MEMENTO = PREF_STATE_MEMENTO + site.getId();
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- String string = store.getString(PREF_STATE_MEMENTO);
- if(string.length() > 0) {
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ String string = store.getString(PREF_STATE_MEMENTO);
+ if(string.length() > 0) {
try (ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes()); InputStreamReader reader = new InputStreamReader(bin);) {
- XMLMemento stateMemento = XMLMemento.createReadRoot(reader);
- setMemento(stateMemento);
- } catch (WorkbenchException e) {
+ XMLMemento stateMemento = XMLMemento.createReadRoot(reader);
+ setMemento(stateMemento);
+ } catch (WorkbenchException e) {
} catch (IOException e1) {
}
- }
- IMemento mem = getMemento();
- // check the weights to makes sure they are valid -- bug 154025
- setLastSashWeights(DEFAULT_SASH_WEIGHTS);
+ }
+ IMemento mem = getMemento();
+ // check the weights to makes sure they are valid -- bug 154025
+ setLastSashWeights(DEFAULT_SASH_WEIGHTS);
if (mem != null) {
int[] weights = getWeights(mem);
if (weights != null) {
@@ -561,7 +561,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
}
site.getWorkbenchWindow().addPerspectiveListener(this);
- }
+ }
/**
* Returns sash weights stored in the given memento or <code>null</code> if none.
@@ -584,7 +584,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
return null;
}
- @Override
+ @Override
public void partDeactivated(IWorkbenchPart part) {
String id = part.getSite().getId();
if (id.equals(getSite().getId())) {
@@ -608,7 +608,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
public void saveViewerState(IMemento memento) {
if (fSashForm != null && !fSashForm.isDisposed()) {
- int[] weights = fSashForm.getWeights();
+ int[] weights = fSashForm.getWeights();
memento.putInteger(SASH_VIEW_PART, weights[0]);
memento.putInteger(SASH_DETAILS_PART, weights[1]);
}
@@ -643,10 +643,10 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
@Override
public void focusLost(FocusEvent e){
- // Do not reset the selection provider with the provider proxy.
- // This should allow toolbar actions to remain active when the view
- // is de-activated but still visible.
- // Bug 316850.
+ // Do not reset the selection provider with the provider proxy.
+ // This should allow toolbar actions to remain active when the view
+ // is de-activated but still visible.
+ // Bug 316850.
clearGlobalActions();
getViewSite().getActionBars().updateActionBars();
}
@@ -717,7 +717,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @since 3.7
*/
protected ISelection getDebugContext() {
- IViewSite site = (IViewSite)getSite();
+ IViewSite site = (IViewSite)getSite();
IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
return contextService.getActiveContext(site.getId(), site.getSecondaryId());
}
@@ -1062,7 +1062,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
tbm.add(getAction(COLLAPSE_ALL));
}
- /**
+ /**
* Adds items to the tree viewer's context menu including any extension defined
* actions.
*
@@ -1075,7 +1075,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
menu.add(getAction(FIND_ACTION));
ChangeVariableValueAction changeValueAction = (ChangeVariableValueAction)getAction("ChangeVariableValue"); //$NON-NLS-1$
if (changeValueAction.isApplicable()) {
- menu.add(changeValueAction);
+ menu.add(changeValueAction);
}
menu.add(new Separator());
IAction action = new AvailableLogicalStructuresAction(this);
@@ -1091,31 +1091,31 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
- /**
+ /**
* Lazily instantiate and return a selection listener that populates the detail pane,
* but only if the detail is currently visible.
*
* @return Created selection listener
*/
- protected ISelectionChangedListener getTreeSelectionChangedListener() {
- if (fTreeSelectionChangedListener == null) {
- fTreeSelectionChangedListener = new ISelectionChangedListener() {
- @Override
+ protected ISelectionChangedListener getTreeSelectionChangedListener() {
+ if (fTreeSelectionChangedListener == null) {
+ fTreeSelectionChangedListener = new ISelectionChangedListener() {
+ @Override
public void selectionChanged(final SelectionChangedEvent event) {
- if (event.getSelectionProvider().equals(getViewer())) {
- clearStatusLine();
- // if the detail pane is not visible, don't waste time retrieving details
- if (fSashForm.getMaximizedControl() == getViewer().getControl()) {
- return;
- }
- refreshDetailPaneContents();
- treeSelectionChanged(event);
- }
- }
- };
- }
- return fTreeSelectionChangedListener;
- }
+ if (event.getSelectionProvider().equals(getViewer())) {
+ clearStatusLine();
+ // if the detail pane is not visible, don't waste time retrieving details
+ if (fSashForm.getMaximizedControl() == getViewer().getControl()) {
+ return;
+ }
+ refreshDetailPaneContents();
+ treeSelectionChanged(event);
+ }
+ }
+ };
+ }
+ return fTreeSelectionChangedListener;
+ }
/**
* Selection in the variable tree changed. Perform any updates.
@@ -1322,7 +1322,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @param flag If true, turns the logical structures on.
*/
public void setShowLogicalStructure(boolean flag) {
- getPresentationContext().setProperty(PRESENTATION_SHOW_LOGICAL_STRUCTURES, Boolean.valueOf(flag));
+ getPresentationContext().setProperty(PRESENTATION_SHOW_LOGICAL_STRUCTURES, Boolean.valueOf(flag));
}
/**
@@ -1336,7 +1336,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
@Override
protected void becomesHidden() {
- fInputService.resolveViewerInput(ViewerInputService.NULL_INPUT);
+ fInputService.resolveViewerInput(ViewerInputService.NULL_INPUT);
super.becomesHidden();
}
@@ -1381,7 +1381,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
delta.accept(fVisitor);
updateAction(FIND_ACTION);
- updateAction(COLLAPSE_ALL);
+ updateAction(COLLAPSE_ALL);
}
@Override
@@ -1394,8 +1394,8 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
showViewer();
}
if (TreePath.EMPTY.equals(update.getElementPath())) {
- updateAction(FIND_ACTION);
- updateAction(COLLAPSE_ALL);
+ updateAction(FIND_ACTION);
+ updateAction(COLLAPSE_ALL);
}
}
}
@@ -1407,11 +1407,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
@Override
public synchronized void viewerUpdatesBegin() {
fTriggerDetailsJob.cancel();
- IWorkbenchSiteProgressService progressService =
- getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (progressService != null) {
- progressService.incrementBusy();
- }
+ IWorkbenchSiteProgressService progressService =
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ if (progressService != null) {
+ progressService.incrementBusy();
+ }
}
@Override
@@ -1419,11 +1419,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
if (fVisitor.isTriggerDetails()) {
fTriggerDetailsJob.schedule();
}
- IWorkbenchSiteProgressService progressService =
- getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (progressService != null) {
- progressService.decrementBusy();
- }
+ IWorkbenchSiteProgressService progressService =
+ getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ if (progressService != null) {
+ progressService.decrementBusy();
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java
index 52efea39d..41a811c51 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java
@@ -109,12 +109,12 @@ public class AvailableDetailPanesAction extends Action implements IMenuCreator {
for (String currentID : fAvailableIDs) {
StringBuilder name = new StringBuilder();
//add the numerical accelerator
- i++;
+ i++;
if (i < 9) {
- name.append('&');
- name.append(i);
- name.append(' ');
- }
+ name.append('&');
+ name.append(i);
+ name.append(' ');
+ }
String typeName = DetailPaneManager.getDefault().getNameFromID(currentID);
if (typeName != null && typeName.length() > 0){
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
index a6eda1fcf..fd18bf7b4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
@@ -214,15 +214,15 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
message = bp.getMarker().getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
} else if (element instanceof IBreakpointContainer) {
IBreakpointContainer c = (IBreakpointContainer) element;
- IAdaptable category = c.getCategory();
- if (category != null) {
- IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- message = adapter.getLabel(category);
- } else {
- message = c.getOrganizer().getLabel();
- }
- }
+ IAdaptable category = c.getCategory();
+ if (category != null) {
+ IWorkbenchAdapter adapter = category.getAdapter(IWorkbenchAdapter.class);
+ if (adapter != null) {
+ message = adapter.getLabel(category);
+ } else {
+ message = c.getOrganizer().getLabel();
+ }
+ }
}
// When selecting a index partition, clear the pane
if (val instanceof IndexedValuePartition) {
@@ -617,9 +617,9 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
textAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_DLCL_CONTENT_ASSIST));
PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_CONTENT_ASSIST_ACTION);
ActionHandler actionHandler = new ActionHandler(textAction);
- IHandlerService handlerService = getViewSite().getService(IHandlerService.class);
- fContentAssistActivation = handlerService.activateHandler(textAction.getActionDefinitionId(), actionHandler);
- setAction(DETAIL_CONTENT_ASSIST_ACTION, textAction);
+ IHandlerService handlerService = getViewSite().getService(IHandlerService.class);
+ fContentAssistActivation = handlerService.activateHandler(textAction.getActionDefinitionId(), actionHandler);
+ setAction(DETAIL_CONTENT_ASSIST_ACTION, textAction);
textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.SELECT_ALL);
textAction.configureAction(DetailMessages.DefaultDetailPane_Select__All_5, IInternalDebugCoreConstants.EMPTY_STRING,IInternalDebugCoreConstants.EMPTY_STRING);
@@ -751,13 +751,13 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
}
}
- synchronized (this) {
- if (fDetailJob != null) {
- fDetailJob.cancel();
- }
+ synchronized (this) {
+ if (fDetailJob != null) {
+ fDetailJob.cancel();
+ }
fDetailJob = new DetailJob(selection,fModelPresentation);
fDetailJob.schedule();
- }
+ }
}
@@ -792,8 +792,8 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
}
if (fContentAssistActivation != null){
IHandlerService service = getViewSite().getService(IHandlerService.class);
- service.deactivateHandler(fContentAssistActivation);
- fContentAssistActivation = null;
+ service.deactivateHandler(fContentAssistActivation);
+ fContentAssistActivation = null;
}
disposeUndoRedoAction(ITextEditorActionConstants.UNDO);
@@ -873,12 +873,12 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
}
}
- if (svc == null) {
+ if (svc == null) {
svc = new SourceViewerConfiguration();
fSourceViewer.setEditable(false);
}
- fSourceViewer.unconfigure();
- fSourceViewer.configure(svc);
+ fSourceViewer.unconfigure();
+ fSourceViewer.configure(svc);
//update actions that depend on the configuration of the source viewer
if (isInView()){
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
index 4c9b71a58..5c41204b1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
@@ -258,12 +258,12 @@ public class DetailPaneManager {
*/
private List<DetailPaneFactoryExtension> fKnownFactories;
- /**
- * Preference key for storing the preferred detail panes map.
- * @see #storePreferredDetailsAreas()
- * @see #loadPreferredDetailsAreas()
- */
- public static final String PREF_DETAIL_AREAS = "preferredDetailPanes"; //$NON-NLS-1$
+ /**
+ * Preference key for storing the preferred detail panes map.
+ * @see #storePreferredDetailsAreas()
+ * @see #loadPreferredDetailsAreas()
+ */
+ public static final String PREF_DETAIL_AREAS = "preferredDetailPanes"; //$NON-NLS-1$
private DetailPaneManager(){
fFactoriesByPaneID = new HashMap<>();
@@ -488,59 +488,59 @@ public class DetailPaneManager {
}
- /**
- * Stores the map of preferred detail pane IDs to the preference store in the format:
- *
- * Key1A,Key1B:Value1|Key2A,Key2B,Key2C:Value2|
- *
- * Where the sub keys (Key1A, Key1B, etc.) are the elements of the set used at the
- * key in the mapping and the values are the associated String value in the mapping.
- */
- private void storePreferredDetailsAreas() {
- StringBuilder buffer= new StringBuilder();
+ /**
+ * Stores the map of preferred detail pane IDs to the preference store in the format:
+ *
+ * Key1A,Key1B:Value1|Key2A,Key2B,Key2C:Value2|
+ *
+ * Where the sub keys (Key1A, Key1B, etc.) are the elements of the set used at the
+ * key in the mapping and the values are the associated String value in the mapping.
+ */
+ private void storePreferredDetailsAreas() {
+ StringBuilder buffer= new StringBuilder();
for (Entry<Set<String>, String> entry : fPreferredDetailPanes.entrySet()) {
for (String currentID : entry.getKey()) {
buffer.append(currentID);
buffer.append(',');
}
- buffer.deleteCharAt(buffer.length()-1);
- buffer.append(':');
- buffer.append(entry.getValue());
- buffer.append('|');
- }
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
- if(node != null) {
- node.put(PREF_DETAIL_AREAS, buffer.toString());
- try {
+ buffer.deleteCharAt(buffer.length()-1);
+ buffer.append(':');
+ buffer.append(entry.getValue());
+ buffer.append('|');
+ }
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
+ if(node != null) {
+ node.put(PREF_DETAIL_AREAS, buffer.toString());
+ try {
node.flush();
} catch (BackingStoreException e) {
DebugUIPlugin.log(e);
}
- }
- }
-
- /**
- * Loads the map of preferred detail pane IDs from the preference store.
- *
- * @see #storePreferredDetailsAreas()
- */
- private void loadPreferredDetailsAreas() {
+ }
+ }
+
+ /**
+ * Loads the map of preferred detail pane IDs from the preference store.
+ *
+ * @see #storePreferredDetailsAreas()
+ */
+ private void loadPreferredDetailsAreas() {
fPreferredDetailPanes = new HashMap<>();
- String preferenceValue = Platform.getPreferencesService().getString(DebugUIPlugin.getUniqueIdentifier(),
- PREF_DETAIL_AREAS,
- "", //$NON-NLS-1$
- null);
- StringTokenizer entryTokenizer = new StringTokenizer(preferenceValue,"|"); //$NON-NLS-1$
- while (entryTokenizer.hasMoreTokens()){
- String token = entryTokenizer.nextToken();
- int valueStart = token.indexOf(':');
- StringTokenizer keyTokenizer = new StringTokenizer(token.substring(0,valueStart),","); //$NON-NLS-1$
+ String preferenceValue = Platform.getPreferencesService().getString(DebugUIPlugin.getUniqueIdentifier(),
+ PREF_DETAIL_AREAS,
+ "", //$NON-NLS-1$
+ null);
+ StringTokenizer entryTokenizer = new StringTokenizer(preferenceValue,"|"); //$NON-NLS-1$
+ while (entryTokenizer.hasMoreTokens()){
+ String token = entryTokenizer.nextToken();
+ int valueStart = token.indexOf(':');
+ StringTokenizer keyTokenizer = new StringTokenizer(token.substring(0,valueStart),","); //$NON-NLS-1$
Set<String> keys = new LinkedHashSet<>();
- while (keyTokenizer.hasMoreTokens()){
- keys.add(keyTokenizer.nextToken());
- }
- fPreferredDetailPanes.put(keys, token.substring(valueStart+1));
- }
- }
+ while (keyTokenizer.hasMoreTokens()){
+ keys.add(keyTokenizer.nextToken());
+ }
+ fPreferredDetailPanes.put(keys, token.substring(valueStart+1));
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java
index 2d24acb8a..79e0c9547 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java
@@ -32,80 +32,80 @@ import org.eclipse.jface.util.PropertyChangeEvent;
*/
public abstract class AbstractBreakpointOrganizerDelegate implements IBreakpointOrganizerDelegate {
- // property change listeners
+ // property change listeners
private ListenerList<IPropertyChangeListener> fListeners = new ListenerList<>();
- @Override
+ @Override
public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- // do noting, not supported by default
- }
+ // do noting, not supported by default
+ }
- @Override
+ @Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.add(listener);
- }
+ fListeners.add(listener);
+ }
/*
* Subclasses that override should return super.canAdd(...) when they are not
* able to add the breakpoint.
*/
- @Override
+ @Override
public boolean canAdd(IBreakpoint breakpoint, IAdaptable category) {
- return category instanceof OtherBreakpointCategory;
- }
+ return category instanceof OtherBreakpointCategory;
+ }
/*
* Subclasses that override should return super.canRemove(...) when they are not
* able to remove the breakpoint.
*/
- @Override
+ @Override
public boolean canRemove(IBreakpoint breakpoint, IAdaptable category) {
- return category instanceof OtherBreakpointCategory;
- }
+ return category instanceof OtherBreakpointCategory;
+ }
- @Override
+ @Override
public void dispose() {
fListeners = new ListenerList<>();
- }
+ }
- @Override
+ @Override
public void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- // do nothing, not supported by default
- }
+ // do nothing, not supported by default
+ }
- @Override
+ @Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.remove(listener);
- }
+ fListeners.remove(listener);
+ }
- /**
- * Fires a property change notification for the given category.
- *
- * @param category category that has changed
- */
- protected void fireCategoryChanged(IAdaptable category) {
- if (fListeners.isEmpty()) {
- return;
- }
- final PropertyChangeEvent event = new PropertyChangeEvent(this, P_CATEGORY_CHANGED, category, null);
+ /**
+ * Fires a property change notification for the given category.
+ *
+ * @param category category that has changed
+ */
+ protected void fireCategoryChanged(IAdaptable category) {
+ if (fListeners.isEmpty()) {
+ return;
+ }
+ final PropertyChangeEvent event = new PropertyChangeEvent(this, P_CATEGORY_CHANGED, category, null);
for (IPropertyChangeListener iPropertyChangeListener : fListeners) {
final IPropertyChangeListener listener = iPropertyChangeListener;
- ISafeRunnable runnable = new ISafeRunnable() {
- @Override
+ ISafeRunnable runnable = new ISafeRunnable() {
+ @Override
public void handleException(Throwable exception) {
- DebugUIPlugin.log(exception);
- }
- @Override
+ DebugUIPlugin.log(exception);
+ }
+ @Override
public void run() throws Exception {
- listener.propertyChange(event);
- }
- };
- SafeRunner.run(runnable);
- }
- }
+ listener.propertyChange(event);
+ }
+ };
+ SafeRunner.run(runnable);
+ }
+ }
- @Override
+ @Override
public IAdaptable[] getCategories() {
- return null;
- }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
index ea5438a74..073504821 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
@@ -678,7 +678,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
* Sets the viewer for this view.
*
* @param viewer viewer
- * @since 3.1
+ * @since 3.1
*/
protected void setViewer(Viewer viewer) {
fViewer = viewer;
@@ -789,7 +789,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
* Registers the given runnable with the display
* associated with this view's control, if any.
* @param r the {@link Runnable} to run
- *
+ *
* @see org.eclipse.swt.widgets.Display#syncExec(java.lang.Runnable)
*/
public void syncExec(Runnable r) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java
index 7a5199cd5..bc4e4fb6c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java
@@ -100,6 +100,6 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin
@Override
public String toString() {
- return fName;
+ return fName;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java
index 559197f64..9ac350da1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java
@@ -128,16 +128,16 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
private Text fSharedLocationText;
private Button fSharedLocationButton;
private Button fLaunchInBackgroundButton;
- private Button fDefaultEncodingButton;
- private Button fAltEncodingButton;
- private Combo fEncodingCombo;
+ private Button fDefaultEncodingButton;
+ private Button fAltEncodingButton;
+ private Combo fEncodingCombo;
private Button fConsoleOutput;
- private Button fFileOutput;
- private Button fFileBrowse;
- private Text fFileText;
- private Button fVariables;
- private Button fAppend;
- private Button fWorkspaceBrowse;
+ private Button fFileOutput;
+ private Button fFileBrowse;
+ private Text fFileText;
+ private Button fVariables;
+ private Button fAppend;
+ private Button fWorkspaceBrowse;
private Button fInputFileCheckButton;
private Text fInputFileLocationText;
@@ -160,7 +160,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
}
};
- /**
+ /**
* Constructs a new tab with default context help.
*/
public CommonTab() {
@@ -260,96 +260,96 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
setSharedEnabled(false);
}
- /**
- * Creates the component set for the capture output composite
- * @param parent the parent to add this component to
- */
+ /**
+ * Creates the component set for the capture output composite
+ * @param parent the parent to add this component to
+ */
private void createOutputCaptureComponent(Composite parent) {
- Group group = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_4, 5, 2, GridData.FILL_HORIZONTAL);
+ Group group = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_4, 5, 2, GridData.FILL_HORIZONTAL);
createInputCaptureComponent(group);
Composite comp = SWTFactory.createComposite(group, group.getFont(), 5, 5, GridData.FILL_BOTH, 0, 0);
fFileOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_6);
- fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false));
- fFileOutput.addSelectionListener(new SelectionAdapter() {
- @Override
+ fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false));
+ fFileOutput.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- enableOuputCaptureWidgets(fFileOutput.getSelection());
- updateLaunchConfigurationDialog();
- }
- });
- fFileText = SWTFactory.createSingleText(comp, 4);
- fFileText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- @Override
+ enableOuputCaptureWidgets(fFileOutput.getSelection());
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fFileText = SWTFactory.createSingleText(comp, 4);
+ fFileText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
public void getName(AccessibleEvent e) {
- e.result = LaunchConfigurationsMessages.CommonTab_6;
- }
- });
- fFileText.addModifyListener(fBasicModifyListener);
+ e.result = LaunchConfigurationsMessages.CommonTab_6;
+ }
+ });
+ fFileText.addModifyListener(fBasicModifyListener);
- Composite bcomp = SWTFactory.createComposite(comp, 3, 5, GridData.HORIZONTAL_ALIGN_END);
+ Composite bcomp = SWTFactory.createComposite(comp, 3, 5, GridData.HORIZONTAL_ALIGN_END);
GridLayout ld = (GridLayout)bcomp.getLayout();
- ld.marginHeight = 1;
- ld.marginWidth = 0;
- fWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_12, null);
- fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() {
- @Override
+ ld.marginHeight = 1;
+ ld.marginWidth = 0;
+ fWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_12, null);
+ fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13);
- dialog.setMessage(LaunchConfigurationsMessages.CommonTab_14);
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- dialog.setDialogBoundsSettings(getDialogBoundsSettings(WORKSPACE_SELECTION_DIALOG), Dialog.DIALOG_PERSISTSIZE);
- if (dialog.open() == IDialogConstants.OK_ID) {
- IResource resource = (IResource) dialog.getFirstResult();
- if(resource != null) {
- String arg = resource.getFullPath().toString();
- String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
- fFileText.setText(fileLoc);
- }
- }
- }
- });
- fFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_7, null);
- fFileBrowse.addSelectionListener(new SelectionAdapter() {
- @Override
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13);
+ dialog.setMessage(LaunchConfigurationsMessages.CommonTab_14);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ dialog.setDialogBoundsSettings(getDialogBoundsSettings(WORKSPACE_SELECTION_DIALOG), Dialog.DIALOG_PERSISTSIZE);
+ if (dialog.open() == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ if(resource != null) {
+ String arg = resource.getFullPath().toString();
+ String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
+ fFileText.setText(fileLoc);
+ }
+ }
+ }
+ });
+ fFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_7, null);
+ fFileBrowse.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- String filePath = fFileText.getText();
+ String filePath = fFileText.getText();
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE | SWT.SHEET);
- filePath = dialog.open();
- if (filePath != null) {
- fFileText.setText(filePath);
- }
- }
- });
- fVariables = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_9, null);
- fVariables.addSelectionListener(new SelectionListener() {
- @Override
+ filePath = dialog.open();
+ if (filePath != null) {
+ fFileText.setText(filePath);
+ }
+ }
+ });
+ fVariables = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_9, null);
+ fVariables.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
dialog.open();
String variable = dialog.getVariableExpression();
if (variable != null) {
fFileText.insert(variable);
}
- }
- @Override
+ }
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {}
- });
- fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11);
+ });
+ fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11);
GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
- gd.horizontalSpan = 4;
- fAppend.setLayoutData(gd);
+ gd.horizontalSpan = 4;
+ fAppend.setLayoutData(gd);
fAppend.addSelectionListener(new SelectionAdapter() {
- @Override
+ @Override
public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
+ updateLaunchConfigurationDialog();
+ }
});
- }
+ }
- private void createInputCaptureComponent(Composite parent){
+ private void createInputCaptureComponent(Composite parent){
Composite comp1 = SWTFactory.createComposite(parent, parent.getFont(), 5, 5, GridData.FILL_BOTH, 0, 0);
fConsoleOutput = createCheckButton(comp1, LaunchConfigurationsMessages.CommonTab_5);
fConsoleOutput.addSelectionListener(new SelectionAdapter() {
@@ -450,30 +450,30 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
});
setInputFileEnabled(false);
- }
- /**
- * Enables or disables the output capture widgets based on the the specified enablement
- * @param enable if the output capture widgets should be enabled or not
- * @since 3.2
- */
- private void enableOuputCaptureWidgets(boolean enable) {
- fFileText.setEnabled(enable);
- fFileBrowse.setEnabled(enable);
- fWorkspaceBrowse.setEnabled(enable);
- fVariables.setEnabled(enable);
- fAppend.setEnabled(enable);
- }
-
- /**
- * Returns the default encoding for the specified config
- * @param config the configuration to get the encoding for
- * @return the default encoding
- *
- * @since 3.4
- */
- private String getDefaultEncoding(ILaunchConfiguration config) {
- try {
- IResource[] resources = config.getMappedResources();
+ }
+ /**
+ * Enables or disables the output capture widgets based on the the specified enablement
+ * @param enable if the output capture widgets should be enabled or not
+ * @since 3.2
+ */
+ private void enableOuputCaptureWidgets(boolean enable) {
+ fFileText.setEnabled(enable);
+ fFileBrowse.setEnabled(enable);
+ fWorkspaceBrowse.setEnabled(enable);
+ fVariables.setEnabled(enable);
+ fAppend.setEnabled(enable);
+ }
+
+ /**
+ * Returns the default encoding for the specified config
+ * @param config the configuration to get the encoding for
+ * @return the default encoding
+ *
+ * @since 3.4
+ */
+ private String getDefaultEncoding(ILaunchConfiguration config) {
+ try {
+ IResource[] resources = config.getMappedResources();
if(resources != null && resources.length > 0) {
IResource res = resources[0];
if(res instanceof IFile) {
@@ -483,62 +483,62 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
return ((IContainer)res).getDefaultCharset();
}
}
- }
- catch(CoreException ce) {
- DebugUIPlugin.log(ce);
- }
- return ResourcesPlugin.getEncoding();
- }
-
- /**
- * Creates the encoding component
- * @param parent the parent to add this composite to
- */
- private void createEncodingComponent(Composite parent) {
- Group group = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_1, 2, 1, GridData.FILL_BOTH);
-
- fDefaultEncodingButton = createRadioButton(group, IInternalDebugCoreConstants.EMPTY_STRING);
- GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false);
- gd.horizontalSpan = 2;
- fDefaultEncodingButton.setLayoutData(gd);
-
- fAltEncodingButton = createRadioButton(group, LaunchConfigurationsMessages.CommonTab_3);
- fAltEncodingButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- fEncodingCombo = new Combo(group, SWT.NONE);
- fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fEncodingCombo.setFont(parent.getFont());
- List<String> allEncodings = IDEEncoding.getIDEEncodings();
- String[] encodingArray = allEncodings.toArray(new String[0]);
- fEncodingCombo.setItems(encodingArray);
- if (encodingArray.length > 0) {
- fEncodingCombo.select(0);
- }
- fEncodingCombo.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- @Override
+ }
+ catch(CoreException ce) {
+ DebugUIPlugin.log(ce);
+ }
+ return ResourcesPlugin.getEncoding();
+ }
+
+ /**
+ * Creates the encoding component
+ * @param parent the parent to add this composite to
+ */
+ private void createEncodingComponent(Composite parent) {
+ Group group = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_1, 2, 1, GridData.FILL_BOTH);
+
+ fDefaultEncodingButton = createRadioButton(group, IInternalDebugCoreConstants.EMPTY_STRING);
+ GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false);
+ gd.horizontalSpan = 2;
+ fDefaultEncodingButton.setLayoutData(gd);
+
+ fAltEncodingButton = createRadioButton(group, LaunchConfigurationsMessages.CommonTab_3);
+ fAltEncodingButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ fEncodingCombo = new Combo(group, SWT.NONE);
+ fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fEncodingCombo.setFont(parent.getFont());
+ List<String> allEncodings = IDEEncoding.getIDEEncodings();
+ String[] encodingArray = allEncodings.toArray(new String[0]);
+ fEncodingCombo.setItems(encodingArray);
+ if (encodingArray.length > 0) {
+ fEncodingCombo.select(0);
+ }
+ fEncodingCombo.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
public void getName(AccessibleEvent e) {
- e.result = LaunchConfigurationsMessages.CommonTab_3;
- }
- });
- SelectionListener listener = new SelectionAdapter() {
- @Override
+ e.result = LaunchConfigurationsMessages.CommonTab_3;
+ }
+ });
+ SelectionListener listener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- if(e.getSource() instanceof Button) {
- Button button = (Button)e.getSource();
- if(button.getSelection()) {
- updateLaunchConfigurationDialog();
- fEncodingCombo.setEnabled(fAltEncodingButton.getSelection() == true);
- }
- }
- else {
- updateLaunchConfigurationDialog();
- }
- }
- };
- fAltEncodingButton.addSelectionListener(listener);
- fDefaultEncodingButton.addSelectionListener(listener);
- fEncodingCombo.addSelectionListener(listener);
- fEncodingCombo.addKeyListener(new KeyAdapter() {
+ if(e.getSource() instanceof Button) {
+ Button button = (Button)e.getSource();
+ if(button.getSelection()) {
+ updateLaunchConfigurationDialog();
+ fEncodingCombo.setEnabled(fAltEncodingButton.getSelection() == true);
+ }
+ }
+ else {
+ updateLaunchConfigurationDialog();
+ }
+ }
+ };
+ fAltEncodingButton.addSelectionListener(listener);
+ fDefaultEncodingButton.addSelectionListener(listener);
+ fEncodingCombo.addSelectionListener(listener);
+ fEncodingCombo.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
scheduleUpdateJob();
@@ -658,9 +658,9 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
String currentContainerString = fSharedLocationText.getText();
IContainer currentContainer = getContainer(currentContainerString);
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
- currentContainer,
- false,
- LaunchConfigurationsMessages.CommonTab_Select_a_location_for_the_launch_configuration_13);
+ currentContainer,
+ false,
+ LaunchConfigurationsMessages.CommonTab_Select_a_location_for_the_launch_configuration_13);
dialog.showClosedProjects(false);
dialog.setDialogBoundsSettings(getDialogBoundsSettings(SHARED_LAUNCH_CONFIGURATON_DIALOG), Dialog.DIALOG_PERSISTSIZE);
dialog.open();
@@ -706,33 +706,33 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
updateConsoleOutput(configuration);
}
- /**
- * Updates the console output form the local configuration
- * @param configuration the local configuration
- */
- private void updateConsoleOutput(ILaunchConfiguration configuration) {
- boolean outputToConsole = true;
+ /**
+ * Updates the console output form the local configuration
+ * @param configuration the local configuration
+ */
+ private void updateConsoleOutput(ILaunchConfiguration configuration) {
+ boolean outputToConsole = true;
String stdinFromFile = null;
- String outputFile = null;
- boolean append = false;
+ String outputFile = null;
+ boolean append = false;
- try {
- outputToConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
+ try {
+ outputToConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
stdinFromFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, (String) null);
- outputFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
- append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false);
- } catch (CoreException e) {
- }
+ outputFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
+ append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false);
+ } catch (CoreException e) {
+ }
fConsoleOutput.setSelection(outputToConsole);
- fAppend.setSelection(append);
- boolean haveOutputFile= outputFile != null;
- if (haveOutputFile) {
- fFileText.setText(outputFile);
- }
- fFileOutput.setSelection(haveOutputFile);
- enableOuputCaptureWidgets(haveOutputFile);
+ fAppend.setSelection(append);
+ boolean haveOutputFile= outputFile != null;
+ if (haveOutputFile) {
+ fFileText.setText(outputFile);
+ }
+ fFileOutput.setSelection(haveOutputFile);
+ enableOuputCaptureWidgets(haveOutputFile);
boolean haveInputFile = stdinFromFile != null;
if (haveInputFile) {
@@ -740,13 +740,13 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
}
fInputFileCheckButton.setSelection(haveInputFile);
setInputFileEnabled(haveInputFile);
- }
+ }
- /**
- * Updates the launch on background check button
- * @param configuration the local launch configuration
- */
- protected void updateLaunchInBackground(ILaunchConfiguration configuration) {
+ /**
+ * Updates the launch on background check button
+ * @param configuration the local launch configuration
+ */
+ protected void updateLaunchInBackground(ILaunchConfiguration configuration) {
fLaunchInBackgroundButton.setSelection(isLaunchInBackground(configuration));
}
@@ -755,24 +755,24 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
* @param configuration the local configuration
*/
private void updateEncoding(ILaunchConfiguration configuration) {
- String encoding = null;
- try {
- encoding = configuration.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null);
- } catch (CoreException e) {
- }
- String defaultEncoding = getDefaultEncoding(configuration);
+ String encoding = null;
+ try {
+ encoding = configuration.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null);
+ } catch (CoreException e) {
+ }
+ String defaultEncoding = getDefaultEncoding(configuration);
fDefaultEncodingButton.setText(MessageFormat.format(LaunchConfigurationsMessages.CommonTab_2, new Object[] { defaultEncoding }));
- fDefaultEncodingButton.pack();
- if (encoding != null) {
- fAltEncodingButton.setSelection(true);
- fDefaultEncodingButton.setSelection(false);
- fEncodingCombo.setText(encoding);
- fEncodingCombo.setEnabled(true);
- } else {
- fDefaultEncodingButton.setSelection(true);
- fAltEncodingButton.setSelection(false);
- fEncodingCombo.setEnabled(false);
- }
+ fDefaultEncodingButton.pack();
+ if (encoding != null) {
+ fAltEncodingButton.setSelection(true);
+ fDefaultEncodingButton.setSelection(false);
+ fEncodingCombo.setText(encoding);
+ fEncodingCombo.setEnabled(true);
+ } else {
+ fDefaultEncodingButton.setSelection(true);
+ fAltEncodingButton.setSelection(false);
+ fEncodingCombo.setEnabled(false);
+ }
}
/**
@@ -925,42 +925,42 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
return validateLocalShared() && validateRedirectFile() && validateEncoding() && validateStdinFile();
}
- /**
- * validates the encoding selection
- * @return true if the validate encoding is allowable, false otherwise
- */
- private boolean validateEncoding() {
- if (fAltEncodingButton.getSelection()) {
- if (fEncodingCombo.getSelectionIndex() == -1) {
- if (!isValidEncoding(fEncodingCombo.getText().trim())) {
- setErrorMessage(LaunchConfigurationsMessages.CommonTab_15);
- return false;
- }
- }
- }
- return true;
- }
-
- /**
- * Validates if the redirect file is valid
- * @return true if the filename is not zero, false otherwise
- */
- private boolean validateRedirectFile() {
- if(fFileOutput.getSelection()) {
- int len = fFileText.getText().trim().length();
- if (len == 0) {
- setErrorMessage(LaunchConfigurationsMessages.CommonTab_8);
- return false;
- }
- }
- return true;
- }
-
- /**
- * validates the local shared config file location
- * @return true if the local shared file exists, false otherwise
- */
- private boolean validateLocalShared() {
+ /**
+ * validates the encoding selection
+ * @return true if the validate encoding is allowable, false otherwise
+ */
+ private boolean validateEncoding() {
+ if (fAltEncodingButton.getSelection()) {
+ if (fEncodingCombo.getSelectionIndex() == -1) {
+ if (!isValidEncoding(fEncodingCombo.getText().trim())) {
+ setErrorMessage(LaunchConfigurationsMessages.CommonTab_15);
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Validates if the redirect file is valid
+ * @return true if the filename is not zero, false otherwise
+ */
+ private boolean validateRedirectFile() {
+ if(fFileOutput.getSelection()) {
+ int len = fFileText.getText().trim().length();
+ if (len == 0) {
+ setErrorMessage(LaunchConfigurationsMessages.CommonTab_8);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * validates the local shared config file location
+ * @return true if the local shared file exists, false otherwise
+ */
+ private boolean validateLocalShared() {
if (isShared()) {
String path = fSharedLocationText.getText().trim();
IContainer container = getContainer(path);
@@ -1004,15 +1004,15 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, configuration, fLaunchInBackgroundButton.getSelection(), true);
String encoding = null;
if(fAltEncodingButton.getSelection()) {
- encoding = fEncodingCombo.getText().trim();
+ encoding = fEncodingCombo.getText().trim();
}
configuration.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, encoding);
boolean captureOutput = false;
if (fConsoleOutput.getSelection()) {
- captureOutput = true;
+ captureOutput = true;
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String) null);
} else {
- configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
+ configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
}
if (fInputFileCheckButton.getSelection()) {
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, fInputFileLocationText.getText());
@@ -1020,22 +1020,22 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, (String) null);
}
if (fFileOutput.getSelection()) {
- captureOutput = true;
- String file = fFileText.getText();
- configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, file);
- if(fAppend.getSelection()) {
- configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, true);
- } else {
- configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, (String)null);
- }
+ captureOutput = true;
+ String file = fFileText.getText();
+ configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, file);
+ if(fAppend.getSelection()) {
+ configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, true);
+ } else {
+ configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, (String)null);
+ }
} else {
- configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
+ configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
}
if (!captureOutput) {
- configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false);
+ configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false);
} else {
- configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, (String)null);
+ configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, (String)null);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java
index ae1c7aa60..310bdbcea 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java
@@ -37,29 +37,29 @@ import org.eclipse.ui.model.IWorkbenchAdapter2;
@Deprecated
public abstract class DebugElementWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2 {
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return DebugElementHelper.getImageDescriptor(object);
- }
+ return DebugElementHelper.getImageDescriptor(object);
+ }
- @Override
+ @Override
public String getLabel(Object o) {
- return DebugElementHelper.getLabel(o);
- }
+ return DebugElementHelper.getLabel(o);
+ }
- @Override
+ @Override
public RGB getForeground(Object element) {
- return DebugElementHelper.getForeground(element);
- }
+ return DebugElementHelper.getForeground(element);
+ }
- @Override
+ @Override
public RGB getBackground(Object element) {
- return DebugElementHelper.getBackground(element);
- }
+ return DebugElementHelper.getBackground(element);
+ }
- @Override
+ @Override
public FontData getFont(Object element) {
- return DebugElementHelper.getFont(element);
- }
+ return DebugElementHelper.getFont(element);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
index 134ff6bf9..d939d751d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
@@ -46,167 +46,167 @@ import com.ibm.icu.text.MessageFormat;
*/
public abstract class DebugPopup extends PopupDialog {
- private Point fAnchor;
+ private Point fAnchor;
- private IHandlerActivation fActivation;
+ private IHandlerActivation fActivation;
- private IHandlerService fHandlerService;
+ private IHandlerService fHandlerService;
private String fCommandId;
private boolean fPersisted = false;
- /**
- * Constructs a new popup dialog of type <code>PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE</code>
- * @param parent The parent shell
- * @param anchor point at which to anchor the popup dialog in Display coordinate space.
- * Since 3.3, <code>null</code> can be specified to use a default anchor point
- * @param commandId The command id to be used for persistence of
- * the dialog, or <code>null</code>
- */
- public DebugPopup(Shell parent, Point anchor, String commandId) {
- super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, false, true, false, null, null);
- fAnchor = anchor;
- fCommandId = commandId;
- }
-
- /**
- * Returns the text to be shown in the popups's information area.
- * May return <code>null</code>.
- * <p>
- * By default, if this dialog has a persistence command associated with it,
- * the text displayed is of the form "Press {key-sequence} to {action}". The
- * action text is specified by the method <code>getActionText()</code>.
- * </p>
- * @return The text to be shown in the popup's information area or <code>null</code>
- */
- protected String getInfoText() {
- if (getCommandId() != null && getActionText() != null) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IBindingService bindingService = workbench.getAdapter(IBindingService.class);
- String formattedBinding = bindingService.getBestActiveBindingFormattedFor(getCommandId());
-
- String infoText = null;
- if (formattedBinding != null) {
+ /**
+ * Constructs a new popup dialog of type <code>PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE</code>
+ * @param parent The parent shell
+ * @param anchor point at which to anchor the popup dialog in Display coordinate space.
+ * Since 3.3, <code>null</code> can be specified to use a default anchor point
+ * @param commandId The command id to be used for persistence of
+ * the dialog, or <code>null</code>
+ */
+ public DebugPopup(Shell parent, Point anchor, String commandId) {
+ super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, false, true, false, null, null);
+ fAnchor = anchor;
+ fCommandId = commandId;
+ }
+
+ /**
+ * Returns the text to be shown in the popups's information area.
+ * May return <code>null</code>.
+ * <p>
+ * By default, if this dialog has a persistence command associated with it,
+ * the text displayed is of the form "Press {key-sequence} to {action}". The
+ * action text is specified by the method <code>getActionText()</code>.
+ * </p>
+ * @return The text to be shown in the popup's information area or <code>null</code>
+ */
+ protected String getInfoText() {
+ if (getCommandId() != null && getActionText() != null) {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IBindingService bindingService = workbench.getAdapter(IBindingService.class);
+ String formattedBinding = bindingService.getBestActiveBindingFormattedFor(getCommandId());
+
+ String infoText = null;
+ if (formattedBinding != null) {
infoText = MessageFormat.format(DebugUIViewsMessages.InspectPopupDialog_1, new Object[] {
formattedBinding, getActionText() });
- }
- return infoText;
- }
- return null;
- }
-
- /**
- * Returns the text to be shown as the action performed when this dialog's
- * persist command is invoked, or <code>null</code>.
- * <p>
- * Subclasses should override as necessary.
- * </p>
- * @return the text to be shown as the action performed when this dialog's
- * persist command is invoked
- */
- protected String getActionText() {
- return null;
- }
-
- /**
- * Returns the command id to be used for persisting the contents of the
- * dialog. If the contents should not be persisted, this method should
- * return null.
- *
- * @return The command id to be used for persisting the contents of the
- * dialog or <code>null</code>
- */
- protected String getCommandId() {
- return fCommandId;
- }
-
- /**
- * Persists the contents of the dialog. Subclasses should override as required,
- * but also call super.persist().
- */
- protected void persist() {
- fPersisted = true;
- }
-
- /**
- * Returns whether the command handler was invoked to persist this popup's result.
- *
- * @return whether the command handler was invoked to persist this popup's result
- */
- protected boolean wasPersisted() {
- return fPersisted;
- }
-
- @Override
+ }
+ return infoText;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the text to be shown as the action performed when this dialog's
+ * persist command is invoked, or <code>null</code>.
+ * <p>
+ * Subclasses should override as necessary.
+ * </p>
+ * @return the text to be shown as the action performed when this dialog's
+ * persist command is invoked
+ */
+ protected String getActionText() {
+ return null;
+ }
+
+ /**
+ * Returns the command id to be used for persisting the contents of the
+ * dialog. If the contents should not be persisted, this method should
+ * return null.
+ *
+ * @return The command id to be used for persisting the contents of the
+ * dialog or <code>null</code>
+ */
+ protected String getCommandId() {
+ return fCommandId;
+ }
+
+ /**
+ * Persists the contents of the dialog. Subclasses should override as required,
+ * but also call super.persist().
+ */
+ protected void persist() {
+ fPersisted = true;
+ }
+
+ /**
+ * Returns whether the command handler was invoked to persist this popup's result.
+ *
+ * @return whether the command handler was invoked to persist this popup's result
+ */
+ protected boolean wasPersisted() {
+ return fPersisted;
+ }
+
+ @Override
protected abstract Control createDialogArea(Composite parent);
- /**
- * Returns the initial location to use for the shell based upon the
- * current selection in the viewer. Bottom is preferred to top, and
- * right is preferred to left, therefore if possible the popup will
- * be located below and to the right of the selection.
- *
- * @param initialSize
- * the initial size of the shell, as returned by
- * <code>getInitialSize</code>.
- * @return the initial location of the shell
- */
- @Override
+ /**
+ * Returns the initial location to use for the shell based upon the
+ * current selection in the viewer. Bottom is preferred to top, and
+ * right is preferred to left, therefore if possible the popup will
+ * be located below and to the right of the selection.
+ *
+ * @param initialSize
+ * the initial size of the shell, as returned by
+ * <code>getInitialSize</code>.
+ * @return the initial location of the shell
+ */
+ @Override
protected Point getInitialLocation(Point initialSize) {
- if (fAnchor == null) {
- return super.getInitialLocation(initialSize);
- }
- Point point = fAnchor;
- Rectangle monitor = getShell().getMonitor().getClientArea();
- if (monitor.width < point.x + initialSize.x) {
- point.x = Math.max(0, point.x - initialSize.x);
- }
- if (monitor.height < point.y + initialSize.y) {
- point.y = Math.max(0, point.y - initialSize.y);
- }
- return point;
- }
-
- @Override
+ if (fAnchor == null) {
+ return super.getInitialLocation(initialSize);
+ }
+ Point point = fAnchor;
+ Rectangle monitor = getShell().getMonitor().getClientArea();
+ if (monitor.width < point.x + initialSize.x) {
+ point.x = Math.max(0, point.x - initialSize.x);
+ }
+ if (monitor.height < point.y + initialSize.y) {
+ point.y = Math.max(0, point.y - initialSize.y);
+ }
+ return point;
+ }
+
+ @Override
protected IDialogSettings getDialogSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
- return settings;
- }
+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ return settings;
+ }
- @Override
+ @Override
public int open() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- String commandId = getCommandId();
- if (commandId != null) {
- IHandler fCloseHandler = new AbstractHandler() {
- @Override
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ String commandId = getCommandId();
+ if (commandId != null) {
+ IHandler fCloseHandler = new AbstractHandler() {
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- persist();
- close();
- return null;
- }
- };
-
- fHandlerService = workbench.getAdapter(IHandlerService.class);
- fActivation = fHandlerService.activateHandler(commandId, fCloseHandler);
- }
-
- String infoText = getInfoText();
- if (infoText != null) {
+ persist();
+ close();
+ return null;
+ }
+ };
+
+ fHandlerService = workbench.getAdapter(IHandlerService.class);
+ fActivation = fHandlerService.activateHandler(commandId, fCloseHandler);
+ }
+
+ String infoText = getInfoText();
+ if (infoText != null) {
setInfoText(infoText);
}
- return super.open();
- }
+ return super.open();
+ }
- @Override
+ @Override
public boolean close() {
- if (fActivation != null) {
+ if (fActivation != null) {
fHandlerService.deactivateHandler(fActivation);
}
- return super.close();
- }
+ return super.close();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index 91baf81e1..886f32ef6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -236,7 +236,7 @@ public class DebugUITools {
}
/**
- * Returns the element of the currently selected context in the
+ * Returns the element of the currently selected context in the
* active workbench window. Returns <code>null</code> if there is no
* current debug context.
* <p>
@@ -247,38 +247,38 @@ public class DebugUITools {
* @since 2.0
*/
public static IAdaptable getDebugContext() {
- IWorkbenchWindow activeWindow = SelectedResourceManager.getDefault().getActiveWindow();
- if (activeWindow != null) {
- ISelection activeContext = DebugUITools.getDebugContextManager().getContextService(activeWindow).getActiveContext();
- return getDebugContextElementForSelection(activeContext);
- }
- return null;
+ IWorkbenchWindow activeWindow = SelectedResourceManager.getDefault().getActiveWindow();
+ if (activeWindow != null) {
+ ISelection activeContext = DebugUITools.getDebugContextManager().getContextService(activeWindow).getActiveContext();
+ return getDebugContextElementForSelection(activeContext);
+ }
+ return null;
}
- /**
- * Returns the currently selected context in the given part or part's
- * workbench window. Returns <code>null</code> if there is no current
- * debug context.
- * @param part workbench part where the active context is to be evaluated
- * @return the currently selected debug context in the given workbench part,
- * or <code>null</code>
- * @since 3.8
- * @see IDebugContextService#getActiveContext(String)
- * @see IDebugContextService#getActiveContext(String, String)
- */
- public static ISelection getDebugContextForPart(IWorkbenchPart part) {
- IWorkbenchPartSite site = part.getSite();
- IWorkbenchWindow partWindow = site.getWorkbenchWindow();
- if (partWindow != null) {
- IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(partWindow);
- if (site instanceof IViewSite) {
- return contextService.getActiveContext(site.getId(), ((IViewSite)site).getSecondaryId());
- } else {
- return contextService.getActiveContext(site.getId());
- }
- }
- return null;
- }
+ /**
+ * Returns the currently selected context in the given part or part's
+ * workbench window. Returns <code>null</code> if there is no current
+ * debug context.
+ * @param part workbench part where the active context is to be evaluated
+ * @return the currently selected debug context in the given workbench part,
+ * or <code>null</code>
+ * @since 3.8
+ * @see IDebugContextService#getActiveContext(String)
+ * @see IDebugContextService#getActiveContext(String, String)
+ */
+ public static ISelection getDebugContextForPart(IWorkbenchPart part) {
+ IWorkbenchPartSite site = part.getSite();
+ IWorkbenchWindow partWindow = site.getWorkbenchWindow();
+ if (partWindow != null) {
+ IDebugContextService contextService = DebugUITools.getDebugContextManager().getContextService(partWindow);
+ if (site instanceof IViewSite) {
+ return contextService.getActiveContext(site.getId(), ((IViewSite)site).getSecondaryId());
+ } else {
+ return contextService.getActiveContext(site.getId());
+ }
+ }
+ return null;
+ }
/**
* Return the undo context that should be used for operations involving breakpoints.
@@ -354,7 +354,7 @@ public class DebugUITools {
}
}
- /**
+ /**
* Returns the currently active context for the given workbench part. Returns
* <code>null</code> if there is no current debug context.
*
@@ -363,88 +363,88 @@ public class DebugUITools {
* <code>null</code>
* @since 3.7
*/
- public static IAdaptable getPartDebugContext(IWorkbenchPartSite site) {
- IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
- String id = null;
- String secondaryId = null;
- id = site.getId();
- if (site instanceof IViewSite) {
- secondaryId = ((IViewSite)site).getSecondaryId();
- }
- ISelection activeContext = service.getActiveContext(id, secondaryId);
- return getDebugContextElementForSelection(activeContext);
- }
-
- /**
- * Adds the given debug context listener as a listener to the debug context changed events, in
- * the context of the given workbench part.
- * <p>
- * This method is a utility method which ultimately calls
- * {@link IDebugContextService#addDebugContextListener(IDebugContextListener, String, String)}
- * using the part id parameters extracted from the given part parameter.
- * </p>
- *
- * @param site the part's site to get the part ID and part secondary ID from
- * @param listener Debug context listener to add
- *
- * @see IDebugContextService#addDebugContextListener(IDebugContextListener, String, String)
- * @see IDebugContextManager#addDebugContextListener(IDebugContextListener)
- * @since 3.7
- */
- public static void addPartDebugContextListener(IWorkbenchPartSite site, IDebugContextListener listener) {
- IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
- String id = site.getId();
- String secondaryId = null;
- if (site instanceof IViewSite) {
- secondaryId = ((IViewSite)site).getSecondaryId();
- }
- service.addDebugContextListener(listener, id, secondaryId);
- }
-
- /**
- * Removes the given debug context listener as a listener to the debug context changed events,
- * in the context of the given workbench part.
- * <p>
- * This method is a utility method which ultimately calls
- * {@link IDebugContextService#removeDebugContextListener(IDebugContextListener, String, String)}
- * using the part id parameters extracted from the given part parameter.
- * </p>
- *
- * @param site the part's site to get the part ID and part secondary ID from
- * @param listener Debug context listener to remove
- *
- * @see IDebugContextService#removeDebugContextListener(IDebugContextListener, String, String)
- * @see IDebugContextManager#removeDebugContextListener(IDebugContextListener)
- * @since 3.7
- */
- public static void removePartDebugContextListener(IWorkbenchPartSite site, IDebugContextListener listener) {
- IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
- String id = site.getId();
- String secondaryId = null;
- if (site instanceof IViewSite) {
- secondaryId = ((IViewSite)site).getSecondaryId();
- }
- service.removeDebugContextListener(listener, id, secondaryId);
- }
-
- /**
+ public static IAdaptable getPartDebugContext(IWorkbenchPartSite site) {
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
+ String id = null;
+ String secondaryId = null;
+ id = site.getId();
+ if (site instanceof IViewSite) {
+ secondaryId = ((IViewSite)site).getSecondaryId();
+ }
+ ISelection activeContext = service.getActiveContext(id, secondaryId);
+ return getDebugContextElementForSelection(activeContext);
+ }
+
+ /**
+ * Adds the given debug context listener as a listener to the debug context changed events, in
+ * the context of the given workbench part.
+ * <p>
+ * This method is a utility method which ultimately calls
+ * {@link IDebugContextService#addDebugContextListener(IDebugContextListener, String, String)}
+ * using the part id parameters extracted from the given part parameter.
+ * </p>
+ *
+ * @param site the part's site to get the part ID and part secondary ID from
+ * @param listener Debug context listener to add
+ *
+ * @see IDebugContextService#addDebugContextListener(IDebugContextListener, String, String)
+ * @see IDebugContextManager#addDebugContextListener(IDebugContextListener)
+ * @since 3.7
+ */
+ public static void addPartDebugContextListener(IWorkbenchPartSite site, IDebugContextListener listener) {
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
+ String id = site.getId();
+ String secondaryId = null;
+ if (site instanceof IViewSite) {
+ secondaryId = ((IViewSite)site).getSecondaryId();
+ }
+ service.addDebugContextListener(listener, id, secondaryId);
+ }
+
+ /**
+ * Removes the given debug context listener as a listener to the debug context changed events,
+ * in the context of the given workbench part.
+ * <p>
+ * This method is a utility method which ultimately calls
+ * {@link IDebugContextService#removeDebugContextListener(IDebugContextListener, String, String)}
+ * using the part id parameters extracted from the given part parameter.
+ * </p>
+ *
+ * @param site the part's site to get the part ID and part secondary ID from
+ * @param listener Debug context listener to remove
+ *
+ * @see IDebugContextService#removeDebugContextListener(IDebugContextListener, String, String)
+ * @see IDebugContextManager#removeDebugContextListener(IDebugContextListener)
+ * @since 3.7
+ */
+ public static void removePartDebugContextListener(IWorkbenchPartSite site, IDebugContextListener listener) {
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(site.getWorkbenchWindow());
+ String id = site.getId();
+ String secondaryId = null;
+ if (site instanceof IViewSite) {
+ secondaryId = ((IViewSite)site).getSecondaryId();
+ }
+ service.removeDebugContextListener(listener, id, secondaryId);
+ }
+
+ /**
* Extracts the first element from the given selection and casts it to IAdaptable.
*
* @param activeContext the selection
* @return an adaptable
*/
- private static IAdaptable getDebugContextElementForSelection(ISelection activeContext) {
- if (activeContext instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) activeContext;
- if (!selection.isEmpty()) {
- Object firstElement = selection.getFirstElement();
- if (firstElement instanceof IAdaptable) {
- return (IAdaptable) firstElement;
- }
- }
- }
- return null;
- }
+ private static IAdaptable getDebugContextElementForSelection(ISelection activeContext) {
+ if (activeContext instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) activeContext;
+ if (!selection.isEmpty()) {
+ Object firstElement = selection.getFirstElement();
+ if (firstElement instanceof IAdaptable) {
+ return (IAdaptable) firstElement;
+ }
+ }
+ }
+ return null;
+ }
/**
* Returns the currently selected resource in the active workbench window,
@@ -480,11 +480,11 @@ public class DebugUITools {
return ((IDebugElement)context).getDebugTarget().getProcess();
}
- if (context instanceof IProcess) {
+ if (context instanceof IProcess) {
return (IProcess)context;
}
- if (context instanceof ILaunch) {
+ if (context instanceof ILaunch) {
ILaunch launch= (ILaunch)context;
IDebugTarget target= launch.getDebugTarget();
if (target != null) {
@@ -499,9 +499,9 @@ public class DebugUITools {
}
}
- if (context != null) {
- return context.getAdapter(IProcess.class);
- }
+ if (context != null) {
+ return context.getAdapter(IProcess.class);
+ }
return null;
}
@@ -683,37 +683,37 @@ public class DebugUITools {
}
/**
- * Open the launch configuration dialog on the specified launch
- * configuration. The dialog displays the tabs for a single configuration
- * only (a tree of launch configuration is not displayed), and provides a
- * launch (run or debug) button.
- * <p>
- * If a status is specified, a status handler is consulted to handle the
- * status. The status handler is passed the instance of the launch
- * configuration dialog that is opened. This gives the status handler an
- * opportunity to perform error handling/initialization as required.
- * </p>
- * @param shell the parent shell for the launch configuration dialog
- * @param configuration the configuration to display
- * @param groupIdentifier group identifier of the launch group the launch configuration
- * belongs to
- * @param status the status to display, or <code>null</code> if none
- * @return the return code from opening the launch configuration dialog -
- * one of <code>Window.OK</code> or <code>Window.CANCEL</code>. <code>Window.CANCEL</code>
+ * Open the launch configuration dialog on the specified launch
+ * configuration. The dialog displays the tabs for a single configuration
+ * only (a tree of launch configuration is not displayed), and provides a
+ * launch (run or debug) button.
+ * <p>
+ * If a status is specified, a status handler is consulted to handle the
+ * status. The status handler is passed the instance of the launch
+ * configuration dialog that is opened. This gives the status handler an
+ * opportunity to perform error handling/initialization as required.
+ * </p>
+ * @param shell the parent shell for the launch configuration dialog
+ * @param configuration the configuration to display
+ * @param groupIdentifier group identifier of the launch group the launch configuration
+ * belongs to
+ * @param status the status to display, or <code>null</code> if none
+ * @return the return code from opening the launch configuration dialog -
+ * one of <code>Window.OK</code> or <code>Window.CANCEL</code>. <code>Window.CANCEL</code>
* is returned if an invalid launch group identifier is provided.
* @see ILaunchGroup
- * @since 2.1
- */
- public static int openLaunchConfigurationDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status) {
- LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
- if (group != null) {
- LaunchConfigurationDialog dialog = new LaunchConfigurationDialog(shell, configuration, group);
- dialog.setInitialStatus(status);
- return dialog.open();
- }
-
- return Window.CANCEL;
- }
+ * @since 2.1
+ */
+ public static int openLaunchConfigurationDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status) {
+ LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
+ if (group != null) {
+ LaunchConfigurationDialog dialog = new LaunchConfigurationDialog(shell, configuration, group);
+ dialog.setInitialStatus(status);
+ return dialog.open();
+ }
+
+ return Window.CANCEL;
+ }
/**
* Saves all dirty editors and builds the workspace according to current
@@ -1217,45 +1217,45 @@ public class DebugUITools {
}
}
- /**
- * Performs source lookup on the given artifact and returns the result.
- * Optionally, a source locator may be specified.
- *
- * @param artifact object for which source is to be resolved
- * @param locator the source locator to use, or <code>null</code>. When <code>null</code>
- * a source locator is determined from the artifact, if possible. If the artifact
- * is a debug element, the source locator from its associated launch is used.
- * @return a source lookup result
- * @since 3.1
- */
- public static ISourceLookupResult lookupSource(Object artifact, ISourceLocator locator) {
+ /**
+ * Performs source lookup on the given artifact and returns the result.
+ * Optionally, a source locator may be specified.
+ *
+ * @param artifact object for which source is to be resolved
+ * @param locator the source locator to use, or <code>null</code>. When <code>null</code>
+ * a source locator is determined from the artifact, if possible. If the artifact
+ * is a debug element, the source locator from its associated launch is used.
+ * @return a source lookup result
+ * @since 3.1
+ */
+ public static ISourceLookupResult lookupSource(Object artifact, ISourceLocator locator) {
return SourceLookupFacility.getDefault().lookup(artifact, locator, false);
- }
-
- /**
- * Displays the given source lookup result in an editor in the given workbench
- * page. Has no effect if the result has an unknown editor id or editor input.
- * The editor is opened, positioned, and annotated.
- * <p>
- * Honors user preference for editors re-use.
- * </p>
- * @param result source lookup result to display
- * @param page the page to display the result in
- * @since 3.1
- */
- public static void displaySource(ISourceLookupResult result, IWorkbenchPage page) {
- SourceLookupFacility.getDefault().display(result, page);
- }
-
- /**
- * Returns the memory rendering manager.
- *
- * @return the memory rendering manager
- * @since 3.1
- */
- public static IMemoryRenderingManager getMemoryRenderingManager() {
- return MemoryRenderingManager.getDefault();
- }
+ }
+
+ /**
+ * Displays the given source lookup result in an editor in the given workbench
+ * page. Has no effect if the result has an unknown editor id or editor input.
+ * The editor is opened, positioned, and annotated.
+ * <p>
+ * Honors user preference for editors re-use.
+ * </p>
+ * @param result source lookup result to display
+ * @param page the page to display the result in
+ * @since 3.1
+ */
+ public static void displaySource(ISourceLookupResult result, IWorkbenchPage page) {
+ SourceLookupFacility.getDefault().display(result, page);
+ }
+
+ /**
+ * Returns the memory rendering manager.
+ *
+ * @return the memory rendering manager
+ * @since 3.1
+ */
+ public static IMemoryRenderingManager getMemoryRenderingManager() {
+ return MemoryRenderingManager.getDefault();
+ }
/**
* Returns the image associated with the specified type of source container
@@ -1308,55 +1308,55 @@ public class DebugUITools {
return DebugContextManager.getDefault();
}
- /**
- * Return the debug context for the given executionEvent or <code>null</code> if none.
- *
- * @param event The execution event that contains the application context
- * @return the current debug context, or <code>null</code>.
- *
- * @since 3.5
- */
- public static ISelection getDebugContextForEvent(ExecutionEvent event) {
- Object o = HandlerUtil.getVariable(event, IConfigurationElementConstants.DEBUG_CONTEXT);
- if (o instanceof ISelection) {
- return (ISelection) o;
- }
- return null;
- }
-
- /**
- * Return the debug context for the given executionEvent.
- *
- * @param event The execution event that contains the application context
- * @return the debug context. Will not return <code>null</code>.
- * @throws ExecutionException If the current selection variable is not found.
- *
- * @since 3.5
- */
- public static ISelection getDebugContextForEventChecked(ExecutionEvent event)
- throws ExecutionException {
- Object o = HandlerUtil.getVariableChecked(event, IConfigurationElementConstants.DEBUG_CONTEXT);
- if (!(o instanceof ISelection)) {
- throw new ExecutionException("Incorrect type for " //$NON-NLS-1$
- + IConfigurationElementConstants.DEBUG_CONTEXT
- + " found while executing " //$NON-NLS-1$
- + event.getCommand().getId()
- + ", expected " + ISelection.class.getName() //$NON-NLS-1$
- + " found " + o.getClass().getName()); //$NON-NLS-1$
- }
- return (ISelection) o;
- }
-
- /**
- * Returns the global instance of toggle breakpoints target manager.
- *
- * @return toggle breakpoints target manager
- *
- * @since 3.8
- */
- public static IToggleBreakpointsTargetManager getToggleBreakpointsTargetManager() {
- return ToggleBreakpointsTargetManager.getDefault();
- }
+ /**
+ * Return the debug context for the given executionEvent or <code>null</code> if none.
+ *
+ * @param event The execution event that contains the application context
+ * @return the current debug context, or <code>null</code>.
+ *
+ * @since 3.5
+ */
+ public static ISelection getDebugContextForEvent(ExecutionEvent event) {
+ Object o = HandlerUtil.getVariable(event, IConfigurationElementConstants.DEBUG_CONTEXT);
+ if (o instanceof ISelection) {
+ return (ISelection) o;
+ }
+ return null;
+ }
+
+ /**
+ * Return the debug context for the given executionEvent.
+ *
+ * @param event The execution event that contains the application context
+ * @return the debug context. Will not return <code>null</code>.
+ * @throws ExecutionException If the current selection variable is not found.
+ *
+ * @since 3.5
+ */
+ public static ISelection getDebugContextForEventChecked(ExecutionEvent event)
+ throws ExecutionException {
+ Object o = HandlerUtil.getVariableChecked(event, IConfigurationElementConstants.DEBUG_CONTEXT);
+ if (!(o instanceof ISelection)) {
+ throw new ExecutionException("Incorrect type for " //$NON-NLS-1$
+ + IConfigurationElementConstants.DEBUG_CONTEXT
+ + " found while executing " //$NON-NLS-1$
+ + event.getCommand().getId()
+ + ", expected " + ISelection.class.getName() //$NON-NLS-1$
+ + " found " + o.getClass().getName()); //$NON-NLS-1$
+ }
+ return (ISelection) o;
+ }
+
+ /**
+ * Returns the global instance of toggle breakpoints target manager.
+ *
+ * @return toggle breakpoints target manager
+ *
+ * @since 3.8
+ */
+ public static IToggleBreakpointsTargetManager getToggleBreakpointsTargetManager() {
+ return ToggleBreakpointsTargetManager.getDefault();
+ }
/**
* Returns the ILaunchConfiguration corresponding to
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java
index fdf8b4422..755daac87 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java
@@ -39,31 +39,31 @@ public abstract class DeferredDebugElementWorkbenchAdapter extends DebugElementW
/**
* An empty collection of children
*/
- protected static final Object[] EMPTY = new Object[0];
+ protected static final Object[] EMPTY = new Object[0];
- @Override
+ @Override
public boolean isContainer() {
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public ISchedulingRule getRule(Object object) {
- return null;
- }
+ return null;
+ }
@Override
public void fetchDeferredChildren(Object object, IElementCollector collector, IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return;
}
- Object[] children = getChildren(object);
- if (monitor.isCanceled()) {
- return;
- }
- if (children.length > 0) {
- collector.add(children, monitor);
- }
- collector.done();
+ Object[] children = getChildren(object);
+ if (monitor.isCanceled()) {
+ return;
+ }
+ if (children.length > 0) {
+ collector.add(children, monitor);
+ }
+ collector.done();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegate.java
index 81679e6a5..34673c50b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegate.java
@@ -60,101 +60,101 @@ import org.eclipse.jface.util.IPropertyChangeListener;
*/
public interface IBreakpointOrganizerDelegate {
- /**
- * Change event id when a category's breakpoints have changed.
- * The <code>oldValue</code> of the <code>PropertyChangeEvent</code> will be the
- * category that has changed, and the source of the event will the the
- * breakpoint organizer. Breakpoints in the category will be
- * recategorized when this event is fired.
- *
- * @see IPropertyChangeListener
- */
- String P_CATEGORY_CHANGED = DebugUIPlugin.getUniqueIdentifier() + ".P_CATEGORY_CHANGED"; //$NON-NLS-1$
+ /**
+ * Change event id when a category's breakpoints have changed.
+ * The <code>oldValue</code> of the <code>PropertyChangeEvent</code> will be the
+ * category that has changed, and the source of the event will the the
+ * breakpoint organizer. Breakpoints in the category will be
+ * recategorized when this event is fired.
+ *
+ * @see IPropertyChangeListener
+ */
+ String P_CATEGORY_CHANGED = DebugUIPlugin.getUniqueIdentifier() + ".P_CATEGORY_CHANGED"; //$NON-NLS-1$
- /**
- * Returns objects representing the categories of the specified
- * breakpoint or <code>null</code> if this organizer cannot classify
- * the breakpoint. Categories must return <code>true</code> when sent
- * the message <code>equals(Object)</code> with an equivalent category
- * as an argument.
- *
- * @param breakpoint breakpoint to classify
- * @return categories of the given breakpoint or <code>null</code>
- */
- IAdaptable[] getCategories(IBreakpoint breakpoint);
+ /**
+ * Returns objects representing the categories of the specified
+ * breakpoint or <code>null</code> if this organizer cannot classify
+ * the breakpoint. Categories must return <code>true</code> when sent
+ * the message <code>equals(Object)</code> with an equivalent category
+ * as an argument.
+ *
+ * @param breakpoint breakpoint to classify
+ * @return categories of the given breakpoint or <code>null</code>
+ */
+ IAdaptable[] getCategories(IBreakpoint breakpoint);
- /**
- * Adds the specified listener. Has no effect if an identical listener is
- * already registered.
- *
- * @param listener listener to add
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Adds the specified listener. Has no effect if an identical listener is
+ * already registered.
+ *
+ * @param listener listener to add
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Removes the specified listener. Has no effect if an identical listener
- * is not already registered.
- *
- * @param listener listener to remove
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Removes the specified listener. Has no effect if an identical listener
+ * is not already registered.
+ *
+ * @param listener listener to remove
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Adds the specified breakpoint to the given category. Only called
- * if <code>canAdd(...)</code> returns <code>true</code> for the given
- * breakpoint and category.
- *
- * @param breakpoint breakpoint to recategorize
- * @param category the breakpoint's new category
- */
- void addBreakpoint(IBreakpoint breakpoint, IAdaptable category);
+ /**
+ * Adds the specified breakpoint to the given category. Only called
+ * if <code>canAdd(...)</code> returns <code>true</code> for the given
+ * breakpoint and category.
+ *
+ * @param breakpoint breakpoint to recategorize
+ * @param category the breakpoint's new category
+ */
+ void addBreakpoint(IBreakpoint breakpoint, IAdaptable category);
- /**
- * Removes the specified breakpoint from the given category. Only
- * called if <code>canRemove(...)</code> returns <code>true</code> for
- * the given breakpoint and category.
- *
- * @param breakpoint breakpoint to recategorize
- * @param category the category the breakpoint is remove from
- */
- void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category);
+ /**
+ * Removes the specified breakpoint from the given category. Only
+ * called if <code>canRemove(...)</code> returns <code>true</code> for
+ * the given breakpoint and category.
+ *
+ * @param breakpoint breakpoint to recategorize
+ * @param category the category the breakpoint is remove from
+ */
+ void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category);
- /**
- * Returns whether the given breakpoint can be categorized in the
- * specified category.
- *
- * @param breakpoint breakpoint to recatogorize
- * @param category the category to add the breakpoint to
- * @return whether the given breakpoint can be categorized in the
- * specified category
- */
- boolean canAdd(IBreakpoint breakpoint, IAdaptable category);
+ /**
+ * Returns whether the given breakpoint can be categorized in the
+ * specified category.
+ *
+ * @param breakpoint breakpoint to recatogorize
+ * @param category the category to add the breakpoint to
+ * @return whether the given breakpoint can be categorized in the
+ * specified category
+ */
+ boolean canAdd(IBreakpoint breakpoint, IAdaptable category);
- /**
- * Returns whether the given breakpoint can be removed from the given
- * category.
- *
- * @param breakpoint breakpoint to recategorize
- * @param category the category to remove the breakpoint from
- * @return whether the given breakpoint can be removed from the given
- * category
- */
- boolean canRemove(IBreakpoint breakpoint, IAdaptable category);
+ /**
+ * Returns whether the given breakpoint can be removed from the given
+ * category.
+ *
+ * @param breakpoint breakpoint to recategorize
+ * @param category the category to remove the breakpoint from
+ * @return whether the given breakpoint can be removed from the given
+ * category
+ */
+ boolean canRemove(IBreakpoint breakpoint, IAdaptable category);
- /**
- * Returns all categories managed by this organizer, or <code>null</code>.
- * When <code>null</code> is returned, the breakpoints view only displays
- * categories that contain breakpoints. When a collection of categories
- * is returned the breakpoints will display all of the categories, some of
- * which may be empty.
- *
- * @return all categories managed by this organizer, or <code>null</code>
- */
- IAdaptable[] getCategories();
+ /**
+ * Returns all categories managed by this organizer, or <code>null</code>.
+ * When <code>null</code> is returned, the breakpoints view only displays
+ * categories that contain breakpoints. When a collection of categories
+ * is returned the breakpoints will display all of the categories, some of
+ * which may be empty.
+ *
+ * @return all categories managed by this organizer, or <code>null</code>
+ */
+ IAdaptable[] getCategories();
- /**
- * Disposes this breakpoint organizer.
- */
- void dispose();
+ /**
+ * Disposes this breakpoint organizer.
+ */
+ void dispose();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegateExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegateExtension.java
index 5dcfd5f93..b22bb2fb4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegateExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IBreakpointOrganizerDelegateExtension.java
@@ -27,25 +27,25 @@ import org.eclipse.debug.core.model.IBreakpoint;
*/
public interface IBreakpointOrganizerDelegateExtension extends IBreakpointOrganizerDelegate {
- /**
- * Adds the specified breakpoints to the given category. Only called
- * if <code>canAdd(...)</code> returns <code>true</code> for the given
- * breakpoints and category.
- *
- * @param breakpoints breakpoints add
- * @param category the breakpoints' new category
- */
- void addBreakpoints(IBreakpoint[] breakpoints, IAdaptable category);
+ /**
+ * Adds the specified breakpoints to the given category. Only called
+ * if <code>canAdd(...)</code> returns <code>true</code> for the given
+ * breakpoints and category.
+ *
+ * @param breakpoints breakpoints add
+ * @param category the breakpoints' new category
+ */
+ void addBreakpoints(IBreakpoint[] breakpoints, IAdaptable category);
- /**
- * Removes the specified breakpoints from the given category. Only
- * called if <code>canRemove(...)</code> returns <code>true</code> for
- * the given breakpoints and category.
- *
- * @param breakpoints breakpoints to remove
- * @param category the category the breakpoint is remove from
- */
- void removeBreakpoints(IBreakpoint[] breakpoints, IAdaptable category);
+ /**
+ * Removes the specified breakpoints from the given category. Only
+ * called if <code>canRemove(...)</code> returns <code>true</code> for
+ * the given breakpoints and category.
+ *
+ * @param breakpoints breakpoints to remove
+ * @param category the category the breakpoint is remove from
+ */
+ void removeBreakpoints(IBreakpoint[] breakpoints, IAdaptable category);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
index cfb8d5028..58be140f4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
@@ -243,8 +243,8 @@ public interface IDebugUIConstants {
/**
* The default value of the {@link IDebugUIConstants#PREF_MANAGE_VIEW_PERSPECTIVES} preference.
*
- * @see IDebugUIConstants#PREF_MANAGE_VIEW_PERSPECTIVES
- *
+ * @see IDebugUIConstants#PREF_MANAGE_VIEW_PERSPECTIVES
+ *
* @since 3.5
*/
String PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT= "DEFAULT"; //$NON-NLS-1$
@@ -283,11 +283,11 @@ public interface IDebugUIConstants {
*/
String ID_REGISTER_VIEW= "org.eclipse.debug.ui.RegisterView"; //$NON-NLS-1$
- /**
- * Module view identifier (value <code>"org.eclipse.debug.ui.ModuleView"</code>).
- * @since 3.4
- */
- String ID_MODULE_VIEW= "org.eclipse.debug.ui.ModuleView"; //$NON-NLS-1$
+ /**
+ * Module view identifier (value <code>"org.eclipse.debug.ui.ModuleView"</code>).
+ * @since 3.4
+ */
+ String ID_MODULE_VIEW= "org.eclipse.debug.ui.ModuleView"; //$NON-NLS-1$
/**
* Console view identifier (value <code>"org.eclipse.debug.ui.ConsoleView"</code>).
@@ -334,8 +334,8 @@ public interface IDebugUIConstants {
*/
String IMG_ACT_RUN= "IMG_ACT_RUN"; //$NON-NLS-1$
- /** "Link with View" action image identifier. */
- String IMG_ACT_SYNCED= "IMG_ACT_SYNCED"; //$NON-NLS-1$
+ /** "Link with View" action image identifier. */
+ String IMG_ACT_SYNCED= "IMG_ACT_SYNCED"; //$NON-NLS-1$
/** "Skip Breakpoints" action image identifier */
String IMG_SKIP_BREAKPOINTS= "IMG_SKIP_BREAKPOINTS"; //$NON-NLS-1$
@@ -367,12 +367,12 @@ public interface IDebugUIConstants {
*/
String IMG_LCL_LOCK = "IMG_LCL_LOCK"; //$NON-NLS-1$
- /**
- * Add action image identifier.
- *
- * @since 3.8
- */
- String IMG_LCL_ADD = "IMG_LCL_MONITOR_EXPRESSION"; //$NON-NLS-1$
+ /**
+ * Add action image identifier.
+ *
+ * @since 3.8
+ */
+ String IMG_LCL_ADD = "IMG_LCL_MONITOR_EXPRESSION"; //$NON-NLS-1$
/**
* Remove all action image identifier
@@ -381,12 +381,12 @@ public interface IDebugUIConstants {
*/
String IMG_LCL_REMOVE_ALL = "IMG_LCL_REMOVE_ALL"; //$NON-NLS-1$
- /**
- * Remove action image identifier
- *
- * @since 3.2
- */
- String IMG_LCL_REMOVE = "IMG_LCL_REMOVE"; //$NON-NLS-1$
+ /**
+ * Remove action image identifier
+ *
+ * @since 3.2
+ */
+ String IMG_LCL_REMOVE = "IMG_LCL_REMOVE"; //$NON-NLS-1$
/**
* Content assist action image identifier.
@@ -615,11 +615,11 @@ public interface IDebugUIConstants {
/** Error overlay image identifier. */
String IMG_OVR_ERROR = "IMG_OVR_ERROR"; //$NON-NLS-1$
- /**
- * Skip breakpoint image overlay identifier.
- * @since 3.1
- */
- String IMG_OVR_SKIP_BREAKPOINT = "IMG_OVR_SKIP_BREAKPOINT"; //$NON-NLS-1$
+ /**
+ * Skip breakpoint image overlay identifier.
+ * @since 3.1
+ */
+ String IMG_OVR_SKIP_BREAKPOINT = "IMG_OVR_SKIP_BREAKPOINT"; //$NON-NLS-1$
/**
* Prototype image overlay identifier.
@@ -633,22 +633,22 @@ public interface IDebugUIConstants {
*/
String DEBUG_ACTION_SET= PLUGIN_ID + ".debugActionSet"; //$NON-NLS-1$
- /**
- * Debug Toolbar action set identifier (value <code>"org.eclipse.debug.ui.debugToolbarActionSet"</code>).
- *
- * @since 3.8
- */
- String DEBUG_TOOLBAR_ACTION_SET= PLUGIN_ID + ".debugToolbarActionSet"; //$NON-NLS-1$
+ /**
+ * Debug Toolbar action set identifier (value <code>"org.eclipse.debug.ui.debugToolbarActionSet"</code>).
+ *
+ * @since 3.8
+ */
+ String DEBUG_TOOLBAR_ACTION_SET= PLUGIN_ID + ".debugToolbarActionSet"; //$NON-NLS-1$
- /**
- * System property which indicates whether the common debugging actions
- * should be shown in the Debug view, as opposed to the top level
- * toolbar. Actions contributing to the debug view can use this property
- * to control their visibility.
- *
- * @since 3.8
- */
- String DEBUG_VIEW_TOOBAR_VISIBLE = PLUGIN_ID + ".debugViewToolbarVisible"; //$NON-NLS-1$
+ /**
+ * System property which indicates whether the common debugging actions
+ * should be shown in the Debug view, as opposed to the top level
+ * toolbar. Actions contributing to the debug view can use this property
+ * to control their visibility.
+ *
+ * @since 3.8
+ */
+ String DEBUG_VIEW_TOOBAR_VISIBLE = PLUGIN_ID + ".debugViewToolbarVisible"; //$NON-NLS-1$
/**
* Launch action set identifier (value <code>"org.eclipse.debug.ui.launchActionSet"</code>).
@@ -822,18 +822,18 @@ public interface IDebugUIConstants {
*/
String REGISTER_GROUP = "registerGroup"; //$NON-NLS-1$
- /**
- * Identifier for an empty group preceding a
- * modules group in a menu (value <code>"emptyModulesGroup"</code>).
- * @since 3.4
- */
- String EMPTY_MODULES_GROUP = "emptyModulesGroup"; //$NON-NLS-1$
+ /**
+ * Identifier for an empty group preceding a
+ * modules group in a menu (value <code>"emptyModulesGroup"</code>).
+ * @since 3.4
+ */
+ String EMPTY_MODULES_GROUP = "emptyModulesGroup"; //$NON-NLS-1$
- /**
- * Identifier for a modules group in a menu (value <code>"modulesGroup"</code>).
- * @since 3.4
- */
- String MODULES_GROUP = "modulesGroup"; //$NON-NLS-1$
+ /**
+ * Identifier for a modules group in a menu (value <code>"modulesGroup"</code>).
+ * @since 3.4
+ */
+ String MODULES_GROUP = "modulesGroup"; //$NON-NLS-1$
/**
* Id for the popup menu associated with the variables (tree viewer) part of the VariableView
@@ -953,7 +953,7 @@ public interface IDebugUIConstants {
* from {@link org.eclipse.ui.WorkbenchEncoding}.
*
* @since 3.1
- * @deprecated in 3.3 Please use DebugPlugin.ATTR_CONSOLE_ENCODING instead.
+ * @deprecated in 3.3 Please use DebugPlugin.ATTR_CONSOLE_ENCODING instead.
*/
@Deprecated String ATTR_CONSOLE_ENCODING = DebugPlugin.ATTR_CONSOLE_ENCODING;
@@ -1086,35 +1086,35 @@ public interface IDebugUIConstants {
/**
* Variable value editors extension point identifier (value
* <code>"variableValueEditors"</code>
- *
- * @since 3.1
+ *
+ * @since 3.1
*/
String EXTENSION_POINT_VARIABLE_VALUE_EDITORS = "variableValueEditors"; //$NON-NLS-1$
- /**
- * Memory renderings extension point identifier (value
- * <code>"memoryRenderings"</code>
- *
- * @since 3.1
- * @deprecated As of release 3.4, replaced by {@link #EXTENSION_POINT_MEMORY_RENDERINGS}
- */
- @Deprecated String EXTENSION_POINT_MEMORY_RENDERIGNS = "memoryRenderings"; //$NON-NLS-1$
-
- /**
- * Memory renderings extension point identifier (value
- * <code>"memoryRenderings"</code>
- *
- * @since 3.4
- */
- String EXTENSION_POINT_MEMORY_RENDERINGS = "memoryRenderings"; //$NON-NLS-1$
-
- /**
- * Breakpoint organizers extension point identifier (value
- * <code>"breakpointOrganizers"</code>
- *
- * @since 3.1
- */
- String EXTENSION_POINT_BREAKPOINT_ORGANIZERS = "breakpointOrganizers"; //$NON-NLS-1$
+ /**
+ * Memory renderings extension point identifier (value
+ * <code>"memoryRenderings"</code>
+ *
+ * @since 3.1
+ * @deprecated As of release 3.4, replaced by {@link #EXTENSION_POINT_MEMORY_RENDERINGS}
+ */
+ @Deprecated String EXTENSION_POINT_MEMORY_RENDERIGNS = "memoryRenderings"; //$NON-NLS-1$
+
+ /**
+ * Memory renderings extension point identifier (value
+ * <code>"memoryRenderings"</code>
+ *
+ * @since 3.4
+ */
+ String EXTENSION_POINT_MEMORY_RENDERINGS = "memoryRenderings"; //$NON-NLS-1$
+
+ /**
+ * Breakpoint organizers extension point identifier (value
+ * <code>"breakpointOrganizers"</code>
+ *
+ * @since 3.1
+ */
+ String EXTENSION_POINT_BREAKPOINT_ORGANIZERS = "breakpointOrganizers"; //$NON-NLS-1$
/**
* Simple identifier constant (value <code>"detailPaneFactories"</code>) for the
@@ -1124,21 +1124,21 @@ public interface IDebugUIConstants {
*/
String EXTENSION_POINT_DETAIL_FACTORIES = "detailPaneFactories"; //$NON-NLS-1$
- /**
- * Simple identifier constant (value <code>"toggleBreakpointsTargetFactories"</code>) for the
- * toggle breakpoint targets extension point.
- *
- * @since 3.5
- */
- String EXTENSION_POINT_TOGGLE_BREAKPOINTS_TARGET_FACTORIES = "toggleBreakpointsTargetFactories"; //$NON-NLS-1$
+ /**
+ * Simple identifier constant (value <code>"toggleBreakpointsTargetFactories"</code>) for the
+ * toggle breakpoint targets extension point.
+ *
+ * @since 3.5
+ */
+ String EXTENSION_POINT_TOGGLE_BREAKPOINTS_TARGET_FACTORIES = "toggleBreakpointsTargetFactories"; //$NON-NLS-1$
- /**
- * Update policies extension point identifier (value
- * <code>"updatePolicies"</code>
- *
- * @since 3.2
- */
- String EXTENSION_POINT_UPDATE_POLICIES = "updatePolicies"; //$NON-NLS-1$
+ /**
+ * Update policies extension point identifier (value
+ * <code>"updatePolicies"</code>
+ *
+ * @since 3.2
+ */
+ String EXTENSION_POINT_UPDATE_POLICIES = "updatePolicies"; //$NON-NLS-1$
/**
* Padded string preference for renderings. Padded string is the string to be used in place of
@@ -1215,25 +1215,25 @@ public interface IDebugUIConstants {
*/
String PREF_MEMORY_HISTORY_KNOWN_COLOR = PLUGIN_ID + ".MemoryHistoryKnownColor"; //$NON-NLS-1$
- /**
- * Annotation type identifier for default annotation of the current instruction
- * pointer (top stack frame in a thread). Value is <code>org.eclipse.debug.ui.currentIP</code>,
- * identifying a <code>org.eclipse.ui.editors.markerAnnotationSpecification</code>
- * extension.
- *
- * @since 3.2
- */
- String ANNOTATION_TYPE_INSTRUCTION_POINTER_CURRENT = "org.eclipse.debug.ui.currentIP"; //$NON-NLS-1$
-
- /**
- * Annotation type identifier for default annotation of secondary instruction pointers
- * (non top stack frames). Value is <code>org.eclipse.debug.ui.secondaryIP</code>,
- * identifying a <code>org.eclipse.ui.editors.markerAnnotationSpecification</code>
- * extension.
- *
- * @since 3.2
- */
- String ANNOTATION_TYPE_INSTRUCTION_POINTER_SECONDARY = "org.eclipse.debug.ui.secondaryIP"; //$NON-NLS-1$
+ /**
+ * Annotation type identifier for default annotation of the current instruction
+ * pointer (top stack frame in a thread). Value is <code>org.eclipse.debug.ui.currentIP</code>,
+ * identifying a <code>org.eclipse.ui.editors.markerAnnotationSpecification</code>
+ * extension.
+ *
+ * @since 3.2
+ */
+ String ANNOTATION_TYPE_INSTRUCTION_POINTER_CURRENT = "org.eclipse.debug.ui.currentIP"; //$NON-NLS-1$
+
+ /**
+ * Annotation type identifier for default annotation of secondary instruction pointers
+ * (non top stack frames). Value is <code>org.eclipse.debug.ui.secondaryIP</code>,
+ * identifying a <code>org.eclipse.ui.editors.markerAnnotationSpecification</code>
+ * extension.
+ *
+ * @since 3.2
+ */
+ String ANNOTATION_TYPE_INSTRUCTION_POINTER_SECONDARY = "org.eclipse.debug.ui.secondaryIP"; //$NON-NLS-1$
/**
* Editor Identifier for the "Common Source Not Found" editor.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java
index 1de69c906..55705c994 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java
@@ -155,8 +155,8 @@ public interface IDebugView extends IViewPart {
/**
* Removes the given IUpdate from this view's collection of updatable
* objects.
- * Has no effect if an identical IUpdate was not already registered.
- *
+ * Has no effect if an identical IUpdate was not already registered.
+ *
* @param updatable The IUpdate instance to be removed
*/
void remove(IUpdate updatable);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java
index 08d7080fc..566b0a1fc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java
@@ -45,5 +45,5 @@ public interface IDetailPane3 extends IDetailPane, ISaveablePart {
*
* @param listener a property listener
*/
- void removePropertyListener(IPropertyListener listener);
+ void removePropertyListener(IPropertyListener listener);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IInstructionPointerPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IInstructionPointerPresentation.java
index 4db95a9ce..69e86b68b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IInstructionPointerPresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IInstructionPointerPresentation.java
@@ -68,7 +68,7 @@ public interface IInstructionPointerPresentation extends IDebugModelPresentation
/**
* Returns an annotation used for the specified stack frame in the specified
* editor, or <code>null</code> if a default annotation should be used.
- *
+ *
* @param editorPart the editor the debugger has opened
* @param frame the stack frame for which the debugger is displaying
* source
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java
index d9f4ab287..4977ccc0f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java
@@ -17,15 +17,15 @@ import org.eclipse.jface.operation.IRunnableContext;
/**
- * A launch configuration dialog is used to edit and launch
- * launch configurations. It contains a launch configuration
- * tab group.
- * @see ILaunchConfigurationTabGroup
- * @see ILaunchConfigurationTab
- * @since 2.0
+ * A launch configuration dialog is used to edit and launch
+ * launch configurations. It contains a launch configuration
+ * tab group.
+ * @see ILaunchConfigurationTabGroup
+ * @see ILaunchConfigurationTab
+ * @since 2.0
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
- */
+ */
public interface ILaunchConfigurationDialog extends IRunnableContext {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
index a07bb3d42..244d2d55f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
@@ -68,88 +68,88 @@ public class InspectPopupDialog extends DebugPopup {
private static final String PREF_INSPECT_POPUP_SASH_WEIGHTS = DebugUIPlugin.getUniqueIdentifier() + "inspectPopupSashWeights"; //$NON-NLS-1$
private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 75, 25 };
- private static final int MIN_WIDTH = 300;
- private static final int MIN_HEIGHT = 250;
-
- private IPresentationContext fContext;
- private TreeModelViewer fViewer;
- private SashForm fSashForm;
- private Composite fDetailPaneComposite;
- private DetailPaneProxy fDetailPane;
- private Tree fTree;
- private IExpression fExpression;
-
- /**
- * Creates a new inspect popup.
- *
- * @param shell The parent shell
- * @param anchor point at which to anchor the popup in Display coordinates. Since
- * 3.3 <code>null</code> indicates a default location should be used.
- * @param commandId The command id to be used for persistence of
- * the dialog (possibly <code>null</code>)
- * @param expression The expression being inspected
- */
- public InspectPopupDialog(Shell shell, Point anchor, String commandId, IExpression expression) {
- super(shell, anchor, commandId);
- fExpression = expression;
- }
-
- @Override
+ private static final int MIN_WIDTH = 300;
+ private static final int MIN_HEIGHT = 250;
+
+ private IPresentationContext fContext;
+ private TreeModelViewer fViewer;
+ private SashForm fSashForm;
+ private Composite fDetailPaneComposite;
+ private DetailPaneProxy fDetailPane;
+ private Tree fTree;
+ private IExpression fExpression;
+
+ /**
+ * Creates a new inspect popup.
+ *
+ * @param shell The parent shell
+ * @param anchor point at which to anchor the popup in Display coordinates. Since
+ * 3.3 <code>null</code> indicates a default location should be used.
+ * @param commandId The command id to be used for persistence of
+ * the dialog (possibly <code>null</code>)
+ * @param expression The expression being inspected
+ */
+ public InspectPopupDialog(Shell shell, Point anchor, String commandId, IExpression expression) {
+ super(shell, anchor, commandId);
+ fExpression = expression;
+ }
+
+ @Override
protected Control createDialogArea(Composite parent) {
- Composite composite = new Composite(parent, parent.getStyle());
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- fSashForm = new SashForm(composite, parent.getStyle());
- fSashForm.setOrientation(SWT.VERTICAL);
- fSashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- VariablesView view = getViewToEmulate();
- fContext = new PresentationContext(IDebugUIConstants.ID_VARIABLE_VIEW, view);
- if (view != null) {
- // copy over properties
- IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext();
- String[] properties = copy.getProperties();
- for (int i = 0; i < properties.length; i++) {
+ Composite composite = new Composite(parent, parent.getStyle());
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ fSashForm = new SashForm(composite, parent.getStyle());
+ fSashForm.setOrientation(SWT.VERTICAL);
+ fSashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ VariablesView view = getViewToEmulate();
+ fContext = new PresentationContext(IDebugUIConstants.ID_VARIABLE_VIEW, view);
+ if (view != null) {
+ // copy over properties
+ IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext();
+ String[] properties = copy.getProperties();
+ for (int i = 0; i < properties.length; i++) {
String key = properties[i];
fContext.setProperty(key, copy.getProperty(key));
}
- }
- fViewer = new TreeModelViewer(fSashForm, SWT.NO_TRIM | SWT.MULTI | SWT.VIRTUAL, fContext);
- fViewer.setAutoExpandLevel(1);
+ }
+ fViewer = new TreeModelViewer(fSashForm, SWT.NO_TRIM | SWT.MULTI | SWT.VIRTUAL, fContext);
+ fViewer.setAutoExpandLevel(1);
- fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
+ fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
- fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
- fDetailPane.display(null); // Bring up the default pane so the user doesn't see an empty composite
+ fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
+ fDetailPane.display(null); // Bring up the default pane so the user doesn't see an empty composite
- fTree = fViewer.getTree();
- fTree.addSelectionListener(new SelectionListener() {
- @Override
+ fTree = fViewer.getTree();
+ fTree.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent e) {
fDetailPane.display(fViewer.getStructuredSelection());
- }
- @Override
+ }
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {}
- });
-
- initSashWeights();
-
- fViewer.getContentProvider();
- if (view != null) {
- StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
- if (structuredViewer != null) {
- ViewerFilter[] filters = structuredViewer.getFilters();
- for (int i = 0; i < filters.length; i++) {
- fViewer.addFilter(filters[i]);
- }
- }
- }
-
- TreeRoot treeRoot = new TreeRoot();
- // add update listener to auto-select and display details of root expression
- fViewer.addViewerUpdateListener(new IViewerUpdateListener() {
+ });
+
+ initSashWeights();
+
+ fViewer.getContentProvider();
+ if (view != null) {
+ StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
+ if (structuredViewer != null) {
+ ViewerFilter[] filters = structuredViewer.getFilters();
+ for (int i = 0; i < filters.length; i++) {
+ fViewer.addFilter(filters[i]);
+ }
+ }
+ }
+
+ TreeRoot treeRoot = new TreeRoot();
+ // add update listener to auto-select and display details of root expression
+ fViewer.addViewerUpdateListener(new IViewerUpdateListener() {
@Override
public void viewerUpdatesComplete() {
}
@@ -169,58 +169,58 @@ public class InspectPopupDialog extends DebugPopup {
}
}
});
- fViewer.setInput(treeRoot);
-
- return fTree;
- }
-
- /**
- * Initializes the sash form weights from the preference store (using default values if
- * no sash weights were stored previously).
- */
- protected void initSashWeights(){
- String prefWeights = DebugUIPlugin.getDefault().getPreferenceStore().getString(PREF_INSPECT_POPUP_SASH_WEIGHTS);
- if (prefWeights.length() > 0){
- String[] weights = prefWeights.split(":"); //$NON-NLS-1$
- if (weights.length == 2){
- try{
- int[] intWeights = new int[2];
- intWeights[0] = Integer.parseInt(weights[0]);
- intWeights[1] = Integer.parseInt(weights[1]);
- fSashForm.setWeights(intWeights);
- return;
- } catch (NumberFormatException e){}
- }
- }
- fSashForm.setWeights(DEFAULT_SASH_WEIGHTS);
- }
-
- @Override
+ fViewer.setInput(treeRoot);
+
+ return fTree;
+ }
+
+ /**
+ * Initializes the sash form weights from the preference store (using default values if
+ * no sash weights were stored previously).
+ */
+ protected void initSashWeights(){
+ String prefWeights = DebugUIPlugin.getDefault().getPreferenceStore().getString(PREF_INSPECT_POPUP_SASH_WEIGHTS);
+ if (prefWeights.length() > 0){
+ String[] weights = prefWeights.split(":"); //$NON-NLS-1$
+ if (weights.length == 2){
+ try{
+ int[] intWeights = new int[2];
+ intWeights[0] = Integer.parseInt(weights[0]);
+ intWeights[1] = Integer.parseInt(weights[1]);
+ fSashForm.setWeights(intWeights);
+ return;
+ } catch (NumberFormatException e){}
+ }
+ }
+ fSashForm.setWeights(DEFAULT_SASH_WEIGHTS);
+ }
+
+ @Override
protected void saveDialogBounds(Shell shell) {
- super.saveDialogBounds(shell);
- if (fSashForm != null && !fSashForm.isDisposed()){
- int[] weights = fSashForm.getWeights();
- if (weights.length == 2){
- String weightString = weights[0] + ":" + weights[1]; //$NON-NLS-1$
- IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
- if(node != null) {
- node.put(PREF_INSPECT_POPUP_SASH_WEIGHTS, weightString);
- try {
+ super.saveDialogBounds(shell);
+ if (fSashForm != null && !fSashForm.isDisposed()){
+ int[] weights = fSashForm.getWeights();
+ if (weights.length == 2){
+ String weightString = weights[0] + ":" + weights[1]; //$NON-NLS-1$
+ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
+ if(node != null) {
+ node.put(PREF_INSPECT_POPUP_SASH_WEIGHTS, weightString);
+ try {
node.flush();
} catch (BackingStoreException e) {
DebugUIPlugin.log(e);
}
- }
- }
- }
- }
-
- /**
- * Creates the content for the root element of the tree viewer in the inspect
- * popup dialog. Always has one child, the expression this popup is displaying.
- *
- */
- private class TreeRoot extends ElementContentProvider {
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates the content for the root element of the tree viewer in the inspect
+ * popup dialog. Always has one child, the expression this popup is displaying.
+ *
+ */
+ private class TreeRoot extends ElementContentProvider {
@Override
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
return 1;
@@ -234,69 +234,69 @@ public class InspectPopupDialog extends DebugPopup {
protected boolean supportsContextId(String id) {
return true;
}
- }
-
- /**
- * Attempts to find an appropriate view to emulate, this will either be the
- * variables view or the expressions view.
- * @return a view to emulate or <code>null</code>
- */
- private VariablesView getViewToEmulate() {
- IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
- VariablesView expressionsView = (VariablesView) page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- if (expressionsView != null && expressionsView.isVisible()) {
- return expressionsView;
- }
- VariablesView variablesView = (VariablesView) page.findView(IDebugUIConstants.ID_VARIABLE_VIEW);
- if (variablesView != null && variablesView.isVisible()) {
- return variablesView;
- }
- if (expressionsView != null) {
- return expressionsView;
- }
- return variablesView;
- }
-
- @Override
+ }
+
+ /**
+ * Attempts to find an appropriate view to emulate, this will either be the
+ * variables view or the expressions view.
+ * @return a view to emulate or <code>null</code>
+ */
+ private VariablesView getViewToEmulate() {
+ IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ VariablesView expressionsView = (VariablesView) page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ if (expressionsView != null && expressionsView.isVisible()) {
+ return expressionsView;
+ }
+ VariablesView variablesView = (VariablesView) page.findView(IDebugUIConstants.ID_VARIABLE_VIEW);
+ if (variablesView != null && variablesView.isVisible()) {
+ return variablesView;
+ }
+ if (expressionsView != null) {
+ return expressionsView;
+ }
+ return variablesView;
+ }
+
+ @Override
public boolean close() {
- if (!wasPersisted()) {
- fExpression.dispose();
- }
- fDetailPane.dispose();
- fContext.dispose();
+ if (!wasPersisted()) {
+ fExpression.dispose();
+ }
+ fDetailPane.dispose();
+ fContext.dispose();
return super.close();
}
- @Override
+ @Override
protected String getActionText() {
return DebugUIViewsMessages.InspectPopupDialog_0;
}
- @Override
+ @Override
protected void persist() {
- super.persist();
- DebugPlugin.getDefault().getExpressionManager().addExpression(fExpression);
-
- fExpression = null;
- IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
- IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- if (part == null) {
- try {
- page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- } catch (PartInitException e) {
- }
- } else {
- page.bringToTop(part);
- }
- }
-
- @Override
+ super.persist();
+ DebugPlugin.getDefault().getExpressionManager().addExpression(fExpression);
+
+ fExpression = null;
+ IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ if (part == null) {
+ try {
+ page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
+ } catch (PartInitException e) {
+ }
+ } else {
+ page.bringToTop(part);
+ }
+ }
+
+ @Override
protected Point getInitialSize() {
- Point initialSize = super.getInitialSize();
- initialSize.x = Math.max(initialSize.x, MIN_WIDTH);
- initialSize.y = Math.max(initialSize.y, MIN_HEIGHT);
- return initialSize;
- }
+ Point initialSize = super.getInitialSize();
+ initialSize.x = Math.max(initialSize.x, MIN_WIDTH);
+ initialSize.y = Math.max(initialSize.y, MIN_HEIGHT);
+ return initialSize;
+ }
@Override
protected List<Control> getBackgroundColorExclusions() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
index b6c7ddb2d..8db2295f0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
@@ -355,12 +355,12 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
String text = null;
if (objects.length == 1) {
IStringVariable variable = (IStringVariable)objects[0];
- IArgumentSelector selector = StringVariablePresentationManager.getDefault().getArgumentSelector(variable);
- if (variable instanceof IDynamicVariable) {
- argEnabled = ((IDynamicVariable)variable).supportsArgument();
- }
- buttonEnabled = argEnabled && selector != null;
- text = variable.getDescription();
+ IArgumentSelector selector = StringVariablePresentationManager.getDefault().getArgumentSelector(variable);
+ if (variable instanceof IDynamicVariable) {
+ argEnabled = ((IDynamicVariable)variable).supportsArgument();
+ }
+ buttonEnabled = argEnabled && selector != null;
+ text = variable.getDescription();
}
if (text == null) {
text = IInternalDebugCoreConstants.EMPTY_STRING;
@@ -385,13 +385,13 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
return IDebugUIConstants.PLUGIN_ID + ".STRING_VARIABLE_SELECTION_DIALOG_SECTION"; //$NON-NLS-1$
}
- @Override
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
- if (section == null) {
- section = settings.addNewSection(getDialogSettingsSectionName());
- }
- return section;
- }
+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
+ if (section == null) {
+ section = settings.addNewSection(getDialogSettingsSectionName());
+ }
+ return section;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java
index 7e66963da..b071075f9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java
@@ -209,9 +209,9 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT
* the workspace
*/
private void handleWorkspaceDirBrowseButtonSelected() {
- IContainer currentContainer= getContainer();
+ IContainer currentContainer= getContainer();
if (currentContainer == null) {
- currentContainer = ResourcesPlugin.getWorkspace().getRoot();
+ currentContainer = ResourcesPlugin.getWorkspace().getRoot();
}
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), currentContainer, false, DebugUIMessages.WorkingDirectoryBlock_4);
dialog.showClosedProjects(false);
@@ -231,23 +231,23 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT
protected IContainer getContainer() {
String path = getWorkingDirectoryText();
if (path.length() > 0) {
- IResource res = null;
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if (path.startsWith("${workspace_loc:")) { //$NON-NLS-1$
- IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
- try {
- path = manager.performStringSubstitution(path, false);
- IPath uriPath = new Path(path).makeAbsolute();
- IContainer[] containers = root.findContainersForLocationURI(URIUtil.toURI(uriPath));
- if (containers.length > 0) {
- res = containers[0];
- }
- }
- catch (CoreException e) {
- log(e);
- }
+ IResource res = null;
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if (path.startsWith("${workspace_loc:")) { //$NON-NLS-1$
+ IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
+ try {
+ path = manager.performStringSubstitution(path, false);
+ IPath uriPath = new Path(path).makeAbsolute();
+ IContainer[] containers = root.findContainersForLocationURI(URIUtil.toURI(uriPath));
+ if (containers.length > 0) {
+ res = containers[0];
+ }
+ }
+ catch (CoreException e) {
+ log(e);
+ }
}
- else {
+ else {
res = root.findMember(path);
}
if (res instanceof IContainer) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
index b0095ab7c..30eba5386 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java
@@ -259,9 +259,9 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
if (fMenuCreator == null) {
fMenuCreator = new AddMemoryRenderingMenuCreator();
}
- action.setMenuCreator(fMenuCreator);
- fAction= action;
- }
+ action.setMenuCreator(fMenuCreator);
+ fAction= action;
+ }
}
private IAddMemoryRenderingsTarget getAddMemoryRenderingTarget(Object elmt) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java
index 8ff311d3f..e652248c1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java
@@ -74,30 +74,30 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public class BreakpointTypesContribution extends CompoundContributionItem implements IWorkbenchContribution {
- private class SelectTargetAction extends Action {
+ private class SelectTargetAction extends Action {
private final Set<String> fPossibleIDs;
- private final String fID;
+ private final String fID;
SelectTargetAction(String name, Set<String> possibleIDs, String ID) {
- super(name, AS_RADIO_BUTTON);
- fID = ID;
- fPossibleIDs = possibleIDs;
- }
+ super(name, AS_RADIO_BUTTON);
+ fID = ID;
+ fPossibleIDs = possibleIDs;
+ }
- @Override
+ @Override
public void run() {
- if (isChecked()) {
- // Note: setPreferredTarget is not declared on the
- // IToggleBreakpontsTargetManager interface.
- ToggleBreakpointsTargetManager.getDefault().setPreferredTarget(fPossibleIDs, fID);
- }
- }
- }
-
- private IServiceLocator fServiceLocator;
-
- private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] {
- new ContributionItem() {
+ if (isChecked()) {
+ // Note: setPreferredTarget is not declared on the
+ // IToggleBreakpontsTargetManager interface.
+ ToggleBreakpointsTargetManager.getDefault().setPreferredTarget(fPossibleIDs, fID);
+ }
+ }
+ }
+
+ private IServiceLocator fServiceLocator;
+
+ private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] {
+ new ContributionItem() {
@Override
public void fill(Menu menu, int index) {
MenuItem item = new MenuItem(menu, SWT.NONE);
@@ -109,56 +109,56 @@ public class BreakpointTypesContribution extends CompoundContributionItem implem
public boolean isEnabled() {
return false;
}
- }
- };
+ }
+ };
- @Override
+ @Override
protected IContributionItem[] getContributionItems() {
- IWorkbenchPart part = null;
- ISelection selection = null;
-
- ISelectionService selectionService =
- fServiceLocator.getService(ISelectionService.class);
- if (selectionService != null) {
- selection = selectionService.getSelection();
- }
- IPartService partService = fServiceLocator.getService(IPartService.class);
- if (partService != null) {
- part = partService.getActivePart();
- }
-
- // If no part or selection, disable all.
- if (part == null || selection == null) {
- return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
- }
-
- // Get breakpoint toggle target IDs.
- IToggleBreakpointsTargetManager manager = DebugUITools.getToggleBreakpointsTargetManager();
+ IWorkbenchPart part = null;
+ ISelection selection = null;
+
+ ISelectionService selectionService =
+ fServiceLocator.getService(ISelectionService.class);
+ if (selectionService != null) {
+ selection = selectionService.getSelection();
+ }
+ IPartService partService = fServiceLocator.getService(IPartService.class);
+ if (partService != null) {
+ part = partService.getActivePart();
+ }
+
+ // If no part or selection, disable all.
+ if (part == null || selection == null) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+
+ // Get breakpoint toggle target IDs.
+ IToggleBreakpointsTargetManager manager = DebugUITools.getToggleBreakpointsTargetManager();
Set<String> enabledIDs = manager.getEnabledToggleBreakpointsTargetIDs(part, selection);
- String preferredId = manager.getPreferredToggleBreakpointsTargetID(part, selection);
+ String preferredId = manager.getPreferredToggleBreakpointsTargetID(part, selection);
List<Action> actions = new ArrayList<>(enabledIDs.size());
for (String id : enabledIDs) {
- Action action = new SelectTargetAction(manager.getToggleBreakpointsTargetName(id), enabledIDs, id);
- if (id.equals(preferredId)) {
- action.setChecked(true);
- }
- actions.add(action);
- }
-
- if ( enabledIDs.isEmpty() ) {
- return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
- }
-
- IContributionItem[] items = new IContributionItem[enabledIDs.size()];
- for (int i = 0; i < actions.size(); i++) {
- items[i] = new ActionContributionItem(actions.get(i));
- }
- return items;
- }
-
- @Override
+ Action action = new SelectTargetAction(manager.getToggleBreakpointsTargetName(id), enabledIDs, id);
+ if (id.equals(preferredId)) {
+ action.setChecked(true);
+ }
+ actions.add(action);
+ }
+
+ if ( enabledIDs.isEmpty() ) {
+ return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
+ }
+
+ IContributionItem[] items = new IContributionItem[enabledIDs.size()];
+ for (int i = 0; i < actions.size(); i++) {
+ items[i] = new ActionContributionItem(actions.get(i));
+ }
+ return items;
+ }
+
+ @Override
public void initialize(IServiceLocator serviceLocator) {
- fServiceLocator = serviceLocator;
- }
+ fServiceLocator = serviceLocator;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java
index e0c837f28..a763267c5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java
@@ -179,10 +179,10 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I
return DebugPlugin.getDefault().getLaunchManager();
}
- /**
- * Fills the menu with applicable launch shortcuts
- * @param menu The menu to fill
- */
+ /**
+ * Fills the menu with applicable launch shortcuts
+ * @param menu The menu to fill
+ */
protected void fillMenu(Menu menu) {
IStructuredSelection ss = SelectedResourceManager.getDefault().getCurrentSelection();
int accelerator = 1;
@@ -190,10 +190,10 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I
try {
//try to add the shared config it the context is one.
ILaunchConfiguration config = getLaunchConfigurationManager().isSharedConfig(ss.getFirstElement());
- if(config != null && config.exists() && config.supportsMode(fMode)) {
- IAction action = new LaunchConfigurationAction(config, fMode, config.getName(), DebugUITools.getDefaultImageDescriptor(config), accelerator++);
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(menu, -1);
+ if(config != null && config.exists() && config.supportsMode(fMode)) {
+ IAction action = new LaunchConfigurationAction(config, fMode, config.getName(), DebugUITools.getDefaultImageDescriptor(config), accelerator++);
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(menu, -1);
}
}
catch (CoreException ce) {}
@@ -247,8 +247,8 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I
new MenuItem(menu, SWT.SEPARATOR);
}
IAction action = new OpenLaunchDialogAction(fGroup.getIdentifier());
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(menu, -1);
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(menu, -1);
} else {
boolean addedSep = false;
for (String category : categories) {
@@ -261,9 +261,9 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I
new MenuItem(menu, SWT.SEPARATOR);
addedSep = true;
}
- IAction action = new OpenLaunchDialogAction(group.getIdentifier());
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(menu, -1);
+ IAction action = new OpenLaunchDialogAction(group.getIdentifier());
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(menu, -1);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java
index 641f6beda..c3ce545d2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java
@@ -59,275 +59,275 @@ import org.eclipse.ui.PlatformUI;
*/
public abstract class DebugCommandAction extends Action implements IDebugContextListener {
- private boolean fInitialized = false;
+ private boolean fInitialized = false;
/**
* The window this action is working for.
*/
- private IWorkbenchWindow fWindow;
-
- /**
- * The part this action is working for, or <code>null</code> if global to
- * a window.
- */
- private IWorkbenchPart fPart;
-
- /**
- * Command service.
- */
- private DebugCommandService fUpdateService;
-
- /**
- * Delegate this action is working for or <code>null</code> if none.
- */
- private IAction fAction;
-
- private IEnabledTarget fEnabledTarget = new IEnabledTarget() {
- @Override
+ private IWorkbenchWindow fWindow;
+
+ /**
+ * The part this action is working for, or <code>null</code> if global to
+ * a window.
+ */
+ private IWorkbenchPart fPart;
+
+ /**
+ * Command service.
+ */
+ private DebugCommandService fUpdateService;
+
+ /**
+ * Delegate this action is working for or <code>null</code> if none.
+ */
+ private IAction fAction;
+
+ private IEnabledTarget fEnabledTarget = new IEnabledTarget() {
+ @Override
public void setEnabled(boolean enabled) {
- DebugCommandAction.this.setEnabled(enabled);
- }
- };
-
- /**
- * Constructor
- */
- public DebugCommandAction() {
- super();
- String helpContextId = getHelpContextId();
- if (helpContextId != null) {
+ DebugCommandAction.this.setEnabled(enabled);
+ }
+ };
+
+ /**
+ * Constructor
+ */
+ public DebugCommandAction() {
+ super();
+ String helpContextId = getHelpContextId();
+ if (helpContextId != null) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, helpContextId);
}
- setEnabled(false);
- }
+ setEnabled(false);
+ }
/**
- * Sets the current workbench action that is a proxy to an {@link org.eclipse.ui.IActionDelegate}
- * that is using this action to perform its actual work. This only needs to be called when
- * an {@link org.eclipse.ui.IActionDelegate} is using one of these actions to perform its
- * function.
- *
- * @param action workbench proxy action
- */
- public void setActionProxy(IAction action) {
- fAction = action;
- fAction.setEnabled(isEnabled());
- }
-
- /**
- * Executes this action on the given target object
- * @param targets the targets to perform the action on
- * @return if the command stays enabled while the command executes
- */
- private boolean execute(final Object[] targets) {
- return fUpdateService.executeCommand(
- getCommandType(), targets,
- new ICommandParticipant() {
- @Override
+ * Sets the current workbench action that is a proxy to an {@link org.eclipse.ui.IActionDelegate}
+ * that is using this action to perform its actual work. This only needs to be called when
+ * an {@link org.eclipse.ui.IActionDelegate} is using one of these actions to perform its
+ * function.
+ *
+ * @param action workbench proxy action
+ */
+ public void setActionProxy(IAction action) {
+ fAction = action;
+ fAction.setEnabled(isEnabled());
+ }
+
+ /**
+ * Executes this action on the given target object
+ * @param targets the targets to perform the action on
+ * @return if the command stays enabled while the command executes
+ */
+ private boolean execute(final Object[] targets) {
+ return fUpdateService.executeCommand(
+ getCommandType(), targets,
+ new ICommandParticipant() {
+ @Override
public void requestDone(org.eclipse.debug.core.IRequest request) {
- DebugCommandAction.this.postExecute(request, targets);
- }
- });
- }
-
- /**
- * This method is called after the completion of the execution of this
- * command. Extending classes may override this method to perform additional
- * operation after command execution.
- *
- * @param request The completed request object which was given to the
- * debug command handler.
- * @param targets Objects which were the targets of this action
- */
- protected void postExecute(IRequest request, Object[] targets) {
- // do nothing by default
- }
-
- /**
- * Returns the {@link org.eclipse.debug.core.commands.IDebugCommandHandler}
- * command handler that type this action executes.
- *
- * @return command class.
- *
- * @see org.eclipse.debug.core.commands.IDebugCommandHandler
- */
+ DebugCommandAction.this.postExecute(request, targets);
+ }
+ });
+ }
+
+ /**
+ * This method is called after the completion of the execution of this
+ * command. Extending classes may override this method to perform additional
+ * operation after command execution.
+ *
+ * @param request The completed request object which was given to the
+ * debug command handler.
+ * @param targets Objects which were the targets of this action
+ */
+ protected void postExecute(IRequest request, Object[] targets) {
+ // do nothing by default
+ }
+
+ /**
+ * Returns the {@link org.eclipse.debug.core.commands.IDebugCommandHandler}
+ * command handler that type this action executes.
+ *
+ * @return command class.
+ *
+ * @see org.eclipse.debug.core.commands.IDebugCommandHandler
+ */
abstract protected Class<?> getCommandType();
- /**
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
- */
- @Override
+ /**
+ * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
+ */
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- fUpdateService.postUpdateCommand(getCommandType(), fEnabledTarget);
+ fUpdateService.postUpdateCommand(getCommandType(), fEnabledTarget);
}
- /**
- * @see org.eclipse.jface.action.Action#setEnabled(boolean)
- */
- @Override
+ /**
+ * @see org.eclipse.jface.action.Action#setEnabled(boolean)
+ */
+ @Override
public void setEnabled(boolean enabled) {
- synchronized (this) {
- if (!fInitialized) {
- fInitialized = true;
- notifyAll();
- }
- }
- super.setEnabled(enabled);
- if (fAction != null) {
- fAction.setEnabled(enabled);
- }
- }
-
- /**
- * Initializes this action for a specific part.
- *
- * @param part workbench part
- */
- public void init(IWorkbenchPart part) {
- fInitialized = false;
- fPart = part;
- fWindow = part.getSite().getWorkbenchWindow();
- fUpdateService = DebugCommandService.getService(fWindow);
- IDebugContextService service = getDebugContextService();
+ synchronized (this) {
+ if (!fInitialized) {
+ fInitialized = true;
+ notifyAll();
+ }
+ }
+ super.setEnabled(enabled);
+ if (fAction != null) {
+ fAction.setEnabled(enabled);
+ }
+ }
+
+ /**
+ * Initializes this action for a specific part.
+ *
+ * @param part workbench part
+ */
+ public void init(IWorkbenchPart part) {
+ fInitialized = false;
+ fPart = part;
+ fWindow = part.getSite().getWorkbenchWindow();
+ fUpdateService = DebugCommandService.getService(fWindow);
+ IDebugContextService service = getDebugContextService();
String partId = part.getSite().getId();
service.addDebugContextListener(this, partId);
- ISelection activeContext = service.getActiveContext(partId);
- if (activeContext != null) {
- fUpdateService.updateCommand(getCommandType(), fEnabledTarget);
- } else {
- setEnabled(getInitialEnablement());
- }
- }
-
- /**
- * Initializes this action for a workbench window.
- *
- * @param window the window
- */
- public void init(IWorkbenchWindow window) {
- fInitialized = false;
- fWindow = window;
- fUpdateService = DebugCommandService.getService(fWindow);
- IDebugContextService contextService = getDebugContextService();
+ ISelection activeContext = service.getActiveContext(partId);
+ if (activeContext != null) {
+ fUpdateService.updateCommand(getCommandType(), fEnabledTarget);
+ } else {
+ setEnabled(getInitialEnablement());
+ }
+ }
+
+ /**
+ * Initializes this action for a workbench window.
+ *
+ * @param window the window
+ */
+ public void init(IWorkbenchWindow window) {
+ fInitialized = false;
+ fWindow = window;
+ fUpdateService = DebugCommandService.getService(fWindow);
+ IDebugContextService contextService = getDebugContextService();
contextService.addDebugContextListener(this);
- ISelection activeContext = contextService.getActiveContext();
- if (activeContext != null) {
- fUpdateService.updateCommand(getCommandType(), fEnabledTarget);
- } else {
- setEnabled(getInitialEnablement());
- }
- }
-
- /**
- * Returns whether this action should be enabled when initialized
- * and there is no active debug context. By default, <code>false</code>
- * is returned.
- *
- * @return initial enabled state when there is no active context.
- */
- protected boolean getInitialEnablement() {
- return false;
- }
-
- /**
- * Returns the context (selection) this action operates on. By default
- * the active debug context in this action's associated part or window is used,
- * but subclasses may override as required.
- *
- * @return the context this action operates on
- * @since 3.7
- */
- protected ISelection getContext() {
+ ISelection activeContext = contextService.getActiveContext();
+ if (activeContext != null) {
+ fUpdateService.updateCommand(getCommandType(), fEnabledTarget);
+ } else {
+ setEnabled(getInitialEnablement());
+ }
+ }
+
+ /**
+ * Returns whether this action should be enabled when initialized
+ * and there is no active debug context. By default, <code>false</code>
+ * is returned.
+ *
+ * @return initial enabled state when there is no active context.
+ */
+ protected boolean getInitialEnablement() {
+ return false;
+ }
+
+ /**
+ * Returns the context (selection) this action operates on. By default
+ * the active debug context in this action's associated part or window is used,
+ * but subclasses may override as required.
+ *
+ * @return the context this action operates on
+ * @since 3.7
+ */
+ protected ISelection getContext() {
if (fPart != null) {
getDebugContextService().getActiveContext(fPart.getSite().getId());
- }
- return getDebugContextService().getActiveContext();
- }
+ }
+ return getDebugContextService().getActiveContext();
+ }
- @Override
+ @Override
public void run() {
- synchronized (this) {
- if (!fInitialized) {
- try {
- wait();
- } catch (InterruptedException e) {
- }
- }
- }
-
- ISelection selection = getContext();
- if (selection instanceof IStructuredSelection && isEnabled()) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- boolean enabled = execute(ss.toArray());
- // disable the action according to the command
- setEnabled(enabled);
- }
- }
-
- @Override
+ synchronized (this) {
+ if (!fInitialized) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ ISelection selection = getContext();
+ if (selection instanceof IStructuredSelection && isEnabled()) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ boolean enabled = execute(ss.toArray());
+ // disable the action according to the command
+ setEnabled(enabled);
+ }
+ }
+
+ @Override
public void runWithEvent(Event event) {
- run();
- }
-
- /**
- * Clean up when removing
- */
- public void dispose() {
- IDebugContextService service = getDebugContextService();
- if (fPart != null) {
- service.removeDebugContextListener(this, fPart.getSite().getId());
- } else {
- service.removeDebugContextListener(this);
- }
- fWindow = null;
- fPart = null;
- }
-
- /**
- * Returns the context service this action linked to. By default, this actions is
- * associated with the context service for the window this action is operating in.
- *
- * @return associated context service
- */
- protected IDebugContextService getDebugContextService() {
- return DebugUITools.getDebugContextManager().getContextService(fWindow);
- }
-
- /**
- * Returns the help context id for this action or <code>null</code> if none.
- *
- * @return The help context id for this action or <code>null</code>
- */
- public abstract String getHelpContextId();
-
- @Override
+ run();
+ }
+
+ /**
+ * Clean up when removing
+ */
+ public void dispose() {
+ IDebugContextService service = getDebugContextService();
+ if (fPart != null) {
+ service.removeDebugContextListener(this, fPart.getSite().getId());
+ } else {
+ service.removeDebugContextListener(this);
+ }
+ fWindow = null;
+ fPart = null;
+ }
+
+ /**
+ * Returns the context service this action linked to. By default, this actions is
+ * associated with the context service for the window this action is operating in.
+ *
+ * @return associated context service
+ */
+ protected IDebugContextService getDebugContextService() {
+ return DebugUITools.getDebugContextManager().getContextService(fWindow);
+ }
+
+ /**
+ * Returns the help context id for this action or <code>null</code> if none.
+ *
+ * @return The help context id for this action or <code>null</code>
+ */
+ public abstract String getHelpContextId();
+
+ @Override
public abstract String getId();
- @Override
+ @Override
public abstract String getText();
- @Override
+ @Override
public abstract String getToolTipText();
- @Override
+ @Override
public abstract ImageDescriptor getDisabledImageDescriptor();
- @Override
+ @Override
public abstract ImageDescriptor getHoverImageDescriptor();
- @Override
+ @Override
public abstract ImageDescriptor getImageDescriptor();
- /**
- * Returns the workbench proxy associated with this action or <code>null</code>
- * if none. This is the workbench proxy to an {@link org.eclipse.ui.IActionDelegate}
- * that is using this action to perform its actual work. This is only used when
- * an {@link org.eclipse.ui.IActionDelegate} is using one of these actions to perform its
- * function.
- *
- * @return workbench proxy action or <code>null</code>
- */
- protected IAction getActionProxy() {
- return fAction;
- }
+ /**
+ * Returns the workbench proxy associated with this action or <code>null</code>
+ * if none. This is the workbench proxy to an {@link org.eclipse.ui.IActionDelegate}
+ * that is using this action to perform its actual work. This is only used when
+ * an {@link org.eclipse.ui.IActionDelegate} is using one of these actions to perform its
+ * function.
+ *
+ * @return workbench proxy action or <code>null</code>
+ */
+ protected IAction getActionProxy() {
+ return fAction;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java
index 32a11b7aa..442bbc396 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java
@@ -61,228 +61,228 @@ import org.eclipse.ui.handlers.HandlerUtil;
*/
public abstract class DebugCommandHandler extends AbstractHandler {
- /**
- * The DebugCommandService is able to evaluate the command handler
- * enablement in each workbench window separately, however the workbench
- * command framework uses only a single handler instance for all windows.
- * This IEnabledTarget implementation tracks enablement of the command
- * for a given window. When the handler enablement is tested, the
- * currently active window is used to determine which enabled target
- * to use.
- */
- private class EnabledTarget implements IEnabledTarget, IDebugContextListener {
- boolean fEnabled = getInitialEnablement();
- IWorkbenchWindow fWindow;
-
- EnabledTarget(IWorkbenchWindow window) {
- fWindow = window;
+ /**
+ * The DebugCommandService is able to evaluate the command handler
+ * enablement in each workbench window separately, however the workbench
+ * command framework uses only a single handler instance for all windows.
+ * This IEnabledTarget implementation tracks enablement of the command
+ * for a given window. When the handler enablement is tested, the
+ * currently active window is used to determine which enabled target
+ * to use.
+ */
+ private class EnabledTarget implements IEnabledTarget, IDebugContextListener {
+ boolean fEnabled = getInitialEnablement();
+ IWorkbenchWindow fWindow;
+
+ EnabledTarget(IWorkbenchWindow window) {
+ fWindow = window;
}
void init() {
- DebugCommandService.getService(fWindow).updateCommand(getCommandType(), this);
- getContextService(fWindow).addDebugContextListener(this);
+ DebugCommandService.getService(fWindow).updateCommand(getCommandType(), this);
+ getContextService(fWindow).addDebugContextListener(this);
}
- @Override
+ @Override
public void setEnabled(boolean enabled) {
- boolean oldEnabled = fEnabled;
- fEnabled = enabled;
- if (fEnabled != oldEnabled && fCurrentEnabledTarget == this) {
- fireHandlerChanged(new HandlerEvent(DebugCommandHandler.this, true, false));
- }
- }
-
- @Override
+ boolean oldEnabled = fEnabled;
+ fEnabled = enabled;
+ if (fEnabled != oldEnabled && fCurrentEnabledTarget == this) {
+ fireHandlerChanged(new HandlerEvent(DebugCommandHandler.this, true, false));
+ }
+ }
+
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- DebugCommandService.getService(fWindow).postUpdateCommand(getCommandType(), this);
- }
-
- void dispose() {
- if (isDisposed()) {
- return;
- }
- getContextService(fWindow).removeDebugContextListener(this);
- fWindow = null;
- }
-
- boolean isDisposed() {
- return fWindow == null;
- }
- }
-
- /**
- * Window listener is used to make sure that the handler enablement
- * is updated when the active workbench window is changed.
- */
- private IWindowListener fWindowListener = new IWindowListener() {
-
- @Override
+ DebugCommandService.getService(fWindow).postUpdateCommand(getCommandType(), this);
+ }
+
+ void dispose() {
+ if (isDisposed()) {
+ return;
+ }
+ getContextService(fWindow).removeDebugContextListener(this);
+ fWindow = null;
+ }
+
+ boolean isDisposed() {
+ return fWindow == null;
+ }
+ }
+
+ /**
+ * Window listener is used to make sure that the handler enablement
+ * is updated when the active workbench window is changed.
+ */
+ private IWindowListener fWindowListener = new IWindowListener() {
+
+ @Override
public void windowOpened(IWorkbenchWindow w) {
- }
+ }
- @Override
+ @Override
public void windowDeactivated(IWorkbenchWindow w) {
- }
+ }
- @Override
+ @Override
public void windowClosed(IWorkbenchWindow w) {
- EnabledTarget enabledTarget = fEnabledTargetsMap.get(w);
- if (enabledTarget != null) {
- enabledTarget.dispose();
- }
- }
+ EnabledTarget enabledTarget = fEnabledTargetsMap.get(w);
+ if (enabledTarget != null) {
+ enabledTarget.dispose();
+ }
+ }
- @Override
+ @Override
public void windowActivated(IWorkbenchWindow w) {
- fCurrentEnabledTarget = fEnabledTargetsMap.get(w);
- fireHandlerChanged(new HandlerEvent(DebugCommandHandler.this, true, false));
- }
- };
-
- /**
- * Map of enabled targets keyed by workbench window.
- */
- private Map<IWorkbenchWindow, EnabledTarget> fEnabledTargetsMap = new WeakHashMap<>();
-
- /**
- * The current enabled target, based on the active
- * workbench window.
- */
- private EnabledTarget fCurrentEnabledTarget = null;
-
- /**
- * The constructor adds the handler as the
- */
- public DebugCommandHandler() {
- super();
- PlatformUI.getWorkbench().addWindowListener(fWindowListener);
- }
-
- @Override
+ fCurrentEnabledTarget = fEnabledTargetsMap.get(w);
+ fireHandlerChanged(new HandlerEvent(DebugCommandHandler.this, true, false));
+ }
+ };
+
+ /**
+ * Map of enabled targets keyed by workbench window.
+ */
+ private Map<IWorkbenchWindow, EnabledTarget> fEnabledTargetsMap = new WeakHashMap<>();
+
+ /**
+ * The current enabled target, based on the active
+ * workbench window.
+ */
+ private EnabledTarget fCurrentEnabledTarget = null;
+
+ /**
+ * The constructor adds the handler as the
+ */
+ public DebugCommandHandler() {
+ super();
+ PlatformUI.getWorkbench().addWindowListener(fWindowListener);
+ }
+
+ @Override
public void setEnabled(Object evaluationContext) {
- // This method is called with the current evaluation context
- // just prior to the isEnabled() being called. Check the active
- // window and update the current enabled target based on it
- fCurrentEnabledTarget = null;
-
- if (!(evaluationContext instanceof IEvaluationContext)) {
- return;
- }
- IEvaluationContext context = (IEvaluationContext) evaluationContext;
- Object _window = context.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
- if (_window instanceof IWorkbenchWindow) {
- IWorkbenchWindow window = (IWorkbenchWindow)_window;
- fCurrentEnabledTarget = getEnabledTarget(window);
- }
- }
-
- @Override
+ // This method is called with the current evaluation context
+ // just prior to the isEnabled() being called. Check the active
+ // window and update the current enabled target based on it
+ fCurrentEnabledTarget = null;
+
+ if (!(evaluationContext instanceof IEvaluationContext)) {
+ return;
+ }
+ IEvaluationContext context = (IEvaluationContext) evaluationContext;
+ Object _window = context.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
+ if (_window instanceof IWorkbenchWindow) {
+ IWorkbenchWindow window = (IWorkbenchWindow)_window;
+ fCurrentEnabledTarget = getEnabledTarget(window);
+ }
+ }
+
+ @Override
public boolean isEnabled() {
- if (fCurrentEnabledTarget == null) {
- return false;
- }
- return fCurrentEnabledTarget.fEnabled;
- }
-
- private EnabledTarget getEnabledTarget(IWorkbenchWindow window) {
- EnabledTarget target = fEnabledTargetsMap.get(window);
- if (target == null) {
- target = new EnabledTarget(window);
+ if (fCurrentEnabledTarget == null) {
+ return false;
+ }
+ return fCurrentEnabledTarget.fEnabled;
+ }
+
+ private EnabledTarget getEnabledTarget(IWorkbenchWindow window) {
+ EnabledTarget target = fEnabledTargetsMap.get(window);
+ if (target == null) {
+ target = new EnabledTarget(window);
fEnabledTargetsMap.put(window, target);
target.init();
- }
- return target;
- }
+ }
+ return target;
+ }
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
- if (window == null) {
- throw new ExecutionException("No active workbench window."); //$NON-NLS-1$
- }
- fCurrentEnabledTarget = getEnabledTarget(window);
-
- ISelection selection = getContextService(window).getActiveContext();
- if (selection instanceof IStructuredSelection && isEnabled()) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- boolean enabledAfterExecute = execute(window, ss.toArray());
-
- // enable/disable the action according to the command
- fCurrentEnabledTarget.setEnabled(enabledAfterExecute);
- }
-
- return null;
- }
-
- private IDebugContextService getContextService(IWorkbenchWindow window) {
- return DebugUITools.getDebugContextManager().getContextService(window);
- }
-
- /**
- * Executes this action on the given target objects
- * @param window the window
- * @param targets the targets to execute this action on
- * @return if the command stays enabled while the command executes
- */
- private boolean execute(IWorkbenchWindow window, final Object[] targets) {
- DebugCommandService service = DebugCommandService.getService(window);
- return service.executeCommand(
- getCommandType(), targets,
- new ICommandParticipant() {
- @Override
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (window == null) {
+ throw new ExecutionException("No active workbench window."); //$NON-NLS-1$
+ }
+ fCurrentEnabledTarget = getEnabledTarget(window);
+
+ ISelection selection = getContextService(window).getActiveContext();
+ if (selection instanceof IStructuredSelection && isEnabled()) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ boolean enabledAfterExecute = execute(window, ss.toArray());
+
+ // enable/disable the action according to the command
+ fCurrentEnabledTarget.setEnabled(enabledAfterExecute);
+ }
+
+ return null;
+ }
+
+ private IDebugContextService getContextService(IWorkbenchWindow window) {
+ return DebugUITools.getDebugContextManager().getContextService(window);
+ }
+
+ /**
+ * Executes this action on the given target objects
+ * @param window the window
+ * @param targets the targets to execute this action on
+ * @return if the command stays enabled while the command executes
+ */
+ private boolean execute(IWorkbenchWindow window, final Object[] targets) {
+ DebugCommandService service = DebugCommandService.getService(window);
+ return service.executeCommand(
+ getCommandType(), targets,
+ new ICommandParticipant() {
+ @Override
public void requestDone(org.eclipse.debug.core.IRequest request) {
- DebugCommandHandler.this.postExecute(request, targets);
- }
- });
- }
-
- /**
- * This method is called after the completion of the execution of this
- * command. Extending classes may override this method to perform additional
- * operation after command execution.
- *
- * @param request The completed request object which was given the the
- * debug command handler.
- * @param targets Objects which were the targets of this action
- */
- protected void postExecute(IRequest request, Object[] targets) {
- // do nothing by default
- }
-
- /**
- * Returns the {@link org.eclipse.debug.core.commands.IDebugCommandHandler}
- * command handler that type this action executes.
- *
- * @return command class.
- *
- * @see org.eclipse.debug.core.commands.IDebugCommandHandler
- */
+ DebugCommandHandler.this.postExecute(request, targets);
+ }
+ });
+ }
+
+ /**
+ * This method is called after the completion of the execution of this
+ * command. Extending classes may override this method to perform additional
+ * operation after command execution.
+ *
+ * @param request The completed request object which was given the the
+ * debug command handler.
+ * @param targets Objects which were the targets of this action
+ */
+ protected void postExecute(IRequest request, Object[] targets) {
+ // do nothing by default
+ }
+
+ /**
+ * Returns the {@link org.eclipse.debug.core.commands.IDebugCommandHandler}
+ * command handler that type this action executes.
+ *
+ * @return command class.
+ *
+ * @see org.eclipse.debug.core.commands.IDebugCommandHandler
+ */
abstract protected Class<?> getCommandType();
- /**
- * Returns whether this action should be enabled when initialized
- * and there is no active debug context.
- *
- * @return false, by default
- */
- protected boolean getInitialEnablement() {
- return false;
- }
+ /**
+ * Returns whether this action should be enabled when initialized
+ * and there is no active debug context.
+ *
+ * @return false, by default
+ */
+ protected boolean getInitialEnablement() {
+ return false;
+ }
- /**
- * Clean up when removing
- */
- @Override
+ /**
+ * Clean up when removing
+ */
+ @Override
public void dispose() {
- PlatformUI.getWorkbench().removeWindowListener(fWindowListener);
- for(EnabledTarget target : fEnabledTargetsMap.values()) {
- if (!target.isDisposed()) {
- target.dispose();
- }
- }
- fEnabledTargetsMap.clear();
- fCurrentEnabledTarget = null;
- }
+ PlatformUI.getWorkbench().removeWindowListener(fWindowListener);
+ for(EnabledTarget target : fEnabledTargetsMap.values()) {
+ if (!target.isDisposed()) {
+ target.dispose();
+ }
+ }
+ fEnabledTargetsMap.clear();
+ fCurrentEnabledTarget = null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java
index 6b7a25b79..f86dd4fbb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java
@@ -67,56 +67,56 @@ import org.eclipse.ui.IWorkbenchPart;
* @since 3.5
*/
public interface IToggleBreakpointsTargetFactory {
- /**
- * Returns all possible types of toggle breakpoints targets that this
- * factory can create for the given selection and part, possibly empty.
- * Toggle breakpoints targets are returned as a set of IDs.
- *
- * @param part The active part.
- * @param selection The current selection
- * @return Set of <code>String</code> IDs for possible toggle breakpoint
- * targets, possibly empty
- */
+ /**
+ * Returns all possible types of toggle breakpoints targets that this
+ * factory can create for the given selection and part, possibly empty.
+ * Toggle breakpoints targets are returned as a set of IDs.
+ *
+ * @param part The active part.
+ * @param selection The current selection
+ * @return Set of <code>String</code> IDs for possible toggle breakpoint
+ * targets, possibly empty
+ */
Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection);
- /**
- * Returns the identifier of the default toggle breakpoints target to use
- * for the given selection, or <code>null</code> if this factory has no
- * preference.
- *
- * @param part The active part.
- * @param selection The current selection
- * @return a breakpoint toggle target identifier or <code>null</code>
- */
- String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection);
+ /**
+ * Returns the identifier of the default toggle breakpoints target to use
+ * for the given selection, or <code>null</code> if this factory has no
+ * preference.
+ *
+ * @param part The active part.
+ * @param selection The current selection
+ * @return a breakpoint toggle target identifier or <code>null</code>
+ */
+ String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection);
- /**
- * Creates and returns a toggle breakpoint target corresponding to the
- * given identifier that this factory can produce (according to
- * {@link #getToggleTargets}).
- *
- * @param targetID The id of the toggle target to be created
- * @return toggle target or <code>null</code> if one could not be created
- */
- IToggleBreakpointsTarget createToggleTarget(String targetID);
+ /**
+ * Creates and returns a toggle breakpoint target corresponding to the
+ * given identifier that this factory can produce (according to
+ * {@link #getToggleTargets}).
+ *
+ * @param targetID The id of the toggle target to be created
+ * @return toggle target or <code>null</code> if one could not be created
+ */
+ IToggleBreakpointsTarget createToggleTarget(String targetID);
- /**
- * Returns a human readable name for the breakpoint toggle target associated with the
- * given ID. Used to populate the context menu with meaningful names of the types of
- * breakpoints created by the given target.
- *
- * @param targetID toggle breakpoints target identifier
- * @return toggle target name
- */
- String getToggleTargetName(String targetID);
+ /**
+ * Returns a human readable name for the breakpoint toggle target associated with the
+ * given ID. Used to populate the context menu with meaningful names of the types of
+ * breakpoints created by the given target.
+ *
+ * @param targetID toggle breakpoints target identifier
+ * @return toggle target name
+ */
+ String getToggleTargetName(String targetID);
- /**
- * Returns a description for the breakpoint toggle target associated with the
- * given ID or <code>null</code> if none.
- *
- * @param targetID toggle breakpoints target identifier
- * @return toggle target name or <code>null</code> if none
- */
- String getToggleTargetDescription(String targetID);
+ /**
+ * Returns a description for the breakpoint toggle target associated with the
+ * given ID or <code>null</code> if none.
+ *
+ * @param targetID toggle breakpoints target identifier
+ * @return toggle target name or <code>null</code> if none
+ */
+ String getToggleTargetDescription(String targetID);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java
index 2f8f9fdb9..7c67cf927 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java
@@ -43,65 +43,65 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public interface IToggleBreakpointsTargetManager {
- /**
- * Returns the set of <code>String</code> IDs of toggle breakpoint targets,
- * which are enabled for the given active part and selection. The IDs can be used
- * to create the {@link IToggleBreakpointsTarget} instance.
- * @param part active part
- * @param selection active selection in part
- * @return Set of toggle target IDs or an empty set
- */
+ /**
+ * Returns the set of <code>String</code> IDs of toggle breakpoint targets,
+ * which are enabled for the given active part and selection. The IDs can be used
+ * to create the {@link IToggleBreakpointsTarget} instance.
+ * @param part active part
+ * @param selection active selection in part
+ * @return Set of toggle target IDs or an empty set
+ */
Set<String> getEnabledToggleBreakpointsTargetIDs(IWorkbenchPart part, ISelection selection);
- /**
- * Returns the ID of the calculated preferred toggle breakpoints target for the
- * given active part and selection. The returned ID is chosen based on factory
- * enablement, whether the target is a default one, and on user choice.
- * @param part active part
- * @param selection active selection in part
- * @return The toggle target IDs or null if none.
- */
- String getPreferredToggleBreakpointsTargetID(IWorkbenchPart part, ISelection selection);
+ /**
+ * Returns the ID of the calculated preferred toggle breakpoints target for the
+ * given active part and selection. The returned ID is chosen based on factory
+ * enablement, whether the target is a default one, and on user choice.
+ * @param part active part
+ * @param selection active selection in part
+ * @return The toggle target IDs or null if none.
+ */
+ String getPreferredToggleBreakpointsTargetID(IWorkbenchPart part, ISelection selection);
- /**
- * Given the ID of toggle breakpoint target, this method will try to find the factory
- * that creates it and return an instance of it.
- *
- * @param part The workbench part in which toggle target is to be used
- * @param selection The active selection to use with toggle target
- * @return The instantiated target or null
- */
- IToggleBreakpointsTarget getToggleBreakpointsTarget(IWorkbenchPart part, ISelection selection);
+ /**
+ * Given the ID of toggle breakpoint target, this method will try to find the factory
+ * that creates it and return an instance of it.
+ *
+ * @param part The workbench part in which toggle target is to be used
+ * @param selection The active selection to use with toggle target
+ * @return The instantiated target or null
+ */
+ IToggleBreakpointsTarget getToggleBreakpointsTarget(IWorkbenchPart part, ISelection selection);
- /**
- * Given the ID of a toggle breakpoints target, this method will try
- * to find the factory that creates it and ask it for the name of it.
- *
- * @param id The ID of the requested toggle breakpoint target.
- * @return The name of the target.
- */
- String getToggleBreakpointsTargetName(String id);
+ /**
+ * Given the ID of a toggle breakpoints target, this method will try
+ * to find the factory that creates it and ask it for the name of it.
+ *
+ * @param id The ID of the requested toggle breakpoint target.
+ * @return The name of the target.
+ */
+ String getToggleBreakpointsTargetName(String id);
- /**
- * Given the ID of a toggle breakpoints target, this method will try
- * to find the factory that creates it and ask it for the description of it.
- *
- * @param id The ID of the requested toggle breakpoint target.
- * @return The description of the target or null.
- */
- String getToggleBreakpointsTargetDescription(String id);
+ /**
+ * Given the ID of a toggle breakpoints target, this method will try
+ * to find the factory that creates it and ask it for the description of it.
+ *
+ * @param id The ID of the requested toggle breakpoint target.
+ * @return The description of the target or null.
+ */
+ String getToggleBreakpointsTargetDescription(String id);
- /**
- * Adds the given listener to the list of listeners notified when the preferred
- * toggle breakpoints targets change.
- * @param listener The listener to add.
- */
- void addChangedListener(IToggleBreakpointsTargetManagerListener listener);
+ /**
+ * Adds the given listener to the list of listeners notified when the preferred
+ * toggle breakpoints targets change.
+ * @param listener The listener to add.
+ */
+ void addChangedListener(IToggleBreakpointsTargetManagerListener listener);
- /**
- * Removes the given listener from the list of listeners notified when the preferred
- * toggle breakpoints targets change.
- * @param listener The listener to add.
- */
- void removeChangedListener(IToggleBreakpointsTargetManagerListener listener);
+ /**
+ * Removes the given listener from the list of listeners notified when the preferred
+ * toggle breakpoints targets change.
+ * @param listener The listener to add.
+ */
+ void removeChangedListener(IToggleBreakpointsTargetManagerListener listener);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManagerListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManagerListener.java
index 5d2d44ccf..e358d3545 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManagerListener.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManagerListener.java
@@ -26,8 +26,8 @@ package org.eclipse.debug.ui.actions;
*/
public interface IToggleBreakpointsTargetManagerListener {
- /**
- * Called when the preferred toggle targets have changed.
- */
- void preferredTargetsChanged();
+ /**
+ * Called when the preferred toggle targets have changed.
+ */
+ void preferredTargetsChanged();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IVariableValueEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IVariableValueEditor.java
index b6f7c962e..3b5b744f6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IVariableValueEditor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IVariableValueEditor.java
@@ -47,34 +47,34 @@ import org.eclipse.swt.widgets.Shell;
*/
public interface IVariableValueEditor {
- /**
- * Edits the given variable, if appropriate. If this editor does not apply to
- * the given variable this method returns false, which indicates that the
- * Debug Platform's default variable edit dialog should be used.
- *
- * @param variable the variable to edit
- * @param shell the currently active shell, which can be used to open a dialog
- * for the user
- * @return whether this editor has completed the edit operation for the given variable.
- * <code>true</code> if no more work should be done, <code>false</code> if the debug
- * platform should prompt the user to edit the given variable using the default
- * variable editor
- */
- boolean editVariable(IVariable variable, Shell shell);
+ /**
+ * Edits the given variable, if appropriate. If this editor does not apply to
+ * the given variable this method returns false, which indicates that the
+ * Debug Platform's default variable edit dialog should be used.
+ *
+ * @param variable the variable to edit
+ * @param shell the currently active shell, which can be used to open a dialog
+ * for the user
+ * @return whether this editor has completed the edit operation for the given variable.
+ * <code>true</code> if no more work should be done, <code>false</code> if the debug
+ * platform should prompt the user to edit the given variable using the default
+ * variable editor
+ */
+ boolean editVariable(IVariable variable, Shell shell);
- /**
- * Saves the given expression to the given variable, if appropriate. If this
- * editor does not set the given variable's value from the given expression, this
- * method returns false. Returning false indicates that the Debug Platform should
- * perform the default operation to set a variable's value based on a String.
- *
- * @param variable the variable to edit
- * @param expression the expression to assign to the given variable
- * @param shell the currently active shell, which can be used to report errors to the
- * user. May be <code>null</code> if no active shell could be found.
- * @return whether this editor has completed the save operation for the given variable.
- * <code>true</code> if no more work should be done, <code>false</code> if the debug
- * platform should perform the default save operation
- */
- boolean saveVariable(IVariable variable, String expression, Shell shell);
+ /**
+ * Saves the given expression to the given variable, if appropriate. If this
+ * editor does not set the given variable's value from the given expression, this
+ * method returns false. Returning false indicates that the Debug Platform should
+ * perform the default operation to set a variable's value based on a String.
+ *
+ * @param variable the variable to edit
+ * @param expression the expression to assign to the given variable
+ * @param shell the currently active shell, which can be used to report errors to the
+ * user. May be <code>null</code> if no active shell could be found.
+ * @return whether this editor has completed the save operation for the given variable.
+ * <code>true</code> if no more work should be done, <code>false</code> if the debug
+ * platform should perform the default save operation
+ */
+ boolean saveVariable(IVariable variable, String expression, Shell shell);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IWatchExpressionFactoryAdapter2.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IWatchExpressionFactoryAdapter2.java
index 4aed3fad8..604b7d02a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IWatchExpressionFactoryAdapter2.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IWatchExpressionFactoryAdapter2.java
@@ -32,18 +32,18 @@ import org.eclipse.core.runtime.CoreException;
*/
public interface IWatchExpressionFactoryAdapter2 {
- /**
- * Creates and returns an expression for the specified variable
- * which is used to created an {@link org.eclipse.debug.core.model.IWatchExpression}.
- *
- * @param element element a watch expression is required for
- * @return text used to create a watch expression
- * @exception org.eclipse.core.runtime.CoreException if unable to create a watch
- * expression
- */
- String createWatchExpression(Object element) throws CoreException;
+ /**
+ * Creates and returns an expression for the specified variable
+ * which is used to created an {@link org.eclipse.debug.core.model.IWatchExpression}.
+ *
+ * @param element element a watch expression is required for
+ * @return text used to create a watch expression
+ * @exception org.eclipse.core.runtime.CoreException if unable to create a watch
+ * expression
+ */
+ String createWatchExpression(Object element) throws CoreException;
- /**
+ /**
* Returns whether a watch expression can be created for the specified variable.
*
* @param variable the specified variable
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java
index cc5069538..945cc6422 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java
@@ -302,7 +302,7 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
*/
private void readAttribute(IMemento memento, Map<String, Object> map) {
String name = memento.getString(IImportExportConstants.IE_NODE_NAME),
- value = memento.getString(IImportExportConstants.IE_NODE_VALUE);
+ value = memento.getString(IImportExportConstants.IE_NODE_VALUE);
if (value != null && name != null) {
if (name.equals(IInternalDebugUIConstants.WORKING_SET_NAME)) {
fCurrentWorkingSetProperty = value;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java
index aa905eacb..17dcd129a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java
@@ -183,13 +183,13 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork
String mode = getMode();
try {
ILaunchConfiguration config = getLaunchConfigurationManager().isSharedConfig(getSelection(context));
- if(config != null && config.exists() && config.supportsMode(mode)) {
- IAction action = new LaunchConfigurationAction(config, mode, config.getName(), DebugUITools.getDefaultImageDescriptor(config), accelerator++);
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(fCreatedMenu, -1);
- if(!filteredShortCuts.isEmpty()) {
- new MenuItem(fCreatedMenu, SWT.SEPARATOR);
- }
+ if(config != null && config.exists() && config.supportsMode(mode)) {
+ IAction action = new LaunchConfigurationAction(config, mode, config.getName(), DebugUITools.getDefaultImageDescriptor(config), accelerator++);
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(fCreatedMenu, -1);
+ if(!filteredShortCuts.isEmpty()) {
+ new MenuItem(fCreatedMenu, SWT.SEPARATOR);
+ }
}
}
catch(CoreException ce) {DebugUIPlugin.log(ce);}
@@ -320,10 +320,10 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork
*/
@Override
public void selectionChanged(IAction action, ISelection selection) {
- if (!fInitialized) {
- action.setEnabled(existsConfigTypesForMode());
- fInitialized = true;
- }
+ if (!fInitialized) {
+ action.setEnabled(existsConfigTypesForMode());
+ fInitialized = true;
+ }
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java
index 70a0dcc72..7a92fae36 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java
@@ -60,7 +60,7 @@ public abstract class RulerBreakpointAction extends Action {
* @return breakpoint associated with activity in the ruler or <code>null</code>
*/
protected IBreakpoint getBreakpoint() {
- IAnnotationModel annotationModel = fEditor.getDocumentProvider().getAnnotationModel(fEditor.getEditorInput());
+ IAnnotationModel annotationModel = fEditor.getDocumentProvider().getAnnotationModel(fEditor.getEditorInput());
IDocument document = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
if (annotationModel != null) {
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
index 8b145bfdf..65bf5a1df 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java
@@ -82,172 +82,172 @@ import org.eclipse.ui.texteditor.ITextEditorExtension;
*/
@Deprecated
public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate, IMenuListener, IMenuCreator {
- private ITextEditor fEditor = null;
- private IAction fCallerAction = null;
- private IVerticalRulerInfo fRulerInfo;
- private ISelection fSelection;
+ private ITextEditor fEditor = null;
+ private IAction fCallerAction = null;
+ private IVerticalRulerInfo fRulerInfo;
+ private ISelection fSelection;
- /**
- * The menu created by this action
- */
- private Menu fMenu;
+ /**
+ * The menu created by this action
+ */
+ private Menu fMenu;
- private class SelectTargetAction extends Action {
+ private class SelectTargetAction extends Action {
private final Set<String> fPossibleIDs;
- private final String fID;
+ private final String fID;
SelectTargetAction(String name, Set<String> possibleIDs, String ID) {
- super(name, AS_RADIO_BUTTON);
- fID = ID;
- fPossibleIDs = possibleIDs;
- }
+ super(name, AS_RADIO_BUTTON);
+ fID = ID;
+ fPossibleIDs = possibleIDs;
+ }
- @Override
+ @Override
public void run() {
- if (isChecked()) {
- ToggleBreakpointsTargetManager.getDefault().setPreferredTarget(fPossibleIDs, fID);
- }
- }
- }
+ if (isChecked()) {
+ ToggleBreakpointsTargetManager.getDefault().setPreferredTarget(fPossibleIDs, fID);
+ }
+ }
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- // In the editor we're not using the selection.
- }
+ // In the editor we're not using the selection.
+ }
- @Override
+ @Override
public void run(IAction action) {
- // Do nothing, this is a pull-down menu.
- }
+ // Do nothing, this is a pull-down menu.
+ }
- @Override
+ @Override
public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
- // Clean up old editor data.
- if (fCallerAction != null) {
- fCallerAction.setMenuCreator(null);
- }
- if (fEditor instanceof ITextEditorExtension) {
- ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
- }
- fRulerInfo = null;
+ // Clean up old editor data.
+ if (fCallerAction != null) {
+ fCallerAction.setMenuCreator(null);
+ }
+ if (fEditor instanceof ITextEditorExtension) {
+ ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
+ }
+ fRulerInfo = null;
- // Set up new editor data.
- fCallerAction = callerAction;
- fCallerAction.setMenuCreator(this);
+ // Set up new editor data.
+ fCallerAction = callerAction;
+ fCallerAction.setMenuCreator(this);
- fEditor= targetEditor == null ? null : targetEditor.getAdapter(ITextEditor.class);
+ fEditor= targetEditor == null ? null : targetEditor.getAdapter(ITextEditor.class);
- if (fEditor != null) {
- if (fEditor instanceof ITextEditorExtension) {
- ((ITextEditorExtension) fEditor).addRulerContextMenuListener(this);
- }
+ if (fEditor != null) {
+ if (fEditor instanceof ITextEditorExtension) {
+ ((ITextEditorExtension) fEditor).addRulerContextMenuListener(this);
+ }
- fRulerInfo= fEditor.getAdapter(IVerticalRulerInfo.class);
- }
+ fRulerInfo= fEditor.getAdapter(IVerticalRulerInfo.class);
+ }
- }
+ }
- @Override
+ @Override
public void dispose() {
- if (fCallerAction != null) {
- fCallerAction.setMenuCreator(null);
- }
- if (fEditor instanceof ITextEditorExtension) {
- ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
- }
- fRulerInfo = null;
- }
-
- @Override
+ if (fCallerAction != null) {
+ fCallerAction.setMenuCreator(null);
+ }
+ if (fEditor instanceof ITextEditorExtension) {
+ ((ITextEditorExtension) fEditor).removeRulerContextMenuListener(this);
+ }
+ fRulerInfo = null;
+ }
+
+ @Override
public void menuAboutToShow(IMenuManager manager) {
- fSelection = StructuredSelection.EMPTY;
- if (fEditor != null && fRulerInfo != null) {
-
- IDocumentProvider provider = fEditor.getDocumentProvider();
- if (provider != null) {
- IDocument document = provider.getDocument(fEditor.getEditorInput());
- int line = fRulerInfo.getLineOfLastMouseButtonActivity();
- if (line > -1) {
- try {
- IRegion region = document.getLineInformation(line);
- fSelection = new TextSelection(document, region.getOffset(), 0);
- } catch (BadLocationException e) {}
- }
- }
- ToggleBreakpointsTargetManager toggleTargetManager = ToggleBreakpointsTargetManager.getDefault();
+ fSelection = StructuredSelection.EMPTY;
+ if (fEditor != null && fRulerInfo != null) {
+
+ IDocumentProvider provider = fEditor.getDocumentProvider();
+ if (provider != null) {
+ IDocument document = provider.getDocument(fEditor.getEditorInput());
+ int line = fRulerInfo.getLineOfLastMouseButtonActivity();
+ if (line > -1) {
+ try {
+ IRegion region = document.getLineInformation(line);
+ fSelection = new TextSelection(document, region.getOffset(), 0);
+ } catch (BadLocationException e) {}
+ }
+ }
+ ToggleBreakpointsTargetManager toggleTargetManager = ToggleBreakpointsTargetManager.getDefault();
Set<String> enabledIDs = toggleTargetManager.getEnabledToggleBreakpointsTargetIDs(fEditor, fSelection);
- fCallerAction.setEnabled(enabledIDs.size() > 0);
- } else {
- fCallerAction.setEnabled(false);
- }
-
- }
-
- /**
- * Sets this action's drop-down menu, disposing the previous menu.
- *
- * @param menu the new menu
- */
- private void setMenu(Menu menu) {
- if (fMenu != null) {
- fMenu.dispose();
- }
- fMenu = menu;
- }
-
- @Override
+ fCallerAction.setEnabled(enabledIDs.size() > 0);
+ } else {
+ fCallerAction.setEnabled(false);
+ }
+
+ }
+
+ /**
+ * Sets this action's drop-down menu, disposing the previous menu.
+ *
+ * @param menu the new menu
+ */
+ private void setMenu(Menu menu) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ fMenu = menu;
+ }
+
+ @Override
public Menu getMenu(Menu parent) {
- setMenu(new Menu(parent));
- fillMenu(fMenu);
- initMenu();
- return fMenu;
- }
+ setMenu(new Menu(parent));
+ fillMenu(fMenu);
+ initMenu();
+ return fMenu;
+ }
- @Override
+ @Override
public Menu getMenu(Control parent) {
- setMenu(new Menu(parent));
- fillMenu(fMenu);
- initMenu();
- return fMenu;
- }
-
- /**
- * Fills the drop-down menu with enabled toggle breakpoint targets
- *
- * @param menu the menu to fill
- */
- private void fillMenu(Menu menu) {
- ToggleBreakpointsTargetManager manager = ToggleBreakpointsTargetManager.getDefault();
+ setMenu(new Menu(parent));
+ fillMenu(fMenu);
+ initMenu();
+ return fMenu;
+ }
+
+ /**
+ * Fills the drop-down menu with enabled toggle breakpoint targets
+ *
+ * @param menu the menu to fill
+ */
+ private void fillMenu(Menu menu) {
+ ToggleBreakpointsTargetManager manager = ToggleBreakpointsTargetManager.getDefault();
Set<String> enabledIDs = manager.getEnabledToggleBreakpointsTargetIDs(fEditor, fSelection);
- String preferredId = manager.getPreferredToggleBreakpointsTargetID(fEditor, fSelection);
+ String preferredId = manager.getPreferredToggleBreakpointsTargetID(fEditor, fSelection);
for (String id : enabledIDs) {
- SelectTargetAction action= new SelectTargetAction(manager.getToggleBreakpointsTargetName(id), enabledIDs, id);
- if (id.equals(preferredId)){
- action.setChecked(true);
- }
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(menu, -1);
- }
- }
-
- /**
- * Creates the menu for the action
- */
- private void initMenu() {
- // Add listener to re-populate the menu each time
- // it is shown because of dynamic history list
- fMenu.addMenuListener(new MenuAdapter() {
- @Override
+ SelectTargetAction action= new SelectTargetAction(manager.getToggleBreakpointsTargetName(id), enabledIDs, id);
+ if (id.equals(preferredId)){
+ action.setChecked(true);
+ }
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(menu, -1);
+ }
+ }
+
+ /**
+ * Creates the menu for the action
+ */
+ private void initMenu() {
+ // Add listener to re-populate the menu each time
+ // it is shown because of dynamic history list
+ fMenu.addMenuListener(new MenuAdapter() {
+ @Override
public void menuShown(MenuEvent e) {
- Menu m = (Menu)e.widget;
- MenuItem[] items = m.getItems();
- for (int i=0; i < items.length; i++) {
- items[i].dispose();
- }
- fillMenu(m);
- }
- });
- }
+ Menu m = (Menu)e.widget;
+ MenuItem[] items = m.getItems();
+ for (int i=0; i < items.length; i++) {
+ items[i].dispose();
+ }
+ fillMenu(m);
+ }
+ });
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
index 0cab974eb..43ab92864 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
@@ -72,8 +72,8 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
- fTargetElement = (ISuspendResume)
- DebugPlugin.getAdapter(ss.getFirstElement(), ISuspendResume.class);
+ fTargetElement = (ISuspendResume)
+ DebugPlugin.getAdapter(ss.getFirstElement(), ISuspendResume.class);
}
}
update();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
index 64a419765..8a6b7ad75 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java
@@ -47,103 +47,103 @@ import org.eclipse.debug.ui.IDebugUIConstants;
*/
public class RunToLineHandler implements IDebugEventSetListener, IBreakpointManagerListener, IWorkspaceRunnable {
- private IDebugTarget fTarget;
- private ISuspendResume fResumee;
- private IBreakpoint fBreakpoint;
- private boolean fAutoSkip = false;
+ private IDebugTarget fTarget;
+ private ISuspendResume fResumee;
+ private IBreakpoint fBreakpoint;
+ private boolean fAutoSkip = false;
- /**
- * Constructs a handler to perform a run to line operation.
- *
- * @param target the debug target in which the operation is to be performed
- * @param suspendResume the element to be resumed to begin the operation
- * @param breakpoint the run to line breakpoint
- */
- public RunToLineHandler(IDebugTarget target, ISuspendResume suspendResume, IBreakpoint breakpoint) {
- fResumee = suspendResume;
- fTarget = target;
- fBreakpoint = breakpoint;
- }
+ /**
+ * Constructs a handler to perform a run to line operation.
+ *
+ * @param target the debug target in which the operation is to be performed
+ * @param suspendResume the element to be resumed to begin the operation
+ * @param breakpoint the run to line breakpoint
+ */
+ public RunToLineHandler(IDebugTarget target, ISuspendResume suspendResume, IBreakpoint breakpoint) {
+ fResumee = suspendResume;
+ fTarget = target;
+ fBreakpoint = breakpoint;
+ }
- @Override
+ @Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event= events[i];
- Object source= event.getSource();
- if (source instanceof IThread && event.getKind() == DebugEvent.SUSPEND &&
- event.getDetail() == DebugEvent.BREAKPOINT) {
- IThread thread = (IThread) source;
- IDebugTarget suspendee = thread.getAdapter(IDebugTarget.class);
- if (fTarget.equals(suspendee)) {
- // cleanup if the breakpoint was hit or not
- cancel();
- }
- } else if (source instanceof IDebugTarget && event.getKind() == DebugEvent.TERMINATE) {
- if (source.equals(fTarget)) {
- // Clean up if the debug target terminates without
- // hitting the breakpoint.
- cancel();
- }
- }
- }
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event= events[i];
+ Object source= event.getSource();
+ if (source instanceof IThread && event.getKind() == DebugEvent.SUSPEND &&
+ event.getDetail() == DebugEvent.BREAKPOINT) {
+ IThread thread = (IThread) source;
+ IDebugTarget suspendee = thread.getAdapter(IDebugTarget.class);
+ if (fTarget.equals(suspendee)) {
+ // cleanup if the breakpoint was hit or not
+ cancel();
+ }
+ } else if (source instanceof IDebugTarget && event.getKind() == DebugEvent.TERMINATE) {
+ if (source.equals(fTarget)) {
+ // Clean up if the debug target terminates without
+ // hitting the breakpoint.
+ cancel();
+ }
+ }
+ }
- }
+ }
- @Override
+ @Override
public void breakpointManagerEnablementChanged(boolean enabled) {
- // if the user changes the breakpoint manager enablement, don't restore it
- fAutoSkip = false;
- }
+ // if the user changes the breakpoint manager enablement, don't restore it
+ fAutoSkip = false;
+ }
- private IBreakpointManager getBreakpointManager() {
- return getDebugPlugin().getBreakpointManager();
- }
+ private IBreakpointManager getBreakpointManager() {
+ return getDebugPlugin().getBreakpointManager();
+ }
- private DebugPlugin getDebugPlugin() {
- return DebugPlugin.getDefault();
- }
+ private DebugPlugin getDebugPlugin() {
+ return DebugPlugin.getDefault();
+ }
- /**
- * Cancels the run to line operation.
- */
- public void cancel() {
- IBreakpointManager manager = getBreakpointManager();
- try {
- getDebugPlugin().removeDebugEventListener(this);
- manager.removeBreakpointManagerListener(this);
- fTarget.breakpointRemoved(fBreakpoint, null);
- } finally {
- if (fAutoSkip) {
- manager.setEnabled(true);
- }
- }
- }
+ /**
+ * Cancels the run to line operation.
+ */
+ public void cancel() {
+ IBreakpointManager manager = getBreakpointManager();
+ try {
+ getDebugPlugin().removeDebugEventListener(this);
+ manager.removeBreakpointManagerListener(this);
+ fTarget.breakpointRemoved(fBreakpoint, null);
+ } finally {
+ if (fAutoSkip) {
+ manager.setEnabled(true);
+ }
+ }
+ }
- @Override
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
- getDebugPlugin().addDebugEventListener(this);
- IBreakpointManager breakpointManager = getBreakpointManager();
- fAutoSkip = DebugUITools.getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE) && breakpointManager.isEnabled();
- if (fAutoSkip) {
- getBreakpointManager().setEnabled(false);
- breakpointManager.addBreakpointManagerListener(this);
- }
- Job job = new Job(ActionMessages.RunToLineHandler_0) {
- @Override
+ getDebugPlugin().addDebugEventListener(this);
+ IBreakpointManager breakpointManager = getBreakpointManager();
+ fAutoSkip = DebugUITools.getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE) && breakpointManager.isEnabled();
+ if (fAutoSkip) {
+ getBreakpointManager().setEnabled(false);
+ breakpointManager.addBreakpointManagerListener(this);
+ }
+ Job job = new Job(ActionMessages.RunToLineHandler_0) {
+ @Override
protected IStatus run(IProgressMonitor jobMonitor) {
- if (!jobMonitor.isCanceled()) {
- fTarget.breakpointAdded(fBreakpoint);
- try {
- fResumee.resume();
- } catch (DebugException e) {
- cancel();
- return e.getStatus();
- }
- }
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
+ if (!jobMonitor.isCanceled()) {
+ fTarget.breakpointAdded(fBreakpoint);
+ try {
+ fResumee.resume();
+ } catch (DebugException e) {
+ cancel();
+ return e.getStatus();
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java
index a71280595..5f020524e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java
@@ -53,10 +53,10 @@ public class ToggleBreakpointAction extends Action implements IUpdate {
private IDocument fDocument;
private IVerticalRulerInfo fRulerInfo;
private IToggleBreakpointsTargetManagerListener fListener = new IToggleBreakpointsTargetManagerListener() {
- @Override
+ @Override
public void preferredTargetsChanged() {
- update();
- }
+ update();
+ }
};
/**
@@ -120,7 +120,7 @@ public class ToggleBreakpointAction extends Action implements IUpdate {
}
}
if (target.canToggleLineBreakpoints(fPart, selection)) {
- target.toggleLineBreakpoints(fPart, selection);
+ target.toggleLineBreakpoints(fPart, selection);
} else if (target.canToggleWatchpoints(fPart, selection)) {
target.toggleWatchpoints(fPart, selection);
} else if (target.canToggleMethodBreakpoints(fPart, selection)) {
@@ -193,34 +193,34 @@ public class ToggleBreakpointAction extends Action implements IUpdate {
public void update() {
IDocument document= getDocument();
if (document != null) {
- int line = fRulerInfo.getLineOfLastMouseButtonActivity();
- if (line > -1) {
- try {
- ITextSelection selection = getTextSelection(document, line);
-
- IToggleBreakpointsTarget adapter =
- ToggleBreakpointsTargetManager.getDefault().getToggleBreakpointsTarget(fPart, selection);
- if (adapter == null) {
- setEnabled(false);
- return;
- }
- if (adapter instanceof IToggleBreakpointsTargetExtension) {
- IToggleBreakpointsTargetExtension extension = (IToggleBreakpointsTargetExtension) adapter;
- if (extension.canToggleBreakpoints(fPart, selection)) {
- setEnabled(true);
- return;
- }
- }
- if (adapter.canToggleLineBreakpoints(fPart, selection) ||
- adapter.canToggleWatchpoints(fPart, selection) ||
- adapter.canToggleMethodBreakpoints(fPart, selection))
- {
- setEnabled(true);
- return;
- }
- } catch (BadLocationException e) {
- reportException(e);
- }
+ int line = fRulerInfo.getLineOfLastMouseButtonActivity();
+ if (line > -1) {
+ try {
+ ITextSelection selection = getTextSelection(document, line);
+
+ IToggleBreakpointsTarget adapter =
+ ToggleBreakpointsTargetManager.getDefault().getToggleBreakpointsTarget(fPart, selection);
+ if (adapter == null) {
+ setEnabled(false);
+ return;
+ }
+ if (adapter instanceof IToggleBreakpointsTargetExtension) {
+ IToggleBreakpointsTargetExtension extension = (IToggleBreakpointsTargetExtension) adapter;
+ if (extension.canToggleBreakpoints(fPart, selection)) {
+ setEnabled(true);
+ return;
+ }
+ }
+ if (adapter.canToggleLineBreakpoints(fPart, selection) ||
+ adapter.canToggleWatchpoints(fPart, selection) ||
+ adapter.canToggleMethodBreakpoints(fPart, selection))
+ {
+ setEnabled(true);
+ return;
+ }
+ } catch (BadLocationException e) {
+ reportException(e);
+ }
}
}
setEnabled(false);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
index e10d4e05f..89cb28b9e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
@@ -101,7 +101,7 @@ public class FileLink implements IConsoleHyperlink {
}
IDocument document = provider.getDocument(input);
try {
- IRegion region= document.getLineInformation(fFileLineNumber - 1);
+ IRegion region= document.getLineInformation(fFileLineNumber - 1);
fFileOffset = region.getOffset();
fFileLength = region.getLength();
} catch (BadLocationException e) {
@@ -144,14 +144,14 @@ public class FileLink implements IConsoleHyperlink {
return fEditorId;
}
- private IContentType getFileContentType() {
- try {
- IContentDescription description= fFile.getContentDescription();
- if (description != null) {
- return description.getContentType();
- }
- } catch (CoreException e) {
- }
- return null;
- }
+ private IContentType getFileContentType() {
+ try {
+ IContentDescription description= fFile.getContentDescription();
+ if (description != null) {
+ return description.getContentType();
+ }
+ } catch (CoreException e) {
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java
index c76a9abe1..62bdd0696 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java
@@ -123,25 +123,25 @@ public interface IConsole {
/**
* Adds the given pattern match listener to this console. The listener will
- * be connected and receive match notifications.
+ * be connected and receive match notifications.
* @param matchListener the listener to add
* @since 3.1
*/
void addPatternMatchListener(IPatternMatchListener matchListener);
- /**
- * Removes the given pattern match listener from this console. The listener will be
- * disconnected and will no longer receive match notifications.
- * @param matchListener the pattern match listener to remove.
- * @since 3.1
- */
+ /**
+ * Removes the given pattern match listener from this console. The listener will be
+ * disconnected and will no longer receive match notifications.
+ * @param matchListener the pattern match listener to remove.
+ * @since 3.1
+ */
void removePatternMatchListener(IPatternMatchListener matchListener);
/**
* Returns the stream associated with the specified stream identifier.
- * @param streamIdentifier Uniquely identifies the required stream
- * @return The stream or <code>null</code> if none found with matching streamIdentifier
- * @since 3.1
- */
+ * @param streamIdentifier Uniquely identifies the required stream
+ * @return The stream or <code>null</code> if none found with matching streamIdentifier
+ * @since 3.1
+ */
IOConsoleOutputStream getStream(String streamIdentifier);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java
index a2cbe6256..b2f11f58f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java
@@ -54,8 +54,8 @@ public class DebugContextEvent extends EventObject {
public static final int STATE = 0x10;
/**
- * Generated serial version UID for this class.
- */
+ * Generated serial version UID for this class.
+ */
private static final long serialVersionUID = 3395172504615255524L;
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider.java
index 7abbc387b..b22b31fed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextProvider.java
@@ -51,25 +51,25 @@ public interface IDebugContextProvider {
*/
IWorkbenchPart getPart();
- /**
- * Registers the given listener for debug context events.
- *
- * @param listener event listener
- */
+ /**
+ * Registers the given listener for debug context events.
+ *
+ * @param listener event listener
+ */
void addDebugContextListener(IDebugContextListener listener);
- /**
- * Unregisters the given listener for debug context events.
- *
- * @param listener event listener
- */
+ /**
+ * Unregisters the given listener for debug context events.
+ *
+ * @param listener event listener
+ */
void removeDebugContextListener(IDebugContextListener listener);
- /**
- * Returns the currently active context, possibly empty or <code>null</code>.
- *
- * @return active context, possibly empty or <code>null</code>.
- */
+ /**
+ * Returns the currently active context, possibly empty or <code>null</code>.
+ *
+ * @return active context, possibly empty or <code>null</code>.
+ */
ISelection getActiveContext();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/ISuspendTrigger.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/ISuspendTrigger.java
index 761d477ed..b131209fb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/ISuspendTrigger.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/ISuspendTrigger.java
@@ -44,18 +44,18 @@ package org.eclipse.debug.ui.contexts;
*/
public interface ISuspendTrigger {
- /**
- * Registers the given listener for suspend notifications.
- *
- * @param listener suspend listener
- */
+ /**
+ * Registers the given listener for suspend notifications.
+ *
+ * @param listener suspend listener
+ */
void addSuspendTriggerListener(ISuspendTriggerListener listener);
- /**
- * Unregisters the given listener for suspend notifications.
- *
- * @param listener suspend listener
- */
+ /**
+ * Unregisters the given listener for suspend notifications.
+ *
+ * @param listener suspend listener
+ */
void removeSuspendTriggerListener(ISuspendTriggerListener listener);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java
index f62d75687..b4f3ef348 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java
@@ -50,8 +50,8 @@ abstract public class AbstractTextRendering extends AbstractTableRendering {
*
* @param renderingId memory rendering type identifier
* @param codePage the name of a supported
- * {@link java.nio.charset.Charset </code>charset<code>}, for
- * example <code>CP1252</code>
+ * {@link java.nio.charset.Charset </code>charset<code>}, for
+ * example <code>CP1252</code>
*/
public AbstractTextRendering(String renderingId, String codePage)
{
@@ -66,7 +66,7 @@ abstract public class AbstractTextRendering extends AbstractTableRendering {
*
* @param codePage the name of a supported
* {@link java.nio.charset.Charset </code>charset<code>}, for
- * example <code>CP1252</code>
+ * example <code>CP1252</code>
*/
public void setCodePage(String codePage)
{
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java
index 72e641812..0681f3170 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryBlockTablePresentation.java
@@ -39,26 +39,26 @@ public interface IMemoryBlockTablePresentation extends IDebugModelPresentation
{
/**
- * Returns a collection of labels to head columns in a <code>AbstractTableRendering</code>
- * rendering, or <code>null</code> if default labels should be used.
- *
+ * Returns a collection of labels to head columns in a <code>AbstractTableRendering</code>
+ * rendering, or <code>null</code> if default labels should be used.
+ *
* @param blk memory block
* @param bytesPerLine the number if bytes to be displayed
* @param numColumns the number of columns the bytes are divided into
* @return a collection of labels to head columns in a <code>AbstractTableRendering</code>
- * rendering, or <code>null</code> if default labels should be used
+ * rendering, or <code>null</code> if default labels should be used
*/
String[] getColumnLabels(IMemoryBlock blk, int bytesPerLine, int numColumns);
/**
- * Renders and returns a label for a row starting at the given address within the given
- * memory block, or <code>null</code> if default rendering should be used.
- *
+ * Renders and returns a label for a row starting at the given address within the given
+ * memory block, or <code>null</code> if default rendering should be used.
+ *
* @param blk memory block
* @param address an address in the memory block
* @return a label for a row starting at the given address within the given
- * memory block, or <code>null</code> if default rendering should be used
+ * memory block, or <code>null</code> if default rendering should be used
*/
String getRowLabel(IMemoryBlock blk, BigInteger address);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java
index 67785cc9f..f1fcdaee7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRendering.java
@@ -75,111 +75,111 @@ import org.eclipse.swt.widgets.Control;
*/
public interface IMemoryRendering extends IAdaptable{
- /**
- * Initializes this rendering to be hosted in the given container, displaying
- * the given memory block. This method is called before this rendering's control
- * has been created.
- *
- * @param container container hosting this rendering
- * @param block the memory block to render
- */
- void init(IMemoryRenderingContainer container, IMemoryBlock block);
-
- /**
- * Creates the top level control for this rendering under the given parent composite.
- * This method is called after this rendering's <code>init</code> method has been
- * called.
- * <p>
- * Implementors are responsible for ensuring that
- * the created control can be accessed via <code>getControl</code>
- * </p>
- * @param parent the parent composite
- * @return the new top level control
- */
- Control createControl(Composite parent);
-
- /**
- * Returns the top level control for this rendering.
- * <p>
- * May return <code>null</code> if the control
- * has not been created yet.
- * </p>
- * @return the top level control or <code>null</code>
- */
- Control getControl();
-
- /**
- * Disposes this rendering.
- */
- void dispose();
-
- /**
- * Notification this rendering has become the active rendering. Only one
- * rendering can be active at once. Generally, the active rendering is
- * visible and has focus.
- */
- void activated();
-
- /**
- * Notification this rendering is no longer the active rendering.
- */
- void deactivated();
-
- /**
- * Notification this rendering has become visible in its container.
- * Note that a rendering does not have to be active to be visible.
- */
- void becomesVisible();
-
- /**
- * Notification this rendering has become hidden in its container.
- */
- void becomesHidden();
-
- /**
- * Returns the memory block displayed by this rendering.
- *
- * @return the memory block displayed by this rendering
- */
- IMemoryBlock getMemoryBlock();
-
- /**
- * Returns the identifier associated with this rendering's type.
- *
- * @return the identifier associated with this rendering's type
- * @see IMemoryRenderingType
- */
- String getRenderingId();
-
- /**
- * Adds a listener for property changes to this rendering.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a property change listener
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Removes the given property change listener from this rendering.
- * Has no effect if the identical listener is not registered.
- *
- * @param listener a property change listener
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Returns an image for this rendering. Clients should not dispose
- * this image. This rendering will dispose the image if required when
- * this rendering is disposed.
- *
- * @return an image for this rendering
- */
- Image getImage();
-
- /**
- * Returns a label for this rendering.
- *
- * @return a label for this rendering
- */
- String getLabel();
+ /**
+ * Initializes this rendering to be hosted in the given container, displaying
+ * the given memory block. This method is called before this rendering's control
+ * has been created.
+ *
+ * @param container container hosting this rendering
+ * @param block the memory block to render
+ */
+ void init(IMemoryRenderingContainer container, IMemoryBlock block);
+
+ /**
+ * Creates the top level control for this rendering under the given parent composite.
+ * This method is called after this rendering's <code>init</code> method has been
+ * called.
+ * <p>
+ * Implementors are responsible for ensuring that
+ * the created control can be accessed via <code>getControl</code>
+ * </p>
+ * @param parent the parent composite
+ * @return the new top level control
+ */
+ Control createControl(Composite parent);
+
+ /**
+ * Returns the top level control for this rendering.
+ * <p>
+ * May return <code>null</code> if the control
+ * has not been created yet.
+ * </p>
+ * @return the top level control or <code>null</code>
+ */
+ Control getControl();
+
+ /**
+ * Disposes this rendering.
+ */
+ void dispose();
+
+ /**
+ * Notification this rendering has become the active rendering. Only one
+ * rendering can be active at once. Generally, the active rendering is
+ * visible and has focus.
+ */
+ void activated();
+
+ /**
+ * Notification this rendering is no longer the active rendering.
+ */
+ void deactivated();
+
+ /**
+ * Notification this rendering has become visible in its container.
+ * Note that a rendering does not have to be active to be visible.
+ */
+ void becomesVisible();
+
+ /**
+ * Notification this rendering has become hidden in its container.
+ */
+ void becomesHidden();
+
+ /**
+ * Returns the memory block displayed by this rendering.
+ *
+ * @return the memory block displayed by this rendering
+ */
+ IMemoryBlock getMemoryBlock();
+
+ /**
+ * Returns the identifier associated with this rendering's type.
+ *
+ * @return the identifier associated with this rendering's type
+ * @see IMemoryRenderingType
+ */
+ String getRenderingId();
+
+ /**
+ * Adds a listener for property changes to this rendering.
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener a property change listener
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener);
+
+ /**
+ * Removes the given property change listener from this rendering.
+ * Has no effect if the identical listener is not registered.
+ *
+ * @param listener a property change listener
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
+
+ /**
+ * Returns an image for this rendering. Clients should not dispose
+ * this image. This rendering will dispose the image if required when
+ * this rendering is disposed.
+ *
+ * @return an image for this rendering
+ */
+ Image getImage();
+
+ /**
+ * Returns a label for this rendering.
+ *
+ * @return a label for this rendering
+ */
+ String getLabel();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingBindingsProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingBindingsProvider.java
index 9c7db76ed..352de6478 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingBindingsProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingBindingsProvider.java
@@ -33,50 +33,50 @@ import org.eclipse.debug.core.model.IMemoryBlock;
public interface IMemoryRenderingBindingsProvider {
/**
- * Returns all rendering types bound to the given memory block.
- * This includes default and primary rendering types.
- *
- * @param block memory block
+ * Returns all rendering types bound to the given memory block.
+ * This includes default and primary rendering types.
+ *
+ * @param block memory block
* @return all rendering types bound to the given memory block
*/
IMemoryRenderingType[] getRenderingTypes(IMemoryBlock block);
- /**
- * Returns default rendering types bound to the given memory block,
- * possibly empty.
- *
- * @param block memory block
- * @return default rendering types bound to the given memory block,
- * possibly empty
- */
- IMemoryRenderingType[] getDefaultRenderingTypes(IMemoryBlock block);
+ /**
+ * Returns default rendering types bound to the given memory block,
+ * possibly empty.
+ *
+ * @param block memory block
+ * @return default rendering types bound to the given memory block,
+ * possibly empty
+ */
+ IMemoryRenderingType[] getDefaultRenderingTypes(IMemoryBlock block);
- /**
- * Returns the primary rendering type bound to the given memory block,
- * or <code>null</code> if none.
- *
- * @param block memory block
- * @return the primary rendering type bound to the given memory block,
- * or <code>null</code> if none
- */
- IMemoryRenderingType getPrimaryRenderingType(IMemoryBlock block);
+ /**
+ * Returns the primary rendering type bound to the given memory block,
+ * or <code>null</code> if none.
+ *
+ * @param block memory block
+ * @return the primary rendering type bound to the given memory block,
+ * or <code>null</code> if none
+ */
+ IMemoryRenderingType getPrimaryRenderingType(IMemoryBlock block);
- /**
- * Adds a listener to this binding provider. The listener will be notified
- * when rendering bindings change.
- * <p>
- * Has no effect if an identical listener is already registered.
- * </p>
- * @param listener listener to add
- */
+ /**
+ * Adds a listener to this binding provider. The listener will be notified
+ * when rendering bindings change.
+ * <p>
+ * Has no effect if an identical listener is already registered.
+ * </p>
+ * @param listener listener to add
+ */
void addListener(IMemoryRenderingBindingsListener listener);
- /**
- * Removes a listener from this binding provider.
- * <p>
- * Has no effect if an identical listener is not already registered.
- * </p>
- * @param listener listener to remove
- */
+ /**
+ * Removes a listener from this binding provider.
+ * <p>
+ * Has no effect if an identical listener is not already registered.
+ * </p>
+ * @param listener listener to remove
+ */
void removeListener(IMemoryRenderingBindingsListener listener);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java
index 299b3e080..a61b11e57 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingManager.java
@@ -25,26 +25,26 @@ package org.eclipse.debug.ui.memory;
public interface IMemoryRenderingManager extends IMemoryRenderingBindingsProvider {
- /**
- * Returns all contributed memory rendering types.
- *
- * @return all contributed memory rendering types
- */
- IMemoryRenderingType[] getRenderingTypes();
-
- /**
- * Returns the memory rendering type with the given identifier, or
- * <code>null</code> if none. The memory rendering manager will
- * search through rendering types that are contributed via explicit
- * rendering bindings. (i.e. rendering types contributed via the
- * memoryRenderings extension point). This method will not return
- * rendering types that are contributed by a memory binding provider.
- *
- * @param id memory rendering type identifier
- * @return the memory rendering type with the given identifier, or
- * <code>null</code> if none
- */
- IMemoryRenderingType getRenderingType(String id);
+ /**
+ * Returns all contributed memory rendering types.
+ *
+ * @return all contributed memory rendering types
+ */
+ IMemoryRenderingType[] getRenderingTypes();
+
+ /**
+ * Returns the memory rendering type with the given identifier, or
+ * <code>null</code> if none. The memory rendering manager will
+ * search through rendering types that are contributed via explicit
+ * rendering bindings. (i.e. rendering types contributed via the
+ * memoryRenderings extension point). This method will not return
+ * rendering types that are contributed by a memory binding provider.
+ *
+ * @param id memory rendering type identifier
+ * @return the memory rendering type with the given identifier, or
+ * <code>null</code> if none
+ */
+ IMemoryRenderingType getRenderingType(String id);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java
index eb27bd922..ce88e7e22 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite.java
@@ -30,37 +30,37 @@ import org.eclipse.ui.IWorkbenchPartSite;
*/
public interface IMemoryRenderingSite {
- /**
- * Returns the workbench part site hosting memory renderings for this rendering site.
- *
- * @return the view site hosting memory renderings for this rendering site
- */
- IWorkbenchPartSite getSite();
+ /**
+ * Returns the workbench part site hosting memory renderings for this rendering site.
+ *
+ * @return the view site hosting memory renderings for this rendering site
+ */
+ IWorkbenchPartSite getSite();
- /**
- * Returns the syncrhonization service for this rendering site
- * or <code>null</code> if none.
- *
- * @return the syncrhonization service for this rendering site or <code>null</code>
- */
- IMemoryRenderingSynchronizationService getSynchronizationService();
+ /**
+ * Returns the syncrhonization service for this rendering site
+ * or <code>null</code> if none.
+ *
+ * @return the syncrhonization service for this rendering site or <code>null</code>
+ */
+ IMemoryRenderingSynchronizationService getSynchronizationService();
- /**
- * Returns all the memory rendering containers within this rendering site.
- *
- * @return all the memory rendering containers within this rendering site
- */
- IMemoryRenderingContainer[] getMemoryRenderingContainers();
+ /**
+ * Returns all the memory rendering containers within this rendering site.
+ *
+ * @return all the memory rendering containers within this rendering site
+ */
+ IMemoryRenderingContainer[] getMemoryRenderingContainers();
- /**
- * Returns the rendering container with the given id or <code>null</code>
- * if none.
- *
- * @param id identifier of the container being requested
- * @return the rendering container with the given id or <code>null</code>
- * if none
- */
- IMemoryRenderingContainer getContainer(String id);
+ /**
+ * Returns the rendering container with the given id or <code>null</code>
+ * if none.
+ *
+ * @param id identifier of the container being requested
+ * @return the rendering container with the given id or <code>null</code>
+ * if none
+ */
+ IMemoryRenderingContainer getContainer(String id);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite2.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite2.java
index 2fefb2d28..e39527813 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite2.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSite2.java
@@ -21,12 +21,12 @@ package org.eclipse.debug.ui.memory;
*/
public interface IMemoryRenderingSite2 extends IMemoryRenderingSite {
- /**
- * Sets whether the identified container should be visible.
- *
- * @param id identifier of the container to be affected
- * @param visible whether the given container should be made visible
- */
- void setContainerVisible(String id, boolean visible);
+ /**
+ * Sets whether the identified container should be visible.
+ *
+ * @param id identifier of the container to be affected
+ * @param visible whether the given container should be made visible
+ */
+ void setContainerVisible(String id, boolean visible);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java
index dbcd2e94b..71a261b50 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingSynchronizationService.java
@@ -26,50 +26,50 @@ import org.eclipse.jface.util.IPropertyChangeListener;
*/
public interface IMemoryRenderingSynchronizationService {
- /**
- * Adds a listener for property changes notification for the specified properties.
- * Specifying <code>null</code> indicates that the listener is interested in all
- * properties. If an identical listener is already registered, the properties
- * it is registered to listen for are updated.
- *
- * @param listener a property change listener
- * @param properties properties the listener is interested in, or <code>null</code>
- * to indicate all properties.
- */
- void addPropertyChangeListener(IPropertyChangeListener listener, String[] properties);
+ /**
+ * Adds a listener for property changes notification for the specified properties.
+ * Specifying <code>null</code> indicates that the listener is interested in all
+ * properties. If an identical listener is already registered, the properties
+ * it is registered to listen for are updated.
+ *
+ * @param listener a property change listener
+ * @param properties properties the listener is interested in, or <code>null</code>
+ * to indicate all properties.
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener, String[] properties);
- /**
- * Removes the given listener for property change notification.
- * Has no effect if the identical listener is not registered.
- *
- * @param listener a property change listener
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Removes the given listener for property change notification.
+ * Has no effect if the identical listener is not registered.
+ *
+ * @param listener a property change listener
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Returns the current value of the specified property for the given memory block, or
- * <code>null</code> if none.
- *
- * @param block memory block for which a property is requested
- * @param property the name of the property
- * @return the property value or <code>null</code>
- */
- Object getProperty(IMemoryBlock block, String property);
+ /**
+ * Returns the current value of the specified property for the given memory block, or
+ * <code>null</code> if none.
+ *
+ * @param block memory block for which a property is requested
+ * @param property the name of the property
+ * @return the property value or <code>null</code>
+ */
+ Object getProperty(IMemoryBlock block, String property);
- /**
- * Sets the rendering currently providing sychronization information for
- * this synchronization service, or <code>null</code> if none.
- *
- * @param rendering active rendering providing synchronization information or
- * <code>null</code>
- */
- void setSynchronizationProvider(IMemoryRendering rendering);
+ /**
+ * Sets the rendering currently providing sychronization information for
+ * this synchronization service, or <code>null</code> if none.
+ *
+ * @param rendering active rendering providing synchronization information or
+ * <code>null</code>
+ */
+ void setSynchronizationProvider(IMemoryRendering rendering);
- /**
+ /**
* Returns the rendering currently providing synchronization information for
* this synchronization service, or <code>null</code> if none.
*
* @return rendering providing synchronization information or <code>null</code>
*/
- IMemoryRendering getSynchronizationProvider();
+ IMemoryRendering getSynchronizationProvider();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingType.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingType.java
index 6dbae4892..76400be14 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingType.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingType.java
@@ -30,28 +30,28 @@ import org.eclipse.core.runtime.CoreException;
*/
public interface IMemoryRenderingType {
- /**
- * Returns a label for this type of memory rendering.
- *
- * @return a label for this type of memory rendering
- */
- String getLabel();
+ /**
+ * Returns a label for this type of memory rendering.
+ *
+ * @return a label for this type of memory rendering
+ */
+ String getLabel();
- /**
- * Returns the unique identifier for this rendering type.
- *
- * @return the unique identifier for this rendering type
- */
- String getId();
+ /**
+ * Returns the unique identifier for this rendering type.
+ *
+ * @return the unique identifier for this rendering type
+ */
+ String getId();
- /**
- * Creates and returns a new rendering of this type or <code>null</code>
- * if none.
- *
- * @return a new rendering of this type
- * @exception CoreException if an exception occurs creating
- * the rendering
- */
- IMemoryRendering createRendering() throws CoreException;
+ /**
+ * Creates and returns a new rendering of this type or <code>null</code>
+ * if none.
+ *
+ * @return a new rendering of this type
+ * @exception CoreException if an exception occurs creating
+ * the rendering
+ */
+ IMemoryRendering createRendering() throws CoreException;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingTypeDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingTypeDelegate.java
index f38d6f720..210c73856 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingTypeDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/IMemoryRenderingTypeDelegate.java
@@ -26,14 +26,14 @@ import org.eclipse.core.runtime.CoreException;
*/
public interface IMemoryRenderingTypeDelegate {
- /**
- * Creates and returns a rendering of the specified type, or <code>null</code>
- * if none.
- *
- * @param id unique identifier of a memory rendering type
- * @return a new rendering of the given type or <code>null</code>
- * @exception CoreException if unable to create the rendering
- */
- IMemoryRendering createRendering(String id) throws CoreException;
+ /**
+ * Creates and returns a rendering of the specified type, or <code>null</code>
+ * if none.
+ *
+ * @param id unique identifier of a memory rendering type
+ * @return a new rendering of the given type or <code>null</code>
+ * @exception CoreException if unable to create the rendering
+ */
+ IMemoryRendering createRendering(String id) throws CoreException;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
index 85a9531af..e718db992 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
@@ -111,9 +111,9 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE
parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
fText = new Text(parent,SWT.READ_ONLY|SWT.WRAP);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- fText.setLayoutData(data);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.grabExcessHorizontalSpace = true;
+ fText.setLayoutData(data);
fText.setForeground(JFaceColors.getErrorText(fText.getDisplay()));
fText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
if (getEditorInput() != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/ISourceLookupResult.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/ISourceLookupResult.java
index 046fa85dd..992004297 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/ISourceLookupResult.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/ISourceLookupResult.java
@@ -28,37 +28,37 @@ import org.eclipse.ui.IEditorInput;
*/
public interface ISourceLookupResult {
- /**
- * Returns the artifact for which source lookup was performed,
- * such as a stack frame.
- *
- * @return the artifact for which source lookup was performed
- */
- Object getArtifact();
+ /**
+ * Returns the artifact for which source lookup was performed,
+ * such as a stack frame.
+ *
+ * @return the artifact for which source lookup was performed
+ */
+ Object getArtifact();
- /**
- * Returns the source element resolved during source lookup,
- * or <code>null</code> if a source element was not resolved.
- *
- * @return resolved source element or <code>null</code> if unknown
- */
- Object getSourceElement();
+ /**
+ * Returns the source element resolved during source lookup,
+ * or <code>null</code> if a source element was not resolved.
+ *
+ * @return resolved source element or <code>null</code> if unknown
+ */
+ Object getSourceElement();
- /**
- * Returns the identifier of an editor used to display this result,
- * or <code>null</code> if unknown.
- *
- * @return the identifier of an editor used to display this result,
- * or <code>null</code> if unknown
- */
- String getEditorId();
+ /**
+ * Returns the identifier of an editor used to display this result,
+ * or <code>null</code> if unknown.
+ *
+ * @return the identifier of an editor used to display this result,
+ * or <code>null</code> if unknown
+ */
+ String getEditorId();
- /**
- * Returns the editor input used to display result,
- * or <code>null</code> if unknown.
- *
- * @return the editor input used to display result,
- * or <code>null</code> if unknown
- */
- IEditorInput getEditorInput();
+ /**
+ * Returns the editor input used to display result,
+ * or <code>null</code> if unknown.
+ *
+ * @return the editor input used to display result,
+ * or <code>null</code> if unknown
+ */
+ IEditorInput getEditorInput();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java
index 9cdac51ce..92440853b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java
@@ -61,7 +61,7 @@ public class SourceLookupDialog extends TitleAreaDialog {
*/
public SourceLookupDialog(Shell shell, ISourceLookupDirector director) {
super(shell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
fDirector = director;
}
@@ -126,13 +126,13 @@ public class SourceLookupDialog extends TitleAreaDialog {
return super.close();
}
- @Override
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(getClass().getName());
- if (section == null) {
- section = settings.addNewSection(getClass().getName());
- }
- return section;
- }
+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(getClass().getName());
+ if (section == null) {
+ section = settings.addNewSection(getClass().getName());
+ }
+ return section;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java
index 6fdc0f877..bea3d6ca1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java
@@ -97,7 +97,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab {
@Override
public String getId() {
- return "org.eclipse.debug.ui.sourceLookupTab"; //$NON-NLS-1$
+ return "org.eclipse.debug.ui.sourceLookupTab"; //$NON-NLS-1$
}
@Override
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java
index c9afb5626..33c9f94af 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java
@@ -73,32 +73,32 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
protected IWorkingSet workingSet;
protected ILaunchConfiguration fConfiguration;
- private boolean fCreateBuildScheduleComponent= true;
-
- // Console Output widgets
- private Button fConsoleOutput;
- private Button fFileOutput;
- private Button fFileBrowse;
- private Text fFileText;
- private Button fVariables;
- private Button fAppend;
- private Button fWorkspaceBrowse;
-
- /**
- * Constructor
- */
- public ExternalToolsBuilderTab() {
- setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB);
- }
-
- /**
- * Constructor
- * @param createBuildScheduleComponent
- */
- public ExternalToolsBuilderTab(boolean createBuildScheduleComponent) {
- fCreateBuildScheduleComponent= createBuildScheduleComponent;
- setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB);
- }
+ private boolean fCreateBuildScheduleComponent= true;
+
+ // Console Output widgets
+ private Button fConsoleOutput;
+ private Button fFileOutput;
+ private Button fFileBrowse;
+ private Text fFileText;
+ private Button fVariables;
+ private Button fAppend;
+ private Button fWorkspaceBrowse;
+
+ /**
+ * Constructor
+ */
+ public ExternalToolsBuilderTab() {
+ setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB);
+ }
+
+ /**
+ * Constructor
+ * @param createBuildScheduleComponent
+ */
+ public ExternalToolsBuilderTab(boolean createBuildScheduleComponent) {
+ fCreateBuildScheduleComponent= createBuildScheduleComponent;
+ setHelpContextId(IExternalToolsHelpContextIds.EXTERNAL_TOOLS_LAUNCH_CONFIGURATION_DIALOG_BUILDER_TAB);
+ }
protected SelectionListener selectionListener= new SelectionAdapter() {
@Override
@@ -124,7 +124,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
mainComposite.setLayout(layout);
mainComposite.setLayoutData(gridData);
mainComposite.setFont(parent.getFont());
- createOutputCaptureComponent(mainComposite);
+ createOutputCaptureComponent(mainComposite);
createLaunchInBackgroundComposite(mainComposite);
createBuildScheduleComponent(mainComposite);
}
@@ -149,17 +149,17 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
}
protected void createBuildScheduleComponent(Composite parent) {
- if (fCreateBuildScheduleComponent) {
- Label label= new Label(parent, SWT.NONE);
- label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Run_this_builder_for__1);
- label.setFont(parent.getFont());
- afterClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Full_builds_2, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Full, 2);
- manualBuild= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Incremental_builds_4, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Inc, 2);
- autoBuildButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Auto_builds__Not_recommended__6, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Auto, 2);
- fDuringClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_0, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_1, 2);
-
- createVerticalSpacer(parent, 2);
- }
+ if (fCreateBuildScheduleComponent) {
+ Label label= new Label(parent, SWT.NONE);
+ label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Run_this_builder_for__1);
+ label.setFont(parent.getFont());
+ afterClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Full_builds_2, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Full, 2);
+ manualBuild= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Incremental_builds_4, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Inc, 2);
+ autoBuildButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Auto_builds__Not_recommended__6, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Auto, 2);
+ fDuringClean= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_0, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_1, 2);
+
+ createVerticalSpacer(parent, 2);
+ }
workingSetButton= createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_label, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_tooltip, 1);
specifyResources= createPushButton(parent, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_13, null);
@@ -171,130 +171,130 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
selectResources();
}
});
- Label label= new Label(parent, SWT.NONE);
- label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_2);
- label.setFont(parent.getFont());
+ Label label= new Label(parent, SWT.NONE);
+ label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_2);
+ label.setFont(parent.getFont());
}
- private void createOutputCaptureComponent(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_17);
- GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
- gd.horizontalSpan = 2;
- group.setLayoutData(gd);
- GridLayout layout = new GridLayout(5, false);
- group.setLayout(layout);
- group.setFont(parent.getFont());
-
- fConsoleOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_18);
- gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false);
- gd.horizontalSpan = 5;
- fConsoleOutput.setLayoutData(gd);
-
- fConsoleOutput.addSelectionListener(new SelectionAdapter() {
- @Override
+ private void createOutputCaptureComponent(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_17);
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ gd.horizontalSpan = 2;
+ group.setLayoutData(gd);
+ GridLayout layout = new GridLayout(5, false);
+ group.setLayout(layout);
+ group.setFont(parent.getFont());
+
+ fConsoleOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_18);
+ gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false);
+ gd.horizontalSpan = 5;
+ fConsoleOutput.setLayoutData(gd);
+
+ fConsoleOutput.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
-
- fFileOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_19);
- fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false));
-
- fFileText = new Text(group, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(SWT.FILL, SWT.NORMAL, true, false);
- gd.horizontalSpan = 4;
- fFileText.setLayoutData(gd);
- fFileText.setFont(parent.getFont());
-
- Label spacer = new Label(group,SWT.NONE);
- gd = new GridData(SWT.FILL, SWT.NORMAL, true, false);
- gd.horizontalSpan=2;
- spacer.setLayoutData(gd);
- fWorkspaceBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_20, null);
- fFileBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_21, null);
- fVariables = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_22, null);
-
- spacer = new Label(group,SWT.NONE);
- spacer.setLayoutData(new GridData(SWT.FILL, SWT.NORMAL, false, false));
- fAppend = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_23);
- gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
- gd.horizontalSpan = 4;
- fAppend.setLayoutData(gd);
-
- fFileOutput.addSelectionListener(new SelectionAdapter() {
- @Override
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ fFileOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_19);
+ fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false));
+
+ fFileText = new Text(group, SWT.SINGLE | SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.NORMAL, true, false);
+ gd.horizontalSpan = 4;
+ fFileText.setLayoutData(gd);
+ fFileText.setFont(parent.getFont());
+
+ Label spacer = new Label(group,SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.NORMAL, true, false);
+ gd.horizontalSpan=2;
+ spacer.setLayoutData(gd);
+ fWorkspaceBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_20, null);
+ fFileBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_21, null);
+ fVariables = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_22, null);
+
+ spacer = new Label(group,SWT.NONE);
+ spacer.setLayoutData(new GridData(SWT.FILL, SWT.NORMAL, false, false));
+ fAppend = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_23);
+ gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
+ gd.horizontalSpan = 4;
+ fAppend.setLayoutData(gd);
+
+ fFileOutput.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- boolean enabled = fFileOutput.getSelection();
- fFileText.setEnabled(enabled);
- fFileBrowse.setEnabled(enabled);
- fWorkspaceBrowse.setEnabled(enabled);
- fVariables.setEnabled(enabled);
- fAppend.setEnabled(enabled);
- updateLaunchConfigurationDialog();
- }
- });
-
- fAppend.addSelectionListener(new SelectionAdapter() {
- @Override
+ boolean enabled = fFileOutput.getSelection();
+ fFileText.setEnabled(enabled);
+ fFileBrowse.setEnabled(enabled);
+ fWorkspaceBrowse.setEnabled(enabled);
+ fVariables.setEnabled(enabled);
+ fAppend.setEnabled(enabled);
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ fAppend.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
+ updateLaunchConfigurationDialog();
+ }
+ });
- fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() {
- @Override
+ fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24);
- dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25);
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- int buttonId = dialog.open();
- if (buttonId == IDialogConstants.OK_ID) {
- IResource resource = (IResource) dialog.getFirstResult();
- String arg = resource.getFullPath().toString();
- String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
- fFileText.setText(fileLoc);
- }
- }
- });
-
- fFileBrowse.addSelectionListener(new SelectionAdapter() {
- @Override
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24);
+ dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ int buttonId = dialog.open();
+ if (buttonId == IDialogConstants.OK_ID) {
+ IResource resource = (IResource) dialog.getFirstResult();
+ String arg = resource.getFullPath().toString();
+ String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
+ fFileText.setText(fileLoc);
+ }
+ }
+ });
+
+ fFileBrowse.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- String filePath = fFileText.getText();
+ String filePath = fFileText.getText();
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE | SWT.SHEET);
- filePath = dialog.open();
- if (filePath != null) {
- fFileText.setText(filePath);
- }
- }
- });
+ filePath = dialog.open();
+ if (filePath != null) {
+ fFileText.setText(filePath);
+ }
+ }
+ });
- fFileText.addModifyListener(new ModifyListener() {
- @Override
+ fFileText.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
+ updateLaunchConfigurationDialog();
+ }
+ });
- fVariables.addSelectionListener(new SelectionListener() {
- @Override
+ fVariables.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
- dialog.open();
- String variable = dialog.getVariableExpression();
- if (variable != null) {
- fFileText.insert(variable);
- }
- }
- @Override
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ dialog.open();
+ String variable = dialog.getVariableExpression();
+ if (variable != null) {
+ fFileText.insert(variable);
+ }
+ }
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- }
+ }
+ });
+ }
/*
* Creates a check button in the given composite with the given text
@@ -303,7 +303,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
Button button= createCheckButton(parent, text);
button.setToolTipText(tooltipText);
button.addSelectionListener(listener);
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
+ GridData gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = columns;
button.setLayoutData(gd);
return button;
@@ -323,12 +323,12 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
fConfiguration= configuration;
- if (fCreateBuildScheduleComponent) {
- afterClean.setSelection(false);
- manualBuild.setSelection(false);
- autoBuildButton.setSelection(false);
- fDuringClean.setSelection(false);
- }
+ if (fCreateBuildScheduleComponent) {
+ afterClean.setSelection(false);
+ manualBuild.setSelection(false);
+ autoBuildButton.setSelection(false);
+ fDuringClean.setSelection(false);
+ }
String buildKindString= null;
String buildScope= null;
@@ -345,27 +345,27 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
workingSet = RefreshTab.getWorkingSet(buildScope);
}
- if (fCreateBuildScheduleComponent) {
- int buildTypes[]= BuilderUtils.buildTypesToArray(buildKindString);
- for (int i = 0; i < buildTypes.length; i++) {
- switch (buildTypes[i]) {
- case IncrementalProjectBuilder.FULL_BUILD:
- afterClean.setSelection(true);
- break;
- case IncrementalProjectBuilder.INCREMENTAL_BUILD:
- manualBuild.setSelection(true);
- break;
- case IncrementalProjectBuilder.AUTO_BUILD:
- autoBuildButton.setSelection(true);
- break;
- case IncrementalProjectBuilder.CLEAN_BUILD:
- fDuringClean.setSelection(true);
- break;
+ if (fCreateBuildScheduleComponent) {
+ int buildTypes[]= BuilderUtils.buildTypesToArray(buildKindString);
+ for (int i = 0; i < buildTypes.length; i++) {
+ switch (buildTypes[i]) {
+ case IncrementalProjectBuilder.FULL_BUILD:
+ afterClean.setSelection(true);
+ break;
+ case IncrementalProjectBuilder.INCREMENTAL_BUILD:
+ manualBuild.setSelection(true);
+ break;
+ case IncrementalProjectBuilder.AUTO_BUILD:
+ autoBuildButton.setSelection(true);
+ break;
+ case IncrementalProjectBuilder.CLEAN_BUILD:
+ fDuringClean.setSelection(true);
+ break;
default:
break;
- }
- }
- }
+ }
+ }
+ }
boolean enabled= true;
if (fCreateBuildScheduleComponent) {
@@ -374,58 +374,58 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
workingSetButton.setEnabled(enabled);
specifyResources.setEnabled(enabled && workingSetButton.getSelection());
updateRunInBackground(configuration);
- updateConsoleOutput(configuration);
+ updateConsoleOutput(configuration);
}
protected void updateRunInBackground(ILaunchConfiguration configuration) {
fLaunchInBackgroundButton.setSelection(ExternalToolsCoreUtil.isAsynchronousBuild(configuration));
}
- private void updateConsoleOutput(ILaunchConfiguration configuration) {
- boolean outputToConsole = true;
- String outputFile = null;
- boolean append = false;
-
- try {
- outputToConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
- outputFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
- append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false);
- } catch (CoreException e) {
- }
-
- fConsoleOutput.setSelection(outputToConsole);
- fAppend.setSelection(append);
- boolean haveOutputFile= outputFile != null;
- if (haveOutputFile) {
- fFileText.setText(outputFile);
- }
- fFileOutput.setSelection(haveOutputFile);
- fFileText.setEnabled(haveOutputFile);
- fFileBrowse.setEnabled(haveOutputFile);
- fWorkspaceBrowse.setEnabled(haveOutputFile);
- fVariables.setEnabled(haveOutputFile);
- fAppend.setEnabled(haveOutputFile);
- }
+ private void updateConsoleOutput(ILaunchConfiguration configuration) {
+ boolean outputToConsole = true;
+ String outputFile = null;
+ boolean append = false;
+
+ try {
+ outputToConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
+ outputFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
+ append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false);
+ } catch (CoreException e) {
+ }
+
+ fConsoleOutput.setSelection(outputToConsole);
+ fAppend.setSelection(append);
+ boolean haveOutputFile= outputFile != null;
+ if (haveOutputFile) {
+ fFileText.setText(outputFile);
+ }
+ fFileOutput.setSelection(haveOutputFile);
+ fFileText.setEnabled(haveOutputFile);
+ fFileBrowse.setEnabled(haveOutputFile);
+ fWorkspaceBrowse.setEnabled(haveOutputFile);
+ fVariables.setEnabled(haveOutputFile);
+ fAppend.setEnabled(haveOutputFile);
+ }
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- if (fCreateBuildScheduleComponent) {
- StringBuilder buffer= new StringBuilder();
- if (afterClean.getSelection()) {
- buffer.append(IExternalToolConstants.BUILD_TYPE_FULL).append(',');
- }
- if (manualBuild.getSelection()){
- buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(',');
- }
- if (autoBuildButton.getSelection()) {
- buffer.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(',');
- }
-
- if (fDuringClean.getSelection()) {
- buffer.append(IExternalToolConstants.BUILD_TYPE_CLEAN);
- }
- configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString());
- }
+ if (fCreateBuildScheduleComponent) {
+ StringBuilder buffer= new StringBuilder();
+ if (afterClean.getSelection()) {
+ buffer.append(IExternalToolConstants.BUILD_TYPE_FULL).append(',');
+ }
+ if (manualBuild.getSelection()){
+ buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(',');
+ }
+ if (autoBuildButton.getSelection()) {
+ buffer.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(',');
+ }
+
+ if (fDuringClean.getSelection()) {
+ buffer.append(IExternalToolConstants.BUILD_TYPE_CLEAN);
+ }
+ configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString());
+ }
if (workingSetButton.getSelection()) {
String scope = RefreshTab.getRefreshAttribute(workingSet);
configuration.setAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, scope);
@@ -434,31 +434,31 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
}
configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, fLaunchInBackgroundButton.getSelection());
- boolean captureOutput = false;
- if (fConsoleOutput.getSelection()) {
- captureOutput = true;
- configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String)null);
- } else {
- configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
- }
- if (fFileOutput.getSelection()) {
- captureOutput = true;
- String file = fFileText.getText();
- configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, file);
- if(fAppend.getSelection()) {
- configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, true);
- } else {
- configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, (String)null);
- }
- } else {
- configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
- }
-
- if (!captureOutput) {
- configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false);
- } else {
- configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, (String)null);
- }
+ boolean captureOutput = false;
+ if (fConsoleOutput.getSelection()) {
+ captureOutput = true;
+ configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, (String)null);
+ } else {
+ configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
+ }
+ if (fFileOutput.getSelection()) {
+ captureOutput = true;
+ String file = fFileText.getText();
+ configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, file);
+ if(fAppend.getSelection()) {
+ configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, true);
+ } else {
+ configuration.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, (String)null);
+ }
+ } else {
+ configuration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String)null);
+ }
+
+ if (!captureOutput) {
+ configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false);
+ } else {
+ configuration.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, (String)null);
+ }
}
@Override
@@ -476,15 +476,15 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
setErrorMessage(null);
setMessage(null);
if (fCreateBuildScheduleComponent) {
- boolean buildKindSelected= afterClean.getSelection() || manualBuild.getSelection() || autoBuildButton.getSelection() || fDuringClean.getSelection();
- if (!buildKindSelected) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_buildKindError);
- return false;
- }
- }
+ boolean buildKindSelected= afterClean.getSelection() || manualBuild.getSelection() || autoBuildButton.getSelection() || fDuringClean.getSelection();
+ if (!buildKindSelected) {
+ setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_buildKindError);
+ return false;
+ }
+ }
if (workingSetButton.getSelection() && (workingSet == null || workingSet.getElements().length == 0)) {
setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_16);
- return false;
+ return false;
}
return validateRedirectFile();
@@ -525,14 +525,14 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
// do nothing on deactivation
}
- private boolean validateRedirectFile() {
- if(fFileOutput.getSelection()) {
- int len = fFileText.getText().trim().length();
- if (len == 0) {
- setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_26);
- return false;
- }
- }
- return true;
- }
+ private boolean validateRedirectFile() {
+ if(fFileOutput.getSelection()) {
+ int len = fFileText.getText().trim().length();
+ if (len == 0) {
+ setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_26);
+ return false;
+ }
+ }
+ return true;
+ }
} \ No newline at end of file
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
index 5b09df9dd..e1237be42 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsLaunchConfigurationMessages.java
@@ -82,23 +82,23 @@ public class ExternalToolsLaunchConfigurationMessages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, ExternalToolsLaunchConfigurationMessages.class);
}
- public static String ExternalToolsBuilderTab_17;
+ public static String ExternalToolsBuilderTab_17;
- public static String ExternalToolsBuilderTab_18;
+ public static String ExternalToolsBuilderTab_18;
- public static String ExternalToolsBuilderTab_19;
+ public static String ExternalToolsBuilderTab_19;
- public static String ExternalToolsBuilderTab_20;
+ public static String ExternalToolsBuilderTab_20;
- public static String ExternalToolsBuilderTab_21;
+ public static String ExternalToolsBuilderTab_21;
- public static String ExternalToolsBuilderTab_22;
+ public static String ExternalToolsBuilderTab_22;
- public static String ExternalToolsBuilderTab_23;
+ public static String ExternalToolsBuilderTab_23;
- public static String ExternalToolsBuilderTab_24;
+ public static String ExternalToolsBuilderTab_24;
- public static String ExternalToolsBuilderTab_25;
+ public static String ExternalToolsBuilderTab_25;
- public static String ExternalToolsBuilderTab_26;
+ public static String ExternalToolsBuilderTab_26;
} \ No newline at end of file
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
index 520c4db2b..7c050f866 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java
@@ -161,7 +161,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
Composite buttonComposite = new Composite(group, SWT.NONE);
layout = new GridLayout();
layout.marginHeight = 0;
- layout.marginWidth = 0;
+ layout.marginWidth = 0;
layout.numColumns = 3;
gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
buttonComposite.setLayout(layout);
@@ -213,8 +213,8 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
Composite buttonComposite = new Composite(group, SWT.NONE);
layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
layout.numColumns = 3;
gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
buttonComposite.setLayout(layout);
@@ -257,7 +257,7 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
GridData gridData = new GridData(GridData.FILL_BOTH);
group.setLayout(layout);
group.setLayoutData(gridData);
- group.setFont(parent.getFont());
+ group.setFont(parent.getFont());
argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
argumentField.addTraverseListener(new TraverseListener() {
@@ -279,8 +279,8 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
Composite composite = new Composite(group, SWT.NONE);
layout = new GridLayout();
layout.numColumns= 1;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
composite.setLayout(layout);
composite.setLayoutData(gridData);
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java
index 1b38bff61..45cadaf63 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsUtil.java
@@ -72,7 +72,7 @@ public class ExternalToolsUtil {
* @throws CoreException if unable to access the associated attribute
*/
public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException {
- return ExternalToolsCoreUtil.getCaptureOutput(configuration);
+ return ExternalToolsCoreUtil.getCaptureOutput(configuration);
}
/**
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
index 90fe1f02f..c9daf48ec 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java
@@ -175,14 +175,14 @@ public class BuilderUtils {
return BuilderCoreUtils.migrateBuilderConfiguration(project, workingCopy);
}
- /**
- * Converts the build types string into an array of
- * build kinds.
- *
- * @param buildTypes the string of built types to convert
- * @return the array of build kinds.
- */
- public static int[] buildTypesToArray(String buildTypes) {
- return BuilderCoreUtils.buildTypesToArray(buildTypes);
- }
+ /**
+ * Converts the build types string into an array of
+ * build kinds.
+ *
+ * @param buildTypes the string of built types to convert
+ * @return the array of build kinds.
+ */
+ public static int[] buildTypesToArray(String buildTypes) {
+ return BuilderCoreUtils.buildTypesToArray(buildTypes);
+ }
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java
index 6fb547796..767bb0f96 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsImages.java
@@ -110,7 +110,7 @@ public class ExternalToolsImages {
* This may mean the same package directory as the package holding this class.
* The images are declared using this.getClass() to ensure they are looked up via
* this plugin class.
- * @see org.eclipse.jface.resource.ImageRegistry
+ * @see org.eclipse.jface.resource.ImageRegistry
*/
public static ImageRegistry initializeImageRegistry() {
imageRegistry= new ImageRegistry(ExternalToolsPlugin.getStandardDisplay());
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
index cd9c3224e..369ccf6b4 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java
@@ -162,10 +162,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
if (oldConfig == null) {
return;
}
- //Replace the movedFrom config in the list of newly created configs
- if (newConfigList.remove(oldConfig)) {
- newConfigList.add(configuration);
- }
+ //Replace the movedFrom config in the list of newly created configs
+ if (newConfigList.remove(oldConfig)) {
+ newConfigList.add(configuration);
+ }
Display.getDefault().asyncExec(() -> {
TableItem[] items = viewer.getTable().getItems();
@@ -212,7 +212,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
commands = project.getDescription().getBuildSpec();
} catch (CoreException e) {
handleException(e);
- return;
+ return;
}
boolean projectNeedsMigration= false;
@@ -227,10 +227,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
Object element= null;
if (config != null) {
if (!config.isWorkingCopy() && !config.exists()) {
- Shell shell= getShell();
- if (shell == null) {
- return;
- }
+ Shell shell= getShell();
+ if (shell == null) {
+ return;
+ }
IStatus status = new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, 0, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_Exists, new String[]{config.getName()}), null);
ErrorDialog.openError(getShell(), ExternalToolsUIMessages.BuilderPropertyPage_errorTitle,
NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_External_Tool_Builder__0__Not_Added_2, new String[]{config.getName()}),
@@ -258,10 +258,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
boolean prompt= store.getBoolean(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION);
boolean proceed= true;
if (prompt) {
- Shell shell= getShell();
- if (shell == null) {
- return;
- }
+ Shell shell= getShell();
+ if (shell == null) {
+ return;
+ }
MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(shell, ExternalToolsUIMessages.BuilderPropertyPage_0, ExternalToolsUIMessages.BuilderPropertyPage_1, ExternalToolsUIMessages.BuilderPropertyPage_2, false, null, null);
proceed= dialog.getReturnCode() == IDialogConstants.YES_ID;
store.setValue(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, !dialog.getToggleState());
@@ -416,9 +416,9 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
} else if (button == downButton) {
moveSelectionDown();
}
- if (getControl().isDisposed()) {
- return;
- }
+ if (getControl().isDisposed()) {
+ return;
+ }
handleTableSelectionChanged();
viewer.getTable().setFocus();
}
@@ -430,25 +430,25 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
if (element instanceof ILaunchConfiguration) {
enableLaunchConfiguration((ILaunchConfiguration) element, checked);
} else if (element instanceof ICommand) {
- Shell shell= getShell();
- if (shell == null) {
- return;
- }
- if (checked) {
- enableCommand((ICommand)element, checked);
- return;
- } else if (!fWarned) {
- if(MessageDialog.openConfirm(shell, ExternalToolsUIMessages.BuilderPropertyPage_6, ExternalToolsUIMessages.BuilderPropertyPage_7)) {
- fWarned = true;
- }
+ Shell shell= getShell();
+ if (shell == null) {
+ return;
+ }
+ if (checked) {
+ enableCommand((ICommand)element, checked);
+ return;
+ } else if (!fWarned) {
+ if(MessageDialog.openConfirm(shell, ExternalToolsUIMessages.BuilderPropertyPage_6, ExternalToolsUIMessages.BuilderPropertyPage_7)) {
+ fWarned = true;
+ }
+ }
+ if(fWarned) {
+ enableCommand((ICommand)element, checked);
}
- if(fWarned) {
- enableCommand((ICommand)element, checked);
- }
- else {
- viewer.removeCheckStateListener(this);
- viewer.setChecked(element, true);
- viewer.addCheckStateListener(this);
+ else {
+ viewer.removeCheckStateListener(this);
+ viewer.setChecked(element, true);
+ viewer.addCheckStateListener(this);
}
}
@@ -509,10 +509,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
} catch (CoreException e) {
}
}
- Shell shell= getShell();
- if (shell == null) {
- return;
- }
+ Shell shell= getShell();
+ if (shell == null) {
+ return;
+ }
ElementListSelectionDialog dialog= new ElementListSelectionDialog(shell, new BuilderLabelProvider());
dialog.setTitle(ExternalToolsUIMessages.BuilderPropertyPage_4);
dialog.setMessage(ExternalToolsUIMessages.BuilderPropertyPage_5);
@@ -632,10 +632,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
private int editConfiguration(ILaunchConfiguration config) {
ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
manager.addLaunchConfigurationListener(configurationListener);
- Shell shell= getShell();
- if (shell == null) {
- return Window.CANCEL;
- }
+ Shell shell= getShell();
+ if (shell == null) {
+ return Window.CANCEL;
+ }
int code= DebugUITools.openLaunchConfigurationPropertiesDialog(shell, config, org.eclipse.ui.externaltools.internal.model.IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_GROUP);
manager.removeLaunchConfigurationListener(configurationListener);
return code;
@@ -651,10 +651,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
*/
private ILaunchConfigurationType promptForConfigurationType() {
List<ILaunchConfigurationType> externalToolTypes = getConfigurationTypes(IExternalToolConstants.ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY);
- Shell shell= getShell();
- if (shell == null) {
- return null;
- }
+ Shell shell= getShell();
+ if (shell == null) {
+ return null;
+ }
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new BuilderLabelProvider());
dialog.setElements(externalToolTypes.toArray());
dialog.setMultipleSelection(false);
@@ -752,10 +752,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
// User has asked not to be prompted
return true;
}
- Shell shell= getShell();
- if (shell == null) {
- return false;
- }
+ Shell shell= getShell();
+ if (shell == null) {
+ return false;
+ }
// Warn the user that editing an old config will cause storage migration.
MessageDialogWithToggle dialog= MessageDialogWithToggle.openYesNoQuestion(getShell(),
ExternalToolsUIMessages.BuilderPropertyPage_Migrate_project_builder_10,
@@ -781,7 +781,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
Shell shell = getShell();
if (shell != null) {
ErrorDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_errorTitle, ExternalToolsUIMessages.BuilderPropertyPage_errorMessage, status[0]);
- }
+ }
});
}
@@ -1003,10 +1003,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
try {
workingCopy.doSave();
} catch (CoreException e) {
- Shell shell= getShell();
- if (shell != null) {
- MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] {workingCopy.getName()}));
- }
+ Shell shell= getShell();
+ if (shell != null) {
+ MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] {workingCopy.getName()}));
+ }
}
}
}
@@ -1029,7 +1029,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
project.setDescription(desc, IResource.FORCE, monitor);
} catch (CoreException e) {
handleException(e);
- performCancel();
+ performCancel();
}
}
@@ -1070,10 +1070,10 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
configsToBeDeleted.add(config);
return newCommand;
} catch (CoreException exception) {
- Shell shell= getShell();
- if (shell != null) {
- MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_13, ExternalToolsUIMessages.BuilderPropertyPage_error);
- }
+ Shell shell= getShell();
+ if (shell != null) {
+ MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_13, ExternalToolsUIMessages.BuilderPropertyPage_error);
+ }
return null;
}
}
@@ -1220,11 +1220,11 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
return super.performCancel();
}
- @Override
+ @Override
public Shell getShell() {
- if (getControl().isDisposed()) {
+ if (getControl().isDisposed()) {
return null;
- }
- return super.getShell();
- }
+ }
+ return super.getShell();
+ }
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java
index 849eccc32..dc927a575 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java
@@ -61,7 +61,7 @@ public class FileSelectionDialog extends MessageDialog {
private boolean allowMultiselection= false;
- private Pattern fPattern;
+ private Pattern fPattern;
/**
* Creates a resource selection dialog rooted at the given element.
*
@@ -94,15 +94,15 @@ public class FileSelectionDialog extends MessageDialog {
* this argument is ignored.
*/
public void setFileFilter(String pattern, boolean ignoreCase) {
- if (pattern != null) {
- if (ignoreCase) {
- fPattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
- } else {
- fPattern = Pattern.compile(pattern);
- }
- } else {
- fPattern = null;
- }
+ if (pattern != null) {
+ if (ignoreCase) {
+ fPattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
+ } else {
+ fPattern = Pattern.compile(pattern);
+ }
+ } else {
+ fPattern = null;
+ }
}
@Override
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java
index 947154ccb..b52e78a0a 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java
@@ -206,7 +206,7 @@ public class TreeAndListGroup implements ISelectionChangedListener {
treeViewer = new TreeViewer(tree);
treeViewer.setContentProvider(treeContentProvider);
treeViewer.setLabelProvider(treeLabelProvider);
- treeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ treeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
treeViewer.addSelectionChangedListener(this);
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
index 2ed9f6c61..a3ca6a1fd 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
@@ -27,116 +27,116 @@ import org.eclipse.core.variables.IDynamicVariableResolver;
public class BuildFilesResolver implements IDynamicVariableResolver
{
- private static final char ARG_REMOVED = 'r';
- private static final char ARG_CHANGED = 'c';
- private static final char ARG_ADDED = 'a';
- private static final char ARG_DIRS = 'd';
- private static final char ARG_FILES = 'f';
+ private static final char ARG_REMOVED = 'r';
+ private static final char ARG_CHANGED = 'c';
+ private static final char ARG_ADDED = 'a';
+ private static final char ARG_DIRS = 'd';
+ private static final char ARG_FILES = 'f';
- // Use a space as a separator as this is a more natural fit for sending a
- // list of files to a unix command
- private static final String FILE_LIST_SEPARATOR = " "; //$NON-NLS-1$
+ // Use a space as a separator as this is a more natural fit for sending a
+ // list of files to a unix command
+ private static final String FILE_LIST_SEPARATOR = " "; //$NON-NLS-1$
@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException
- {
- String result = null;
+ {
+ String result = null;
- IResourceDelta buildDelta = ExternalToolBuilder.getBuildDelta();
- if (buildDelta != null)
- {
- final StringBuffer fileList = new StringBuffer();
+ IResourceDelta buildDelta = ExternalToolBuilder.getBuildDelta();
+ if (buildDelta != null)
+ {
+ final StringBuffer fileList = new StringBuffer();
final Set<String> changedResources = new LinkedHashSet<>();
- // Use the argument to determine which deltas to visit - if none,
- // then defaults to all
- int deltas = 0;
- boolean dirs = false, files = false;
- if (argument != null)
- {
- // Check delta kinds
- if (argument.indexOf(ARG_ADDED) > -1)
- {
- deltas |= IResourceDelta.ADDED;
- }
- if (argument.indexOf(ARG_CHANGED) > -1)
- {
- deltas |= IResourceDelta.CHANGED;
- }
- if (argument.indexOf(ARG_REMOVED) > -1)
- {
- deltas |= IResourceDelta.REMOVED;
- }
+ // Use the argument to determine which deltas to visit - if none,
+ // then defaults to all
+ int deltas = 0;
+ boolean dirs = false, files = false;
+ if (argument != null)
+ {
+ // Check delta kinds
+ if (argument.indexOf(ARG_ADDED) > -1)
+ {
+ deltas |= IResourceDelta.ADDED;
+ }
+ if (argument.indexOf(ARG_CHANGED) > -1)
+ {
+ deltas |= IResourceDelta.CHANGED;
+ }
+ if (argument.indexOf(ARG_REMOVED) > -1)
+ {
+ deltas |= IResourceDelta.REMOVED;
+ }
- // Check wether to include files and/or directories
- if (argument.indexOf(ARG_DIRS) > -1)
- {
- dirs = true;
- }
- if (argument.indexOf(ARG_FILES) > -1)
- {
- files = true;
- }
+ // Check wether to include files and/or directories
+ if (argument.indexOf(ARG_DIRS) > -1)
+ {
+ dirs = true;
+ }
+ if (argument.indexOf(ARG_FILES) > -1)
+ {
+ files = true;
+ }
- }
- if (deltas == 0)
- {
- deltas = IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED;
- }
- if (!dirs && !files)
- {
- dirs = true;
- files = true;
- }
- final int trackDeltas = deltas;
- final boolean trackDirs = dirs;
- final boolean trackFiles = files;
+ }
+ if (deltas == 0)
+ {
+ deltas = IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED;
+ }
+ if (!dirs && !files)
+ {
+ dirs = true;
+ files = true;
+ }
+ final int trackDeltas = deltas;
+ final boolean trackDirs = dirs;
+ final boolean trackFiles = files;
- buildDelta.accept(new IResourceDeltaVisitor()
- {
- @Override
+ buildDelta.accept(new IResourceDeltaVisitor()
+ {
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException
- {
- IResource resource = delta.getResource();
+ {
+ IResource resource = delta.getResource();
- // Only track files with the right kind of delta
- boolean isTracked = (delta.getKind() & trackDeltas) > 0;
- if (isTracked)
- {
- // Only track dirs if desired
- isTracked = trackDirs && resource.getType() != IResource.FILE;
- // Only track files if desired
- isTracked |= trackFiles && resource.getType() == IResource.FILE;
- }
+ // Only track files with the right kind of delta
+ boolean isTracked = (delta.getKind() & trackDeltas) > 0;
+ if (isTracked)
+ {
+ // Only track dirs if desired
+ isTracked = trackDirs && resource.getType() != IResource.FILE;
+ // Only track files if desired
+ isTracked |= trackFiles && resource.getType() == IResource.FILE;
+ }
- // If tracking a change, then add it to the change set for inclusion in the variable's output
- if (isTracked)
- {
- String osPath = resource.getLocation().toOSString();
- if (changedResources.add(osPath))
- {
- if (fileList.length() > 0)
- {
- fileList.append(FILE_LIST_SEPARATOR);
- }
+ // If tracking a change, then add it to the change set for inclusion in the variable's output
+ if (isTracked)
+ {
+ String osPath = resource.getLocation().toOSString();
+ if (changedResources.add(osPath))
+ {
+ if (fileList.length() > 0)
+ {
+ fileList.append(FILE_LIST_SEPARATOR);
+ }
- // Since space is our separator, we need to add quotes
- // around each file to handle filenames with embedded
- // spaces. We also need to escape out embedded quotes in
- // the filename so they don't conflict with these
- // special quotes.
- //
- osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
- fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return true;
- }
- }, deltas);
- result = fileList.toString();
- }
+ // Since space is our separator, we need to add quotes
+ // around each file to handle filenames with embedded
+ // spaces. We also need to escape out embedded quotes in
+ // the filename so they don't conflict with these
+ // special quotes.
+ //
+ osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
+ fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return true;
+ }
+ }, deltas);
+ result = fileList.toString();
+ }
- return result;
- }
+ return result;
+ }
} \ No newline at end of file
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java
index d435cb745..9b3aaad59 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/SystemPathResolver.java
@@ -31,38 +31,38 @@ public class SystemPathResolver implements IDynamicVariableResolver {
@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
- if (argument == null) {
- throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null));
- }
+ if (argument == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ExternalToolsPlugin.PLUGIN_ID, IExternalToolConstants.ERR_INTERNAL_ERROR, VariableMessages.SystemPathResolver_0, null));
+ }
Map<String, String> map = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironment();
- String path= map.get("PATH"); //$NON-NLS-1$
- if (path == null) {
- return argument;
- }
- // On MS Windows the PATHEXT environment variable defines which file extensions
- // mark files that are executable (e.g. .EXE, .COM, .BAT)
- String pathext = map.get("PATHEXT"); //$NON-NLS-1$
- StringTokenizer tokenizer= new StringTokenizer(path, File.pathSeparator);
- while (tokenizer.hasMoreTokens()) {
- String pathElement= tokenizer.nextToken();
- File pathElementFile= new File(pathElement);
- if (pathElementFile.isDirectory()) {
- File toolFile= new File(pathElementFile, argument);
- if (toolFile.exists()) {
- return toolFile.getAbsolutePath();
- }
- if ( pathext != null ) {
- StringTokenizer pathextTokenizer = new StringTokenizer(pathext, File.pathSeparator);
- while (pathextTokenizer.hasMoreTokens()) {
- String pathextElement = pathextTokenizer.nextToken();
- toolFile = new File(pathElementFile, argument + pathextElement);
- if (toolFile.exists()) {
- return toolFile.getAbsolutePath();
- }
- }
- }
- }
- }
- return argument;
+ String path= map.get("PATH"); //$NON-NLS-1$
+ if (path == null) {
+ return argument;
+ }
+ // On MS Windows the PATHEXT environment variable defines which file extensions
+ // mark files that are executable (e.g. .EXE, .COM, .BAT)
+ String pathext = map.get("PATHEXT"); //$NON-NLS-1$
+ StringTokenizer tokenizer= new StringTokenizer(path, File.pathSeparator);
+ while (tokenizer.hasMoreTokens()) {
+ String pathElement= tokenizer.nextToken();
+ File pathElementFile= new File(pathElement);
+ if (pathElementFile.isDirectory()) {
+ File toolFile= new File(pathElementFile, argument);
+ if (toolFile.exists()) {
+ return toolFile.getAbsolutePath();
+ }
+ if ( pathext != null ) {
+ StringTokenizer pathextTokenizer = new StringTokenizer(pathext, File.pathSeparator);
+ while (pathextTokenizer.hasMoreTokens()) {
+ String pathextElement = pathextTokenizer.nextToken();
+ toolFile = new File(pathElementFile, argument + pathextElement);
+ if (toolFile.exists()) {
+ return toolFile.getAbsolutePath();
+ }
+ }
+ }
+ }
+ }
+ return argument;
}
}

Back to the top